diff --git a/common/changes/@visactor/lark-vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json b/common/changes/@visactor/lark-vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json deleted file mode 100644 index e86f675e56..0000000000 --- a/common/changes/@visactor/lark-vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/lark-vchart", - "comment": "", - "type": "patch" - } - ], - "packageName": "@visactor/lark-vchart" -} diff --git a/common/changes/@visactor/lark-vchart/fix-issue-251_2023-07-27-14-40.json b/common/changes/@visactor/lark-vchart/fix-issue-251_2023-07-27-14-40.json deleted file mode 100644 index e86f675e56..0000000000 --- a/common/changes/@visactor/lark-vchart/fix-issue-251_2023-07-27-14-40.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/lark-vchart", - "comment": "", - "type": "patch" - } - ], - "packageName": "@visactor/lark-vchart" -} diff --git a/common/changes/@visactor/react-vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json b/common/changes/@visactor/react-vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json deleted file mode 100644 index 87449179c5..0000000000 --- a/common/changes/@visactor/react-vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/react-vchart", - "comment": "", - "type": "none" - } - ], - "packageName": "@visactor/react-vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/react-vchart/fix-issue-251_2023-07-27-14-40.json b/common/changes/@visactor/react-vchart/fix-issue-251_2023-07-27-14-40.json deleted file mode 100644 index 87449179c5..0000000000 --- a/common/changes/@visactor/react-vchart/fix-issue-251_2023-07-27-14-40.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/react-vchart", - "comment": "", - "type": "none" - } - ], - "packageName": "@visactor/react-vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/taro-vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json b/common/changes/@visactor/taro-vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json deleted file mode 100644 index d1ddb0ab5d..0000000000 --- a/common/changes/@visactor/taro-vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/taro-vchart", - "comment": "", - "type": "none" - } - ], - "packageName": "@visactor/taro-vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/taro-vchart/fix-issue-251_2023-07-27-14-40.json b/common/changes/@visactor/taro-vchart/fix-issue-251_2023-07-27-14-40.json deleted file mode 100644 index d1ddb0ab5d..0000000000 --- a/common/changes/@visactor/taro-vchart/fix-issue-251_2023-07-27-14-40.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/taro-vchart", - "comment": "", - "type": "none" - } - ], - "packageName": "@visactor/taro-vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json b/common/changes/@visactor/vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json deleted file mode 100644 index f75211e4be..0000000000 --- a/common/changes/@visactor/vchart/feat-support-getLogger-api-of-vchart_2023-07-28-02-22.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "feat(logger): support static api `getLogger` in vchart class", - "type": "patch" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/feat-support-getLogger-api-of-vchart_2023-07-28-03-06.json b/common/changes/@visactor/vchart/feat-support-getLogger-api-of-vchart_2023-07-28-03-06.json deleted file mode 100644 index eae5ec4954..0000000000 --- a/common/changes/@visactor/vchart/feat-support-getLogger-api-of-vchart_2023-07-28-03-06.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix(vchart): fix the problem of default logLevel not sync to vgrammar", - "type": "patch" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-274-map-issue_2023-07-26-08-36.json b/common/changes/@visactor/vchart/fix-274-map-issue_2023-07-26-08-36.json deleted file mode 100644 index 41bc0bfe78..0000000000 --- a/common/changes/@visactor/vchart/fix-274-map-issue_2023-07-26-08-36.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix(map): fix the issue that some map data cannot be drawn", - "type": "patch" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-274-map-issue_2023-07-26-08-39.json b/common/changes/@visactor/vchart/fix-274-map-issue_2023-07-26-08-39.json deleted file mode 100644 index 66dd559e63..0000000000 --- a/common/changes/@visactor/vchart/fix-274-map-issue_2023-07-26-08-39.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix(map): fix the issue of misalignment of the map after interaction with legend", - "type": "patch" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-issue-251_2023-07-27-14-40.json b/common/changes/@visactor/vchart/fix-issue-251_2023-07-27-14-40.json deleted file mode 100644 index fbebf8c918..0000000000 --- a/common/changes/@visactor/vchart/fix-issue-251_2023-07-27-14-40.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix(indicator): add `specKey` for Indicator to fix the issue that the indicator text does not display after the update, close#251", - "type": "patch" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/changes/@visactor/vchart/fix-map_issue_2023-07-26-08-23.json b/common/changes/@visactor/vchart/fix-map_issue_2023-07-26-08-23.json deleted file mode 100644 index f811433297..0000000000 --- a/common/changes/@visactor/vchart/fix-map_issue_2023-07-26-08-23.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "changes": [ - { - "packageName": "@visactor/vchart", - "comment": "fix(map): fix the issue that defaultFillColor does not work in map", - "type": "patch" - } - ], - "packageName": "@visactor/vchart" -} \ No newline at end of file diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 841c241cdb..8292ffc634 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -52,7 +52,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': workspace:1.1.0 + '@visactor/vchart': workspace:1.1.1 '@visactor/vgrammar': ~0.5.1 '@visactor/vrender': ~0.13.4 '@visactor/vutils': ~0.13.3 @@ -132,7 +132,7 @@ importers: '@types/webpack-env': ^1.13.6 '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:1.1.0 + '@visactor/vchart': workspace:1.1.1 '@vitejs/plugin-react': 3.1.0 babel-preset-taro: 3.3.17 eslint: ~8.18.0 diff --git a/packages/block-vchart/block/vchart/index.js b/packages/block-vchart/block/vchart/index.js index faa925baed..f02004a875 100644 --- a/packages/block-vchart/block/vchart/index.js +++ b/packages/block-vchart/block/vchart/index.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var s={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}]`,o=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||a(t,"Boolean")},l=t=>"function"==typeof t,h=t=>null==t,c=t=>null!=t,d=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},u=t=>"object"==typeof t&&null!==t,p=function(t){if(!u(t)||!a(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},g=t=>void 0===t,f=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||a(t,"String")},m=t=>Array.isArray?Array.isArray(t):a(t,"Array"),y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},_=t=>a(t,"Date"),v=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||a(t,"Number")},b=t=>v(t)&&Number.isFinite(t),x=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),S=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),w=Object.prototype,A=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)},k=Object.prototype.hasOwnProperty;function M(t){if(h(t))return!0;if(y(t))return!t.length;const e=S(t);if("Map"===e||"Set"===e)return!t.size;if(A(t))return!Object.keys(t).length;for(const e in t)if(k.call(t,e))return!1;return!0}const C=(t,e,i)=>{const n=f(e)?e.split("."):e;for(let e=0;enull!=t&&T.call(t,e);function P(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,o){if(null===i)return null;if(0===o)return i;let l;if("object"!=typeof i)return i;if(m(i)?l=[]:a(i,"RegExp")?(l=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(l.lastIndex=i.lastIndex)):l=_(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(l)}for(const e in i)l[e]=t(i[e],o-1);return l}(t,i)}function R(t){let e;if(!c(t)||"object"!=typeof t)return t;const i=m(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:o(t)||v(t)||f(t)?t:_(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=R(n)}return e}function B(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(c(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];c(n[r])&&"object"==typeof n[r]?I(t,e,r,i):D(t,r,n[r])}}}}function I(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(m(r)){if(n)a=[];else if(m(s))a=s;else if(y(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!z(t[i],e[i]))return!1;return!0}if(!p(t))return!1;const i=F(t),n=F(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!z(t[s],e[s]))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;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function G(t,e){if(!m(t)||!m(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Y(t,e,i){c(e)||(e=t,t=0),c(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function $(t){return Number(t)}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function q(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(h(n)&&(n=t.length);i>>1;X(t[s],e)>0?n=s:i=s+1}return i}const Z=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(X)),K(i,.5)},J=Math.sqrt(50),Q=Math.sqrt(10),et=Math.sqrt(2);function it(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=J?s*=10:r>=Q?s*=5:r>=et&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:nt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function at(t,e,i,n){return t>e&&!rt(t,e,i,n)}function ot(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},ht=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?lt(n,r)+s:"center"===i?lt(n,Math.floor(r/2))+s+lt(n,Math.ceil(r/2)):s+lt(n,r)},ct=function(t,e,i){return ti?i:t},dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,p=!0;const g=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function y(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function _(){const t=Date.now();if(y(t))return v(t);o=m(_,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function v(t){return o=void 0,p&&n?f(t):(n=s=void 0,a)}function x(){const t=Date.now(),i=y(t);for(var r=arguments.length,d=new Array(r),p=0;pt*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const _t=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vt=new RegExp(_t.source,"g");const bt=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function xt(t){if(t instanceof Date)return t;if(f(t)){const e=bt.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return h(t)?new Date(NaN):new Date(Math.round(t))}const St=1e-12,wt=Math.PI,At=wt/2,kt=2*wt,Mt=2*Math.PI,Ct=Math.abs,Tt=Math.atan2,Et=Math.cos,Pt=Math.max,Rt=Math.min,Bt=Math.sin,It=Math.sqrt,Dt=Math.pow;function Lt(t){return t>1?0:t<-1?wt:Math.acos(t)}function Ot(t){return t>=1?At:t<=-1?-At:Math.asin(t)}function Ft(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function zt(t,e){return t[0]*e[1]-t[1]*e[0]}class Ht{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ht(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 v(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return v(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 jt{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Ht((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return m(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Nt(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 Wt extends Vt{}function Gt(t){return t*(Math.PI/180)}function Ut(t){return 180*t/Math.PI}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-kt;)t+=kt;else if(t>0)for(;t>kt;)t-=kt;return t},Xt=Yt;function $t(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Kt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new qt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new qt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new qt(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=Ut(r.rotateDeg),r}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return v(t)?new re(t>>16,t>>8&255,255&t,1):m(t)?new re(t[0],t[1],t[2]):new re(255,255,255)}let se=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(c(te[t]))return function(t){return v(t)?new re(t>>>24,t>>>16&255,t>>>8&255,255&t):m(t)?new re(t[0],t[1],t[2],t[3]):new re(255,255,255,1)}(te[t]);if(c(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new re((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new re(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new re(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new re(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new re(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}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}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=Zt(h(t)?s.h:ct(t,0,360),h(e)?s.s:e>=0&&e<=1?100*e:e,h(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new re(r.r,r.g,r.b,n),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}};class re{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)),c(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ae(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new re(e,c,d,l*(1-t)+h*t)}},rgbToHex:oe,rgbToHsl:Jt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ye;function _e(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}function be(t,e,i){return null===t?e:null===e?t:(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,i&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>=fe||de<=ge||ue>=ye||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ye)})}var xe;function Se(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me]),ce>fe||deye||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function ke(t){return t/180*Math.PI}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?t.angle:ke(t.angle),n=Me(t);return[Ae({x:t.x1,y:t.y1},i,n),Ae({x:t.x2,y:t.y1},i,n),Ae({x:t.x2,y:t.y2},i,n),Ae({x:t.x1,y:t.y2},i,n)]}let Te,Ee,Pe,Re;function Be(t){return Te=1/0,Ee=1/0,Pe=-1/0,Re=-1/0,t.forEach((t=>{Te>t.x&&(Te=t.x),Pet.y&&(Ee=t.y),Ree&&r>n||rs?o:0}function Fe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class He{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(),c(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=c(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(h(this._canvas)&&(c(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),h(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&c(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),h(this._context)&&c(this._canvas)){const t=this._canvas.getContext("2d");c(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!h(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(h(t))return{width:0,height:0};if(h(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 c;try{const h=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});c={width:h.width(),height:h.height()}}catch(e){this._notSupportVRender=!0,c=this.measureWithNaiveCanvas(t)}return c}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}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===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(h(this._numberCharSize)){const t=this._standardMethod(He.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/He.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return h(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(He.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(h(this._letterCharSize)){const t=this._standardMethod(He.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/He.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return c(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){c(this._canvas)&&(this._canvas=null),c(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}He.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",He.NUMBERS_CHAR_SET="0123456789",He.FULL_SIZE_CHAR="字";const je="undefined"!=typeof console;function Ne(t,e,i){const n=[e].concat([].slice.call(i));je&&console[t].apply(console,n)}var Ve;!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"}(Ve||(Ve={}));class We{static getInstance(t,e){return We._instance&&v(t)?We._instance.level(t):We._instance||(We._instance=new We(t,e)),We._instance}static setInstance(t){return We._instance=t}static setInstanceLevel(t){We._instance?We._instance.level(t):We._instance=new We(t)}static clearInstance(){We._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Ve.Info}canLogDebug(){return this._level>=Ve.Debug}canLogError(){return this._level>=Ve.Error}canLogWarn(){return this._level>=Ve.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Ve.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):Ne(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Warn&&Ne(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Info&&Ne(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Debug&&Ne(this._method||"log","DEBUG",e),this}}function Ge(t){if(b(t))return[t,t,t,t];if(m(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(d(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 Ue(t){return t?"getUTCFullYear":"getFullYear"}function Ye(t){return t?"getUTCMonth":"getMonth"}function Xe(t){return t?"getUTCDate":"getDate"}function $e(t){return t?"getUTCHours":"getHours"}function Ke(t){return t?"getUTCMinutes":"getMinutes"}function qe(t){return t?"getUTCSeconds":"getSeconds"}function Ze(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Je(t){return t?"setUTCFullYear":"setFullYear"}We._instance=null;const Qe=1e3,ti=6e4,ei=36e5,ii=24*ei,ni=31*ii,si=365*ii,ri=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),ai=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),oi=(t,e)=>e.getFullYear()-t.getFullYear(),li=t=>t.getFullYear(),hi=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),ci=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),di=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),ui=t=>t.getUTCFullYear(),pi=t=>(t.setDate(1),t.setHours(0,0,0,0),t),gi=(t,e)=>(t.setMonth(t.getMonth()+e),t),fi=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),mi=t=>t.getMonth(),yi=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),_i=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),vi=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),bi=t=>t.getUTCMonth(),xi=t=>(t.setHours(0,0,0,0),t),Si=(t,e)=>(t.setDate(t.getDate()+e),t),wi=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ii,Ai=t=>t.getDate()-1,ki=t=>(t.setUTCHours(0,0,0,0),t),Mi=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Ci=(t,e)=>(+e-+t)/ii,Ti=t=>t.getUTCDate()-1,Ei=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),Pi=(t,e)=>(t.setHours(t.getHours()+e),t),Ri=(t,e)=>(+e-+t)/ei,Bi=t=>t.getHours(),Ii=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),Di=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Li=t=>t.getUTCHours(),Oi=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),Fi=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),zi=(t,e)=>(+e-+t)/6e4,Hi=t=>t.getMinutes(),ji=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),Ni=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Vi=t=>t.getUTCMinutes(),Wi=t=>(t.setTime(+t-t.getMilliseconds()),t),Gi=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ui=(t,e)=>(+e-+t)/1e3,Yi=t=>t.getSeconds(),Xi=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),$i=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ki=t=>t.getUTCSeconds(),qi=t=>t,Zi=(t,e)=>(t.setTime(+t+e),t),Ji=(t,e)=>+e-+t,Qi=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},tn=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Qi(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Qi(h,c)}};function en(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function nn(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var sn=6371008.8,rn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*sn,kilometers:6371.0088,kilometres:6371.0088,meters:sn,metres:sn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:sn/1852,radians:1,yards:6967335.223679999};function an(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function on(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ln(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function hn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Gt(t[0]),r=Gt(t[1]),a=Gt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=rn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Ut(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Ut(l)}}const cn=t=>t;var dn,un;t.RenderModeEnum=void 0,(dn=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",dn["mobile-browser"]="mobile-browser",dn.node="node",dn.worker="worker",dn.miniApp="miniApp",dn["desktop-miniApp"]="desktop-miniApp",dn.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(un||(un={}));for(let t=0;t<256;t++)t.toString(16);const pn=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};function gn(){return new fn}function fn(){this.reset()}fn.prototype={constructor:fn,reset:function(){this.s=this.t=0},add:function(t){yn(mn,t,this.t),yn(this,mn.s,this.s),this.s?this.t+=mn.t:this.s=mn.t},valueOf:function(){return this.s}};var mn=new fn;function yn(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var _n=1e-6,vn=Math.PI,bn=vn/2,xn=vn/4,Sn=2*vn,wn=180/vn,An=vn/180,kn=Math.abs,Mn=Math.atan,Cn=Math.atan2,Tn=Math.cos,En=Math.exp,Pn=Math.log,Rn=Math.pow,Bn=Math.sin,In=Math.sign||function(t){return t>0?1:t<0?-1:0},Dn=Math.sqrt,Ln=Math.tan;function On(t){return t>1?0:t<-1?vn:Math.acos(t)}function Fn(t){return t>1?bn:t<-1?-bn:Math.asin(t)}function zn(){}function Hn(t,e){t&&Nn.hasOwnProperty(t.type)&&Nn[t.type](t,e)}var jn={Feature:function(t,e){Hn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nvn?t+Math.round(-t/Sn)*Sn:t,e]}function ts(t,e,i){return(t%=Sn)?e||i?Jn(is(t),ns(e,i)):is(t):e||i?ns(e,i):Qn}function es(t){return function(e,i){return[(e+=t)>vn?e-Sn:e<-vn?e+Sn:e,i]}}function is(t){var e=es(t);return e.invert=es(-t),e}function ns(t,e){var i=Tn(t),n=Bn(t),s=Tn(e),r=Bn(e);function a(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*i+o*n;return[Cn(l*s-c*r,o*i-h*n),Fn(c*s+l*r)]}return a.invert=function(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*s-l*r;return[Cn(l*s+h*r,o*i+c*n),Fn(c*i-o*n)]},a}function ss(t,e){(e=Yn(e))[0]-=t,Zn(e);var i=On(-e[1]);return((-e[2]<0?-i:i)+Sn-_n)%Sn}function rs(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:zn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function as(t,e){return kn(t[0]-e[0])<_n&&kn(t[1]-e[1])<_n}function os(t,e,i,n){this.x=t,this.z=e,this.o=i,this.e=n,this.v=!1,this.n=this.p=null}function ls(t,e,i,n,s){var r,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,i,n=t[0],a=t[e];if(as(n,a)){if(!n[2]&&!a[2]){for(s.lineStart(),r=0;r=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function hs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function ps(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function gs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=rs(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=y,u.lineStart=_,u.lineEnd=v,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=ps(a);var t=function(t,e){var i=ds(e),n=e[1],s=Bn(n),r=[Bn(i),-Tn(i),0],a=0,o=0;cs.reset(),1===s?n=bn+_n:-1===s&&(n=-bn-_n);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>vn,C=f*x;if(cs.add(Cn(C*A*Bn(k),m*S+C*Tn(k))),a+=M?w+A*Sn:w,M^p>=i^v>=i){var T=$n(Yn(u),Yn(_));Zn(T);var E=$n(r,T);Zn(E);var P=(M^w>=0?-1:1)*Fn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-_n||a<_n&&cs<-_n)^1&o}(r,n);a.length?(d||(s.polygonStart(),d=!0),ls(a,ms,t,i,s)):t&&(d||(s.polygonStart(),d=!0),s.lineStart(),i(null,null,1,s),s.lineEnd()),d&&(s.polygonEnd(),d=!1),a=r=null},sphere:function(){s.polygonStart(),s.lineStart(),i(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function p(e,i){t(e,i)&&s.point(e,i)}function g(t,e){l.point(t,e)}function f(){u.point=g,l.lineStart()}function m(){u.point=p,l.lineEnd()}function y(t,e){o.push([t,e]),c.point(t,e)}function _(){c.lineStart(),o=[]}function v(){y(o[0][0],o[0][1]),c.lineEnd();var t,e,i,n,l=c.clean(),u=h.result(),p=u.length;if(o.pop(),r.push(o),o=null,p)if(1&l){if((e=(i=u[0]).length-1)>0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(fs))}return u}}function fs(t){return t.length>1}function ms(t,e){return((t=t.x)[0]<0?t[1]-bn-_n:bn-t[1])-((e=e.x)[0]<0?e[1]-bn-_n:bn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return us(e(t),i)})}(us);var ys=gs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?vn:-vn,l=kn(r-i);kn(l-vn)<_n?(t.point(i,n=(n+a)/2>0?bn:-bn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=vn&&(kn(i-s)<_n&&(i-=s*_n),kn(r-o)<_n&&(r-=o*_n),n=function(t,e,i,n){var s,r,a=Bn(t-i);return kn(a)>_n?Mn((Bn(e)*(r=Tn(n))*Bn(i)-Bn(n)*(s=Tn(e))*Bn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*bn,n.point(-vn,s),n.point(0,s),n.point(vn,s),n.point(vn,0),n.point(vn,-s),n.point(0,-s),n.point(-vn,-s),n.point(-vn,0),n.point(-vn,s);else if(kn(t[0]-e[0])>_n){var r=t[0]0,s=kn(e)>_n;function r(t,i){return Tn(t)*Tn(i)>e}function a(t,i,n){var s=[1,0,0],r=$n(Yn(t),Yn(i)),a=Xn(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=$n(s,r),u=qn(s,h);Kn(u,qn(r,c));var p=d,g=Xn(u,p),f=Xn(p,p),m=g*g-f*(Xn(u,u)-1);if(!(m<0)){var y=Dn(m),_=qn(p,(-g-y)/f);if(Kn(_,u),_=Un(_),!n)return _;var v,b=t[0],x=i[0],S=t[1],w=i[1];x0^_[1]<(kn(_[0]-b)<_n?S:w):S<=_[1]&&_[1]<=w:A>vn^(b<=_[0]&&_[0]<=x)){var M=qn(p,(-g+y)/f);return Kn(M,u),[_,Un(M)]}}}function o(e,i){var s=n?t:vn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return gs(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=n?f?0:o(d,u):f?o(d+(d<0?vn:-vn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||as(e,p)||as(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(s&&e&&n^f){var y;m&i||!(y=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!f||e&&as(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Tn(e),o=Bn(e),l=n*i;null==s?(s=e+n*Sn,r=e-l/2):(s=ss(a,s),r=ss(a,r),(n>0?sr)&&(s+=n*Sn));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return kn(n[0]-t)<_n?s>0?0:3:kn(n[0]-i)<_n?s>0?2:1:kn(n[1]-e)<_n?s>0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,y,_,v=a,b=rs(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);y=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,s=(l=ps(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&ls(l,o,e,r,a),a.polygonEnd());v=a,l=h=c=null}};function S(t,e){s(t,e)&&v.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),y)d=r,u=a,p=o,y=!1,o&&(v.lineStart(),v.point(r,a));else if(o&&m)v.point(r,a);else{var l=[g=Math.max(bs,Math.min(vs,g)),f=Math.max(bs,Math.min(vs,f))],b=[r=Math.max(bs,Math.min(vs,r)),a=Math.max(bs,Math.min(vs,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(v.lineStart(),v.point(r,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),o||v.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ss(t){return t}var ws,As,ks,Ms,Cs=gn(),Ts=gn(),Es={point:zn,lineStart:zn,lineEnd:zn,polygonStart:function(){Es.lineStart=Ps,Es.lineEnd=Is},polygonEnd:function(){Es.lineStart=Es.lineEnd=Es.point=zn,Cs.add(kn(Ts)),Ts.reset()},result:function(){var t=Cs/2;return Cs.reset(),t}};function Ps(){Es.point=Rs}function Rs(t,e){Es.point=Bs,ws=ks=t,As=Ms=e}function Bs(t,e){Ts.add(Ms*t-ks*e),ks=t,Ms=e}function Is(){Bs(ws,As)}var Ds=Es,Ls=1/0,Os=Ls,Fs=-Ls,zs=Fs,Hs={point:function(t,e){tFs&&(Fs=t);ezs&&(zs=e)},lineStart:zn,lineEnd:zn,polygonStart:zn,polygonEnd:zn,result:function(){var t=[[Ls,Os],[Fs,zs]];return Fs=zs=-(Os=Ls=1/0),t}};var js,Ns,Vs,Ws,Gs=Hs,Us=0,Ys=0,Xs=0,$s=0,Ks=0,qs=0,Zs=0,Js=0,Qs=0,tr={point:er,lineStart:ir,lineEnd:rr,polygonStart:function(){tr.lineStart=ar,tr.lineEnd=or},polygonEnd:function(){tr.point=er,tr.lineStart=ir,tr.lineEnd=rr},result:function(){var t=Qs?[Zs/Qs,Js/Qs]:qs?[$s/qs,Ks/qs]:Xs?[Us/Xs,Ys/Xs]:[NaN,NaN];return Us=Ys=Xs=$s=Ks=qs=Zs=Js=Qs=0,t}};function er(t,e){Us+=t,Ys+=e,++Xs}function ir(){tr.point=nr}function nr(t,e){tr.point=sr,er(Vs=t,Ws=e)}function sr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,er(Vs=t,Ws=e)}function rr(){tr.point=er}function ar(){tr.point=lr}function or(){hr(js,Ns)}function lr(t,e){tr.point=hr,er(js=Vs=t,Ns=Ws=e)}function hr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,Zs+=(s=Ws*t-Vs*e)*(Vs+t),Js+=s*(Ws+e),Qs+=3*s,er(Vs=t,Ws=e)}var cr=tr;function dr(t){this._context=t}dr.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,Sn)}},result:zn};var ur,pr,gr,fr,mr,yr=gn(),_r={point:zn,lineStart:function(){_r.point=vr},lineEnd:function(){ur&&br(pr,gr),_r.point=zn},polygonStart:function(){ur=!0},polygonEnd:function(){ur=null},result:function(){var t=+yr;return yr.reset(),t}};function vr(t,e){_r.point=br,pr=fr=t,gr=mr=e}function br(t,e){fr-=t,mr-=e,yr.add(Dn(fr*fr+mr*mr)),fr=t,mr=e}var xr=_r;function Sr(){this._string=[]}function wr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ar(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Gn(t,i(n))),n.result()}return r.area=function(t){return Gn(t,i(Ds)),Ds.result()},r.measure=function(t){return Gn(t,i(xr)),xr.result()},r.bounds=function(t){return Gn(t,i(Gs)),Gs.result()},r.centroid=function(t){return Gn(t,i(cr)),cr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ss):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Sr):new dr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function kr(t){return function(e){var i=new Mr;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Mr(){}function Cr(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Gn(i,t.stream(Gs)),e(Gs.result()),null!=n&&t.clipExtent(n),t}function Tr(t,e,i){return Cr(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Er(t,e,i){return Tr(t,[[0,0],e],i)}function Pr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Rr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Sr.prototype={_radius:4.5,_circle:wr(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=wr(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}},Mr.prototype={constructor:Mr,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 Br=16,Ir=Tn(30*An);function Dr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,m){var y=h-n,_=c-s,v=y*y+_*_;if(v>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Dn(b*b+x*x+S*S),A=Fn(S/=w),k=kn(kn(S)-1)<_n||kn(r-d)<_n?(r+d)/2:Cn(x,b),M=t(k,A),C=M[0],T=M[1],E=C-n,P=T-s,R=_*E-y*P;(R*R/v>e||kn((y*E+_*P)/v-.5)>.3||a*u+o*p+l*g2?t[2]%360*An:0,E()):[m*wn,y*wn,_*wn]},C.angle=function(t){return arguments.length?(v=t%360*An,E()):v*wn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Dr(o,M=t*t),P()):Dn(M)},C.fitExtent=function(t,e){return Tr(C,t,e)},C.fitSize=function(t,e){return Er(C,t,e)},C.fitWidth=function(t,e){return Pr(C,t,e)},C.fitHeight=function(t,e){return Rr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function jr(t){var e=0,i=vn/3,n=Hr(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*An,i=t[1]*An):[e*wn,i*wn]},s}function Nr(t,e){var i=Bn(t),n=(i+Bn(e))/2;if(kn(n)<_n)return function(t){var e=Tn(t);function i(t,i){return[t*e,Bn(i)/e]}return i.invert=function(t,i){return[t/e,Fn(i*e)]},i}(t);var s=1+i*(2*n-i),r=Dn(s)/n;function a(t,e){var i=Dn(s-2*n*Bn(e))/n;return[i*Bn(t*=n),r-i*Tn(t)]}return a.invert=function(t,e){var i=r-e,a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,Fn((s-(t*t+i*i)*n*n)/(2*n))]},a}function Vr(){return jr(Nr).scale(155.424).center([0,33.6442])}function Wr(){return Vr().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Gr(t){return function(e,i){var n=Tn(e),s=Tn(i),r=t(n*s);return[r*s*Bn(e),r*Bn(i)]}}function Ur(t){return function(e,i){var n=Dn(e*e+i*i),s=t(n),r=Bn(s),a=Tn(s);return[Cn(e*r,n*a),Fn(n&&i*r/n)]}}var Yr=Gr((function(t){return Dn(2/(1+t))}));Yr.invert=Ur((function(t){return 2*Fn(t/2)}));var Xr=Gr((function(t){return(t=On(t))&&t/Bn(t)}));function $r(t,e){return[t,Pn(Ln((bn+e)/2))]}function Kr(){return qr($r).scale(961/Sn)}function qr(t){var e,i,n,s=zr(t),r=s.center,a=s.scale,o=s.translate,l=s.clipExtent,h=null;function c(){var r=vn*a(),o=s(function(t){function e(e){return(e=t(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e}return t=ts(t[0]*An,t[1]*An,t.length>2?t[2]*An:0),e.invert=function(e){return(e=t.invert(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e},e}(s.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),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function Zr(t){return Ln((bn+t)/2)}function Jr(t,e){var i=Tn(t),n=t===e?Bn(t):Pn(i/Tn(e))/Pn(Zr(e)/Zr(t)),s=i*Rn(Zr(t),n)/n;if(!n)return $r;function r(t,e){s>0?e<-bn+_n&&(e=-bn+_n):e>bn-_n&&(e=bn-_n);var i=s/Rn(Zr(e),n);return[i*Bn(n*t),s-i*Tn(n*t)]}return r.invert=function(t,e){var i=s-e,r=In(n)*Dn(t*t+i*i),a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,2*Mn(Rn(s/r,1/n))-bn]},r}function Qr(t,e){return[t,e]}function ta(t,e){var i=Tn(t),n=t===e?Bn(t):(i-Tn(e))/(e-t),s=i/n+t;if(kn(n)<_n)return Qr;function r(t,e){var i=s-e,r=n*t;return[i*Bn(r),s-i*Tn(r)]}return r.invert=function(t,e){var i=s-e,r=Cn(t,kn(i))*In(i);return i*n<0&&(r-=vn*In(t)*In(i)),[r/n,s-In(n)*Dn(t*t+i*i)]},r}Xr.invert=Ur((function(t){return t})),$r.invert=function(t,e){return[t,2*Mn(En(e))-bn]},Qr.invert=Qr;var ea=1.340264,ia=-.081106,na=893e-6,sa=.003796,ra=Dn(3)/2;function aa(t,e){var i=Fn(ra*Bn(e)),n=i*i,s=n*n*n;return[t*Tn(i)/(ra*(ea+3*ia*n+s*(7*na+9*sa*n))),i*(ea+ia*n+s*(na+sa*n))]}function oa(t,e){var i=Tn(e),n=Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function la(t,e){var i=e*e,n=i*i;return[t*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791)),e*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))]}function ha(t,e){return[Tn(e)*Bn(t),Bn(e)]}function ca(t,e){var i=Tn(e),n=1+Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function da(t,e){return[Pn(Ln((bn+e)/2)),-t]}aa.invert=function(t,e){for(var i,n=e,s=n*n,r=s*s*s,a=0;a<12&&(r=(s=(n-=i=(n*(ea+ia*s+r*(na+sa*s))-e)/(ea+3*ia*s+r*(7*na+9*sa*s)))*n)*s*s,!(kn(i)<1e-12));++a);return[ra*t*(ea+3*ia*s+r*(7*na+9*sa*s))/Tn(n),Fn(Bn(n)/ra)]},oa.invert=Ur(Mn),la.invert=function(t,e){var i,n=e,s=25;do{var r=n*n,a=r*r;n-=i=(n*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))-e)/(1.007226+r*(.045255+a*(.259866*r-.311325-.005916*11*a)))}while(kn(i)>_n&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ha.invert=Ur(Fn),ca.invert=Ur((function(t){return 2*Mn(t)})),da.invert=function(t,e){return[-e,2*Mn(En(t))-bn]},Kr().translate([0,0]).center([0,0]).scale(63781);var ua=Object.prototype.hasOwnProperty;function pa(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^ya[2]^ya[3])}function va(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=pa(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return _a(r[t])}function S(t,e){return ga(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=Sa(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ia(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Da(t,e)}))}:Da(t,e)}function Da(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=La(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function La(t,e){var i=Ra(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function Ha(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Ba(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=ja(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=Ya(t.slice(0,n),e),o=Ya(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Xa=Ya;!function(t){var e=Xa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=Ka(Ja,e),{tolerance:n}=i;return $a(t,n)};var to;!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"}(to||(to={}));const eo=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},io=(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.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?"+"+oo(e,6):oo(e,4))+"-"+oo(t.getUTCMonth()+1,2)+"-"+oo(t.getUTCDate(),2)+(r?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"."+oo(r,3)+"Z":s?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"Z":n||i?"T"+oo(i,2)+":"+oo(n,2)+"Z":"")}function ho(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 so;if(h)return h=!1,no;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.DSV;const i=Ka(po,e),{delimiter:n}=i;if(!f(n))throw new TypeError("Invalid delimiter: must be a string!");return ho(n).parse(t)},fo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,co(t)},mo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,uo(t)};function yo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return _o(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 _o(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return bo(t);default:throw new Error("unknown GeoJSON type")}}function _o(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=vo(t.properties),e.geometry=bo(t.geometry),e}function vo(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=vo(n):e[i]=n})),e):e}function bo(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return bo(t)})),e):(e.coordinates=xo(t.coordinates),e)}function xo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return xo(t)}))}function So(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 wo(t){for(var e,i,n=So(t),s=0,r=1;r0}function Ao(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=yo(t));var r=[];switch(t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,n)})),t;case"FeatureCollection":return Ao(t,(function(t){Ao(Co(t,n),(function(t){r.push(t)}))})),on(r)}return Co(t,n)}function Co(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,e)})),t;case"LineString":return To(So(t),e),t;case"Polygon":return Eo(So(t),e),t;case"MultiLineString":return So(t).forEach((function(t){To(t,e)})),t;case"MultiPolygon":return So(t).forEach((function(t){Eo(t,e)})),t;case"Point":case"MultiPoint":return t}}function To(t,e){wo(t)===e&&t.reverse()}function Eo(t,e){wo(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Po(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Do=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.GEO;const i=Ka(Bo,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Io(t))})):e.push(Io(t))})),e})(t);let o=t.features;return a&&(o=Mo(t,{reverse:!d(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Ro.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Ro.bounds(t);t.bbox=e}})),t.features=o,t},Lo={},Oo=(t,e,i)=>{i.type=to.GEO;const n=Ka(Bo,Lo,e),{object:s}=n;if(!f(s))throw new TypeError("Invalid object: must be a string!");const r=Ia(t,t.objects[s]);return Do(r,n,i)},Fo=(t,e,i)=>{const n=!o(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!m(t))throw new TypeError("Invalid data: must be DataView array!");return m(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 zo=0;function Ho(){return zo>1e8&&(zo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+zo++}class jo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new r,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Ho("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){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){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const No="_data-view-diff-rank";class Vo{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new r,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Ho("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",io),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=R(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[No]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[No]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[No][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);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};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};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};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};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};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};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};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};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};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};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};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};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};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};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};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=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));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Go(t,e){const i=new Set(N(t)),n=new Set(N(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Uo}=le,Yo=(t,e)=>(l($o.warnHandler)&&$o.warnHandler.call(null,t,e),e?We.getInstance().warn(`[VChart warn]: ${t}`,e):We.getInstance().warn(`[VChart warn]: ${t}`)),Xo=(t,e,i)=>{const n=new Error(t);return We.getInstance().error(`[VChart error]: ${n}`,e)},$o={silent:!1,warnHandler:!1,errorHandler:!1},Ko="undefined"!=typeof window&&void 0!==window.document,qo=Ko&&globalThis.document;function Zo(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ko}function Jo(t){return"miniApp"===t||"mobile-browser"===t}function Qo(t){return t.includes("miniApp")||"lynx"===t}let tl=0;function el(){return tl>=9999999&&(tl=0),tl++}function il(t){return!h(t)&&(!!v(t)||+t==+t)}function nl(t){return!(!t||0===t.length)&&(!h(t[0])&&!h(t[0].dataId)&&m(t[0].fields))}const sl=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const rl=t=>e=>C(e,t),al=t=>{We.getInstance().error(t)},ol=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||al("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&al("Access path missing closing bracket: "+t),a&&al("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return sl((i&&i.get||rl)(n),[s],e||s)},ll=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m(t)){const n=t.map((t=>ol(t,e,i)));return t=>n.map((e=>e(t)))}return ol(t,e,i)};ll("id");const hl=sl((function(t){return t}),[],"identity"),cl=sl((function(){return 0}),[],"zero");sl((function(){return 1}),[],"one"),sl((function(){return!0}),[],"true"),sl((function(){return!1}),[],"false"),sl((function(){return{}}),[],"emptyObject");const dl=(t,e)=>{if((te||h(e))&&!h(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},ul=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>dl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=N(e)||[],s=[],r=[],a={},o=i.comparator||ul;return N(t).forEach(((t,e)=>{if(h(t))return;s.push("desc"===n[e]?-1:1);const o=l(t)?t:ll(t,null,i);var c;r.push(o),(c=o,(h(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:sl(o(r,s),Object.keys(a))},gl=(t,e)=>{const i=l(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(h(e)||h(i))return h(e)&&h(i);if(!u(e)&&!u(i))return e===i;const s=m(e)?e:e[t],r=m(i)?i:i[t];return s===r||!1!==n&&(m(r)?!(!m(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!d(r)&&!(!d(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>fl(t,r,s)))))},ml=(t,e)=>h(t)?e:Math.min(f(t)?e*parseFloat(t)/100:t,e);function yl(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!h(s)&&(s=+s)>=s&&!h(r)&&(r=+r)>=r&&n(s,r,++a)}))}function _l(t,e,i,n,s){let r=0,a=0;return yl(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function vl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;yl(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:_l(t,e,i,s,h)}}const bl=rt;function xl(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Sl=t=>b(t)?Gt(t):null,wl=t=>b(t)?Ut(t):null;function Al(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function kl(t,e,i,n){const s=Al({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function Ml(t){return 3===t||4===t}function Cl(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)}function Tl(t,e){const i=e?+t[0][e]:+t[0];if(!b(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&n{const n=e?+i[e]:+i;return b(n)&&n>t&&(t=n),t}),i)}function Pl(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;b(s)&&(i+=s,n++)}));return i/n}function Rl(t,e){const i=Pl(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Bl(t){let e="center",i="middle";return e=(t=xl(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}}function Il(t,e){const i=Dl(t),n=Dl(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 Dl(t,e={x:0,y:0}){return jt.distancePP(t,e)}function Ll(t,e,i){let n=!1;if(e&&l(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 Ol(t){return function(e){let i;return i=m(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var Fl;function zl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:return!0;default:return!1}}function Hl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}function jl(t){switch(t){case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}!function(t){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"}(Fl||(Fl={}));class Nl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Vl=Symbol("implicit");class Wl extends Nl{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=Fl.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Vl}clone(){return(new Wl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!h(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==Vl)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Yl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),Xl=t=>t<0?-t*t:t*t,$l=t=>-Math.log(-t),Kl=t=>-Math.exp(-t),ql=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Zl=t=>10===t?ql:t===Math.E?Math.exp:e=>Math.pow(t,e),Jl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Ql=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),th=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function eh(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 ih(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function nh(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class ah extends Wl{constructor(t){super(),this.type=Fl.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Y(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&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=[$(t[0]),$(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[$(t[0]),$(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:rh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}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()}clone(){return new ah(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:oh}=le;function lh(t,e){const i=typeof e;let n;if(h(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=se.parseColorString(e)){const e=oh(se.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof re?oh(t,e):e instanceof se?oh(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class hh extends Nl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Gl,this._piecewise=ih,this._interpolate=lh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,$);return this._domain=i,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){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=ut(this._domain[0],this._domain[n-1])),this._piecewise=n>2?nh:ih,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Gl),this.rescale(i)):this._clamp!==Gl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ch=Math.sqrt(50),dh=Math.sqrt(10),uh=Math.sqrt(2);function ph(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=ch?a=10:r>=dh?a=5:r>=uh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function fh(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=gh(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class _h extends hh{constructor(){super(...arguments),this.type=Fl.Linear}clone(){return(new _h).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function vh(t){return e=>-t(-e)}class bh extends hh{constructor(){super(Jl(10),Zl(10)),this.type=Fl.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new bh).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){if(t)return this;super.rescale();const e=Jl(this._base),i=Zl(this._base);return this._domain[0]<0?(this._logs=vh(e),this._pows=vh(i),this.transformer=$l,this.untransformer=Kl):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Gl}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.lengththis._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}}class xh extends ah{constructor(t){super(!1),this.type=Fl.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class Sh extends _h{constructor(){super(),this.type=Fl.Pow,this._exponent=1}clone(){return(new Sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=Gl,this.untransformer=Gl):.5===this._exponent?(this.transformer=Yl,this.untransformer=Xl):(this.transformer=Ul(this._exponent),this.untransformer=Ul(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function wh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class Ah{constructor(){this.type=Fl.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return wh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new kh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class Mh extends _h{constructor(){super(Yl,Xl),this.type=Fl.Sqrt}clone(){return(new Mh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Ch extends _h{constructor(){super(Ql(1),th(1)),this.type=Fl.Symlog,this._const=1}clone(){return(new Ch).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=Ql(t),this.untransformer=th(t),this.rescale(e)):this._const}}class Th{constructor(){this.type=Fl.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!h(t)&&b(+t)?this._range[q(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 Th).domain(this._domain).range(this._range).unknown(this._unknown)}}const Eh=[["second",1,Qe],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,ti],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,ei],["hour",3,3*ei],["hour",6,6*ei],["hour",12,12*ei],["day",1,ii],["day",2,2*ii],["day",7,7*ii],["month",1,ni],["month",3,3*ni],["month",6,6*ni],["year",1,365*ii]];function Ph(t){return+xt(t)}function Rh(t,e,i,n){const s=(+e-+t)/i,r=q(Eh.map((t=>t[2])),s);if(r===Eh.length){const s=Math.max(it(+t/si,+e/si,i),1),r=t=>(t[Je(n)](Math.floor(t[Ue(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Je(n)](t[Ue(n)]()+e*s),t);return{floor:r,offset:a,ceil:Qi(r,a)}}if(0===r){const n=Math.max(it(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Qi(s,r)}}const[a,o]=Eh[s/Eh[r-1][2]"year"===t&&e?{floor:hi,offset:ci,count:di,field:ui}:"month"===t&&e?{floor:yi,offset:_i,count:vi,field:bi}:"day"===t&&e?{floor:ki,offset:Mi,count:Ci,field:Ti}:"hour"===t&&e?{floor:Ii,offset:Di,count:Ri,field:Li}:"minute"===t&&e?{floor:ji,offset:Ni,count:zi,field:Vi}:"second"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"year"===t?{floor:ri,offset:ai,count:oi,field:li}:"month"===t?{floor:pi,offset:gi,count:fi,field:mi}:"day"===t?{floor:xi,offset:Si,count:wi,field:Ai}:"hour"===t?{floor:Ei,offset:Pi,count:Ri,field:Bi}:"minute"===t?{floor:Oi,offset:Fi,count:zi,field:Hi}:"second"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:{floor:qi,offset:Zi,count:Ji})(a,n);return tn(o,l)}class Bh extends hh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=Fl.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(xt);const i=Array.from(t,Ph);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=xt(t),s=e[Ue(n)](),r=e[Ye(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Xe(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[$e(n)](),c=(h-1)%12+1,d=e[Ke(n)](),u=e[qe(n)](),p=e[Ze(n)]();return(i||"").replace(/YYYY/g,ht(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,ht(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,ht(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,ht(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,ht(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,ht(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,ht(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,ht(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Bh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(v(t)||h(t))&&(i=Rh(e[0],e[e.length-1],h(t)?10:t,this._isUtc)),i&&this.domain(sh(e,i)),this}utc(){return this._isUtc}}function Ih(t,e){const i=c(e)?t?.[e]??t?.default:t?.default;if(!i||m(i))return i;if(d(i)){const{dataScheme:n}=i;return n?zh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c)}))):n.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c):[]}return[]}function Dh(t,e){return zh(t)?t.find((t=>c(t.isAvailable)?l(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!c(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function Lh(t,e,i){const n=c(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!c(e.a)&&!c(e.l)||!f(s))return s;let r=new Uo(s);if(c(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Jt(t,i,n),o=Zt(s,a,e.l),l=new Uo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return c(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Oh=(t,e,i)=>{if(Fh(t)&&e){const n=Lh(e,t,i);if(n)return n}return t};function Fh(t){return d(t)&&"palette"===t.type&&!!t.key}function zh(t){return!!m(t)&&t.every((t=>c(t.scheme)))}class Hh extends Wl{_range;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(!zh(this._range))return void super.range(this._range);const t=Dh(this._range,this._domain);super.range(t)}}const jh={linear:_h,band:ah,point:xh,ordinal:Wl,threshold:Th,colorOrdinal:Hh};function Nh(t){const e=jh[t];return e?new e:null}function Vh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Wh(t){return c(t?.field)&&c(t?.scale)}var Gh;function Uh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Yh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Xh(t){return!!f(t)&&(!!t.endsWith("%")&&il(t.substring(0,t.length-1)))}function $h(t,e,i){return v(t)?t:Xh(t)?Number(t.substring(0,t.length-1))*e/100:l(t)?t(i):0}function Kh(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>v(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=$h(t[s],e.size,i)}))})),n}function qh(t){let e={};return m(t)?(h(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),h(t[1])||(e.left=e.right=t[1]),h(t[2])||(e.bottom=t[2]),h(t[3])||(e.left=t[3]),e):v(t)||Xh(t)||l(t)?(e.top=e.left=e.bottom=e.right=t,e):(d(t)&&(e={...t}),e)}function Zh(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function Jh(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]=Jh(t[n],e)}return i}return m(t)?t.map((t=>Jh(t,e))):t}function Qh(t){const e=t;let i;if(!c(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof Vo||e.every((t=>i.includes(t)))}(e))return e;const n=m(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:o(e)||v(e)||f(e)?e:_(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=Qh(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(Gh||(Gh={}));var tc=function(t){return t&&t.Math==Math&&t},ec=tc("object"==typeof globalThis&&globalThis)||tc("object"==typeof window&&window)||tc("object"==typeof self&&self)||tc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),ic={},nc=function(t){try{return!!t()}catch(t){return!0}},sc=!nc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),rc=!nc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),ac=rc,oc=Function.prototype.call,lc=ac?oc.bind(oc):function(){return oc.apply(oc,arguments)},hc={},cc={}.propertyIsEnumerable,dc=Object.getOwnPropertyDescriptor,uc=dc&&!cc.call({1:2},1);hc.f=uc?function(t){var e=dc(this,t);return!!e&&e.enumerable}:cc;var pc,gc,fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},mc=rc,yc=Function.prototype,_c=yc.call,vc=mc&&yc.bind.bind(_c,_c),bc=mc?vc:function(t){return function(){return _c.apply(t,arguments)}},xc=bc,Sc=xc({}.toString),wc=xc("".slice),Ac=function(t){return wc(Sc(t),8,-1)},kc=nc,Mc=Ac,Cc=Object,Tc=bc("".split),Ec=kc((function(){return!Cc("z").propertyIsEnumerable(0)}))?function(t){return"String"==Mc(t)?Tc(t,""):Cc(t)}:Cc,Pc=function(t){return null==t},Rc=Pc,Bc=TypeError,Ic=function(t){if(Rc(t))throw Bc("Can't call method on "+t);return t},Dc=Ec,Lc=Ic,Oc=function(t){return Dc(Lc(t))},Fc="object"==typeof document&&document.all,zc={all:Fc,IS_HTMLDDA:void 0===Fc&&void 0!==Fc},Hc=zc.all,jc=zc.IS_HTMLDDA?function(t){return"function"==typeof t||t===Hc}:function(t){return"function"==typeof t},Nc=jc,Vc=zc.all,Wc=zc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Nc(t)||t===Vc}:function(t){return"object"==typeof t?null!==t:Nc(t)},Gc=ec,Uc=jc,Yc=function(t,e){return arguments.length<2?(i=Gc[t],Uc(i)?i:void 0):Gc[t]&&Gc[t][e];var i},Xc=bc({}.isPrototypeOf),$c=ec,Kc="undefined"!=typeof navigator&&String(navigator.userAgent)||"",qc=$c.process,Zc=$c.Deno,Jc=qc&&qc.versions||Zc&&Zc.version,Qc=Jc&&Jc.v8;Qc&&(gc=(pc=Qc.split("."))[0]>0&&pc[0]<4?1:+(pc[0]+pc[1])),!gc&&Kc&&(!(pc=Kc.match(/Edge\/(\d+)/))||pc[1]>=74)&&(pc=Kc.match(/Chrome\/(\d+)/))&&(gc=+pc[1]);var td=gc,ed=nc,id=ec.String,nd=!!Object.getOwnPropertySymbols&&!ed((function(){var t=Symbol();return!id(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&td&&td<41})),sd=nd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rd=Yc,ad=jc,od=Xc,ld=Object,hd=sd?function(t){return"symbol"==typeof t}:function(t){var e=rd("Symbol");return ad(e)&&od(e.prototype,ld(t))},cd=String,dd=function(t){try{return cd(t)}catch(t){return"Object"}},ud=jc,pd=dd,gd=TypeError,fd=function(t){if(ud(t))return t;throw gd(pd(t)+" is not a function")},md=fd,yd=Pc,_d=function(t,e){var i=t[e];return yd(i)?void 0:md(i)},vd=lc,bd=jc,xd=Wc,Sd=TypeError,wd={exports:{}},Ad=ec,kd=Object.defineProperty,Md=function(t,e){try{kd(Ad,t,{value:e,configurable:!0,writable:!0})}catch(i){Ad[t]=e}return e},Cd=Md,Td="__core-js_shared__",Ed=ec[Td]||Cd(Td,{}),Pd=Ed;(wd.exports=function(t,e){return Pd[t]||(Pd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Rd=wd.exports,Bd=Ic,Id=Object,Dd=function(t){return Id(Bd(t))},Ld=Dd,Od=bc({}.hasOwnProperty),Fd=Object.hasOwn||function(t,e){return Od(Ld(t),e)},zd=bc,Hd=0,jd=Math.random(),Nd=zd(1..toString),Vd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Nd(++Hd+jd,36)},Wd=Rd,Gd=Fd,Ud=Vd,Yd=nd,Xd=sd,$d=ec.Symbol,Kd=Wd("wks"),qd=Xd?$d.for||$d:$d&&$d.withoutSetter||Ud,Zd=function(t){return Gd(Kd,t)||(Kd[t]=Yd&&Gd($d,t)?$d[t]:qd("Symbol."+t)),Kd[t]},Jd=lc,Qd=Wc,tu=hd,eu=_d,iu=function(t,e){var i,n;if("string"===e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;if(bd(i=t.valueOf)&&!xd(n=vd(i,t)))return n;if("string"!==e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;throw Sd("Can't convert object to primitive value")},nu=TypeError,su=Zd("toPrimitive"),ru=function(t,e){if(!Qd(t)||tu(t))return t;var i,n=eu(t,su);if(n){if(void 0===e&&(e="default"),i=Jd(n,t,e),!Qd(i)||tu(i))return i;throw nu("Can't convert object to primitive value")}return void 0===e&&(e="number"),iu(t,e)},au=hd,ou=function(t){var e=ru(t,"string");return au(e)?e:e+""},lu=Wc,hu=ec.document,cu=lu(hu)&&lu(hu.createElement),du=function(t){return cu?hu.createElement(t):{}},uu=du,pu=!sc&&!nc((function(){return 7!=Object.defineProperty(uu("div"),"a",{get:function(){return 7}}).a})),gu=sc,fu=lc,mu=hc,yu=fc,_u=Oc,vu=ou,bu=Fd,xu=pu,Su=Object.getOwnPropertyDescriptor;ic.f=gu?Su:function(t,e){if(t=_u(t),e=vu(e),xu)try{return Su(t,e)}catch(t){}if(bu(t,e))return yu(!fu(mu.f,t,e),t[e])};var wu={},Au=sc&&nc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ku=Wc,Mu=String,Cu=TypeError,Tu=function(t){if(ku(t))return t;throw Cu(Mu(t)+" is not an object")},Eu=sc,Pu=pu,Ru=Au,Bu=Tu,Iu=ou,Du=TypeError,Lu=Object.defineProperty,Ou=Object.getOwnPropertyDescriptor,Fu="enumerable",zu="configurable",Hu="writable";wu.f=Eu?Ru?function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Hu in i&&!i[Hu]){var n=Ou(t,e);n&&n[Hu]&&(t[e]=i.value,i={configurable:zu in i?i[zu]:n[zu],enumerable:Fu in i?i[Fu]:n[Fu],writable:!1})}return Lu(t,e,i)}:Lu:function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),Pu)try{return Lu(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Du("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var ju=wu,Nu=fc,Vu=sc?function(t,e,i){return ju.f(t,e,Nu(1,i))}:function(t,e,i){return t[e]=i,t},Wu={exports:{}},Gu=sc,Uu=Fd,Yu=Function.prototype,Xu=Gu&&Object.getOwnPropertyDescriptor,$u=Uu(Yu,"name"),Ku={EXISTS:$u,PROPER:$u&&"something"===function(){}.name,CONFIGURABLE:$u&&(!Gu||Gu&&Xu(Yu,"name").configurable)},qu=jc,Zu=Ed,Ju=bc(Function.toString);qu(Zu.inspectSource)||(Zu.inspectSource=function(t){return Ju(t)});var Qu,tp,ep,ip=Zu.inspectSource,np=jc,sp=ec.WeakMap,rp=np(sp)&&/native code/.test(String(sp)),ap=Vd,op=Rd("keys"),lp=function(t){return op[t]||(op[t]=ap(t))},hp={},cp=rp,dp=ec,up=Wc,pp=Vu,gp=Fd,fp=Ed,mp=lp,yp=hp,_p="Object already initialized",vp=dp.TypeError,bp=dp.WeakMap;if(cp||fp.state){var xp=fp.state||(fp.state=new bp);xp.get=xp.get,xp.has=xp.has,xp.set=xp.set,Qu=function(t,e){if(xp.has(t))throw vp(_p);return e.facade=t,xp.set(t,e),e},tp=function(t){return xp.get(t)||{}},ep=function(t){return xp.has(t)}}else{var Sp=mp("state");yp[Sp]=!0,Qu=function(t,e){if(gp(t,Sp))throw vp(_p);return e.facade=t,pp(t,Sp,e),e},tp=function(t){return gp(t,Sp)?t[Sp]:{}},ep=function(t){return gp(t,Sp)}}var wp={set:Qu,get:tp,has:ep,enforce:function(t){return ep(t)?tp(t):Qu(t,{})},getterFor:function(t){return function(e){var i;if(!up(e)||(i=tp(e)).type!==t)throw vp("Incompatible receiver, "+t+" required");return i}}},Ap=bc,kp=nc,Mp=jc,Cp=Fd,Tp=sc,Ep=Ku.CONFIGURABLE,Pp=ip,Rp=wp.enforce,Bp=wp.get,Ip=String,Dp=Object.defineProperty,Lp=Ap("".slice),Op=Ap("".replace),Fp=Ap([].join),zp=Tp&&!kp((function(){return 8!==Dp((function(){}),"length",{value:8}).length})),Hp=String(String).split("String"),jp=Wu.exports=function(t,e,i){"Symbol("===Lp(Ip(e),0,7)&&(e="["+Op(Ip(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Cp(t,"name")||Ep&&t.name!==e)&&(Tp?Dp(t,"name",{value:e,configurable:!0}):t.name=e),zp&&i&&Cp(i,"arity")&&t.length!==i.arity&&Dp(t,"length",{value:i.arity});try{i&&Cp(i,"constructor")&&i.constructor?Tp&&Dp(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Rp(t);return Cp(n,"source")||(n.source=Fp(Hp,"string"==typeof e?e:"")),t};Function.prototype.toString=jp((function(){return Mp(this)&&Bp(this).source||Pp(this)}),"toString");var Np=Wu.exports,Vp=jc,Wp=wu,Gp=Np,Up=Md,Yp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Vp(i)&&Gp(i,r,n),n.global)s?t[e]=i:Up(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Wp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Xp={},$p=Math.ceil,Kp=Math.floor,qp=Math.trunc||function(t){var e=+t;return(e>0?Kp:$p)(e)},Zp=function(t){var e=+t;return e!=e||0===e?0:qp(e)},Jp=Zp,Qp=Math.max,tg=Math.min,eg=function(t,e){var i=Jp(t);return i<0?Qp(i+e,0):tg(i,e)},ig=Zp,ng=Math.min,sg=function(t){return t>0?ng(ig(t),9007199254740991):0},rg=function(t){return sg(t.length)},ag=Oc,og=eg,lg=rg,hg=function(t){return function(e,i,n){var s,r=ag(e),a=lg(r),o=og(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},cg={includes:hg(!0),indexOf:hg(!1)},dg=Fd,ug=Oc,pg=cg.indexOf,gg=hp,fg=bc([].push),mg=function(t,e){var i,n=ug(t),s=0,r=[];for(i in n)!dg(gg,i)&&dg(n,i)&&fg(r,i);for(;e.length>s;)dg(n,i=e[s++])&&(~pg(r,i)||fg(r,i));return r},yg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_g=mg,vg=yg.concat("length","prototype");Xp.f=Object.getOwnPropertyNames||function(t){return _g(t,vg)};var bg={};bg.f=Object.getOwnPropertySymbols;var xg=Yc,Sg=Xp,wg=bg,Ag=Tu,kg=bc([].concat),Mg=xg("Reflect","ownKeys")||function(t){var e=Sg.f(Ag(t)),i=wg.f;return i?kg(e,i(t)):e},Cg=Fd,Tg=Mg,Eg=ic,Pg=wu,Rg=nc,Bg=jc,Ig=/#|\.prototype\./,Dg=function(t,e){var i=Og[Lg(t)];return i==zg||i!=Fg&&(Bg(e)?Rg(e):!!e)},Lg=Dg.normalize=function(t){return String(t).replace(Ig,".").toLowerCase()},Og=Dg.data={},Fg=Dg.NATIVE="N",zg=Dg.POLYFILL="P",Hg=Dg,jg=ec,Ng=ic.f,Vg=Vu,Wg=Yp,Gg=Md,Ug=function(t,e,i){for(var n=Tg(e),s=Pg.f,r=Eg.f,a=0;ar;r++)if((o=y(t[r]))&&bm(Mm,o))return o;return new km(!1)}n=xm(t,s)}for(l=u?t.next:n.next;!(h=fm(l,n)).done;){try{o=y(h.value)}catch(t){wm(n,"throw",t)}if("object"==typeof o&&o&&bm(Mm,o))return o}return new km(!1)},Tm=Xc,Em=TypeError,Pm=function(t,e){if(Tm(e,t))return t;throw Em("Incorrect invocation")},Rm=Zd("iterator"),Bm=!1;try{var Im=0,Dm={next:function(){return{done:!!Im++}},return:function(){Bm=!0}};Dm[Rm]=function(){return this},Array.from(Dm,(function(){throw 2}))}catch(al){}var Lm=wu.f,Om=Fd,Fm=Zd("toStringTag"),zm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Om(t,Fm)&&Lm(t,Fm,{configurable:!0,value:e})},Hm=bc,jm=fd,Nm=jc,Vm=String,Wm=TypeError,Gm=function(t,e,i){try{return Hm(jm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Um=Tu,Ym=function(t){if("object"==typeof t||Nm(t))return t;throw Wm("Can't set "+Vm(t)+" as a prototype")},Xm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Gm(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Um(i),Ym(n),e?t(i,n):i.__proto__=n,i}}():void 0),$m=jc,Km=Wc,qm=Xm,Zm=Xg,Jm=ec,Qm=bc,ty=Hg,ey=Yp,iy=If,ny=Cm,sy=Pm,ry=jc,ay=Pc,oy=Wc,ly=nc,hy=function(t,e){if(!e&&!Bm)return!1;var i=!1;try{var n={};n[Rm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},cy=zm,dy=function(t,e,i){var n,s;return qm&&$m(n=e.constructor)&&n!==i&&Km(s=n.prototype)&&s!==i.prototype&&qm(t,s),t},uy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=Jm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=Qm(o[t]);ey(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!oy(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ty(t,!ry(a)||!(s||o.forEach&&!ly((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),iy.enable();else if(ty(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=ly((function(){d.has(1)})),g=hy((function(t){new a(t)})),f=!s&&ly((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){sy(t,o);var i=dy(new a,t,l);return ay(e)||ny(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,Zm({global:!0,constructor:!0,forced:l!=a},h),cy(l,t),s||i.setStrong(l,t,n),l},py={},gy=mg,fy=yg,my=Object.keys||function(t){return gy(t,fy)},yy=sc,_y=Au,vy=wu,by=Tu,xy=Oc,Sy=my;py.f=yy&&!_y?Object.defineProperties:function(t,e){by(t);for(var i,n=xy(e),s=Sy(e),r=s.length,a=0;r>a;)vy.f(t,i=s[a++],n[i]);return t};var wy,Ay=Yc("document","documentElement"),ky=Tu,My=py,Cy=yg,Ty=hp,Ey=Ay,Py=du,Ry="prototype",By="script",Iy=lp("IE_PROTO"),Dy=function(){},Ly=function(t){return"<"+By+">"+t+""},Oy=function(t){t.write(Ly("")),t.close();var e=t.parentWindow.Object;return t=null,e},Fy=function(){try{wy=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Fy="undefined"!=typeof document?document.domain&&wy?Oy(wy):(e=Py("iframe"),i="java"+By+":",e.style.display="none",Ey.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Ly("document.F=Object")),t.close(),t.F):Oy(wy);for(var n=Cy.length;n--;)delete Fy[Ry][Cy[n]];return Fy()};Ty[Iy]=!0;var zy,Hy,jy,Ny=Object.create||function(t,e){var i;return null!==t?(Dy[Ry]=ky(t),i=new Dy,Dy[Ry]=null,i[Iy]=t):i=Fy(),void 0===e?i:My.f(i,e)},Vy=Np,Wy=wu,Gy=function(t,e,i){return i.get&&Vy(i.get,e,{getter:!0}),i.set&&Vy(i.set,e,{setter:!0}),Wy.f(t,e,i)},Uy=Yp,Yy=function(t,e,i){for(var n in e)Uy(t,n,e[n],i);return t},Xy=!nc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),$y=Fd,Ky=jc,qy=Dd,Zy=Xy,Jy=lp("IE_PROTO"),Qy=Object,t_=Qy.prototype,e_=Zy?Qy.getPrototypeOf:function(t){var e=qy(t);if($y(e,Jy))return e[Jy];var i=e.constructor;return Ky(i)&&e instanceof i?i.prototype:e instanceof Qy?t_:null},i_=nc,n_=jc,s_=Wc,r_=e_,a_=Yp,o_=Zd("iterator"),l_=!1;[].keys&&("next"in(jy=[].keys())?(Hy=r_(r_(jy)))!==Object.prototype&&(zy=Hy):l_=!0);var h_=!s_(zy)||i_((function(){var t={};return zy[o_].call(t)!==t}));h_&&(zy={}),n_(zy[o_])||a_(zy,o_,(function(){return this}));var c_={IteratorPrototype:zy,BUGGY_SAFARI_ITERATORS:l_},d_=c_.IteratorPrototype,u_=Ny,p_=fc,g_=zm,f_=Nf,m_=function(){return this},y_=Xg,__=lc,v_=jc,b_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=u_(d_,{next:p_(+!n,i)}),g_(t,s,!1),f_[s]=m_,t},x_=e_,S_=Xm,w_=zm,A_=Vu,k_=Yp,M_=Nf,C_=Ku.PROPER,T_=Ku.CONFIGURABLE,E_=c_.IteratorPrototype,P_=c_.BUGGY_SAFARI_ITERATORS,R_=Zd("iterator"),B_="keys",I_="values",D_="entries",L_=function(){return this},O_=Yc,F_=Gy,z_=sc,H_=Zd("species"),j_=Ny,N_=Gy,V_=Yy,W_=jf,G_=Pm,U_=Pc,Y_=Cm,X_=function(t,e,i,n,s,r,a){b_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!P_&&t in p)return p[t];switch(t){case B_:case I_:case D_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[R_]||p["@@iterator"]||s&&p[s],f=!P_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=x_(m.call(new t)))!==Object.prototype&&o.next&&(x_(o)!==E_&&(S_?S_(o,E_):v_(o[R_])||k_(o,R_,L_)),w_(o,d,!0)),C_&&s==I_&&g&&g.name!==I_&&(T_?A_(p,"name",I_):(u=!0,f=function(){return __(g,this)})),s)if(l={values:c(I_),keys:r?f:c(B_),entries:c(D_)},a)for(h in l)(P_||u||!(h in p))&&k_(p,h,l[h]);else y_({target:e,proto:!0,forced:P_||u},l);return p[R_]!==f&&k_(p,R_,f,{name:s}),M_[e]=f,l},$_=function(t,e){return{value:t,done:e}},K_=function(t){var e=O_(t);z_&&e&&!e[H_]&&F_(e,H_,{configurable:!0,get:function(){return this}})},q_=sc,Z_=If.fastKey,J_=wp.set,Q_=wp.getterFor,tv={getConstructor:function(t,e,i,n){var s=t((function(t,s){G_(t,r),J_(t,{type:e,index:j_(null),first:void 0,last:void 0,size:0}),q_||(t.size=0),U_(s)||Y_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Q_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=Z_(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),q_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=Z_(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return V_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,q_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),q_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=W_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),V_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),q_&&N_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=Q_(e),r=Q_(n);X_(t,e,(function(t,e){J_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?$_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,$_(void 0,!0))}),i?"entries":"values",!i,!0),K_(e)}};uy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),tv);var ev=Ac,iv=Array.isArray||function(t){return"Array"==ev(t)},nv=bc,sv=nc,rv=jc,av=Jf,ov=ip,lv=function(){},hv=[],cv=Yc("Reflect","construct"),dv=/^\s*(?:class|function)\b/,uv=nv(dv.exec),pv=!dv.exec(lv),gv=function(t){if(!rv(t))return!1;try{return cv(lv,hv,t),!0}catch(t){return!1}},fv=function(t){if(!rv(t))return!1;switch(av(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pv||!!uv(dv,ov(t))}catch(t){return!0}};fv.sham=!0;var mv=!cv||sv((function(){var t;return gv(gv.call)||!gv(Object)||!gv((function(){t=!0}))||t}))?fv:gv,yv=iv,_v=mv,vv=Wc,bv=Zd("species"),xv=Array,Sv=function(t){var e;return yv(t)&&(e=t.constructor,(_v(e)&&(e===xv||yv(e.prototype))||vv(e)&&null===(e=e[bv]))&&(e=void 0)),void 0===e?xv:e},wv=jf,Av=Ec,kv=Dd,Mv=rg,Cv=function(t,e){return new(Sv(t))(0===e?0:e)},Tv=bc([].push),Ev=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=kv(l),f=Av(g),m=wv(h,c),y=Mv(f),_=0,v=d||Cv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Tv(b,u)}else switch(t){case 4:return!1;case 7:Tv(b,u)}return r?-1:n||s?s:b}},Pv={forEach:Ev(0),map:Ev(1),filter:Ev(2),some:Ev(3),every:Ev(4),find:Ev(5),findIndex:Ev(6),filterReject:Ev(7)},Rv=bc,Bv=Yy,Iv=If.getWeakData,Dv=Pm,Lv=Tu,Ov=Pc,Fv=Wc,zv=Cm,Hv=Fd,jv=wp.set,Nv=wp.getterFor,Vv=Pv.find,Wv=Pv.findIndex,Gv=Rv([].splice),Uv=0,Yv=function(t){return t.frozen||(t.frozen=new Xv)},Xv=function(){this.entries=[]},$v=function(t,e){return Vv(t.entries,(function(t){return t[0]===e}))};Xv.prototype={get:function(t){var e=$v(this,t);if(e)return e[1]},has:function(t){return!!$v(this,t)},set:function(t,e){var i=$v(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Wv(this.entries,(function(e){return e[0]===t}));return~e&&Gv(this.entries,e,1),!!~e}};var Kv,qv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Dv(t,r),jv(t,{type:e,id:Uv++,frozen:void 0}),Ov(s)||zv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Nv(e),o=function(t,e,i){var n=a(t),s=Iv(Lv(e),!0);return!0===s?Yv(n).set(e,i):s[n.id]=i,t};return Bv(r,{delete:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).delete(t):i&&Hv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).has(t):i&&Hv(i,e.id)}}),Bv(r,i?{get:function(t){var e=a(this);if(Fv(t)){var i=Iv(t);return!0===i?Yv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},Zv=yf,Jv=ec,Qv=bc,tb=Yy,eb=If,ib=uy,nb=qv,sb=Wc,rb=wp.enforce,ab=nc,ob=rp,lb=Object,hb=Array.isArray,cb=lb.isExtensible,db=lb.isFrozen,ub=lb.isSealed,pb=lb.freeze,gb=lb.seal,fb={},mb={},yb=!Jv.ActiveXObject&&"ActiveXObject"in Jv,_b=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},vb=ib("WeakMap",_b,nb),bb=vb.prototype,xb=Qv(bb.set);if(ob)if(yb){Kv=nb.getConstructor(_b,"WeakMap",!0),eb.enable();var Sb=Qv(bb.delete),wb=Qv(bb.has),Ab=Qv(bb.get);tb(bb,{delete:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),Sb(this,t)||e.frozen.delete(t)}return Sb(this,t)},has:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)||e.frozen.has(t)}return wb(this,t)},get:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)?Ab(this,t):e.frozen.get(t)}return Ab(this,t)},set:function(t,e){if(sb(t)&&!cb(t)){var i=rb(this);i.frozen||(i.frozen=new Kv),wb(this,t)?xb(this,t,e):i.frozen.set(t,e)}else xb(this,t,e);return this}})}else Zv&&ab((function(){var t=pb([]);return xb(new vb,t,1),!db(t)}))&&tb(bb,{set:function(t,e){var i;return hb(t)&&(db(t)?i=fb:ub(t)&&(i=mb)),xb(this,t,e),i==fb&&pb(t),i==mb&&gb(t),this}});var kb=Yc,Mb=bc,Cb=Rd,Tb=kb("Map"),Eb=kb("WeakMap"),Pb=Mb([].push),Rb=Cb("metadata"),Bb=Rb.store||(Rb.store=new Eb),Ib=function(t,e,i){var n=Bb.get(t);if(!n){if(!i)return;Bb.set(t,n=new Tb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Tb)}return s},Db={store:Bb,getMap:Ib,has:function(t,e,i){var n=Ib(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Ib(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Ib(i,n,!0).set(t,e)},keys:function(t,e){var i=Ib(t,e,!1),n=[];return i&&i.forEach((function(t,e){Pb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Lb=Tu,Ob=Db.toKey,Fb=Db.set;Xg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Ob(arguments[3]);Fb(t,e,Lb(i),n)}});var zb=Tu,Hb=Db.toKey,jb=Db.getMap,Nb=Db.store;Xg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Hb(arguments[2]),n=jb(zb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=Nb.get(e);return s.delete(i),!!s.size||Nb.delete(e)}});var Vb=Tu,Wb=e_,Gb=Db.has,Ub=Db.get,Yb=Db.toKey,Xb=function(t,e,i){if(Gb(t,e,i))return Ub(t,e,i);var n=Wb(e);return null!==n?Xb(t,n,i):void 0};Xg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Yb(arguments[2]);return Xb(t,Vb(e),i)}});var $b=bc,Kb=Map.prototype,qb={Map:Map,set:$b(Kb.set),get:$b(Kb.get),has:$b(Kb.has),remove:$b(Kb.delete),proto:Kb},Zb=lc,Jb=bc,Qb=function(t,e,i){for(var n,s,r=i||t.next;!(n=Zb(r,t)).done;)if(void 0!==(s=e(n.value)))return s},tx=qb.Map,ex=qb.proto,ix=Jb(ex.forEach),nx=Jb(ex.entries),sx=nx(new tx).next,rx=fd,ax=Pc,ox=rg,lx=Dd,hx=function(t,e,i){return i?Qb(nx(t),(function(t){return e(t[1],t[0])}),sx):ix(t,e)},cx=qb.Map,dx=qb.has,ux=qb.set,px=bc([].push),gx=Xg,fx=bc,mx=Db,yx=Tu,_x=e_,vx=function(t){var e,i,n,s=lx(this),r=ox(s),a=[],o=new cx,l=ax(t)?function(t){return t}:rx(t);for(e=0;e= than the number of constructor arguments of its base class."},yS=function(t,e){return"@postConstruct error in class "+t+": "+e},_S=function(t,e){return"@preDestroy error in class "+t+": "+e},vS=function(t,e){return"onDeactivation() error in class "+t+": "+e},bS="Maximum call stack size exceeded",xS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(Zx,t),userGeneratedMetadata:Reflect.getMetadata(Kx,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(qx,t)||[]},t}(),SS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function wS(t){return t instanceof RangeError||t.message===bS}function AS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function kS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=TS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function MS(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||MS(t.parentRequest,e))}function CS(t){t.childRequests.forEach((function(t){if(MS(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=AS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(gS+" "+e)}CS(t)}))}function TS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ES=function(){function t(t){this.id=rS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),PS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Wx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),RS=function(t,e){this.parentContext=t,this.rootRequest=e},BS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),IS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),DS=function(){function t(t,e,i,n){this.id=rS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new IS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new PS(Wx,n):n instanceof PS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:jS(t,i)}return 0}function NS(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Xx],multiInject:e[$x],targetName:e[Gx],unmanaged:e[Ux]}}var VS=function(){function t(t,e,i,n,s){this.id=rS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function WS(t){return t._bindingDictionary}function GS(t,e,i,n,s){var r=YS(i.container,s.serviceIdentifier),a=[];return r.length===SS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=YS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new VS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case SS.NoBindingsAvailable:if(i.isOptional())return e;var s=AS(t),r=dS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=kS(n,s,YS),new Error(r);case SS.OnlyOneBindingAvailable:return e;case SS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=AS(t),r=cS+" "+s;throw r+=kS(n,s,YS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function US(t,e,i,n,s,r){var a,o;if(null===s){a=GS(t,e,n,null,r),o=new VS(i,n,null,a,r);var l=new RS(n,o);n.addPlan(l)}else a=GS(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===iS.Instance&&null!==e.implementationType){var s=function(t,e){return OS(t,TS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=jS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===nS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=KS(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=iw(iw({},s),{constr:t});n=s.isAsync?function(t){return nw(this,void 0,void 0,(function(){var e,i;return sw(this,(function(n){switch(n.label){case 0:return[4,lw(t.constructorInjections)];case 1:return e=n.sent(),[4,lw(t.propertyInjections)];case 2:return i=n.sent(),[2,ow(iw(iw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):ow(r)}else n=new t;return n}function ow(t){var e,i=new((e=t.constr).bind.apply(e,rw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function lw(t){return nw(this,void 0,void 0,(function(){var e,i,n,s;return sw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Ow=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Lw,onDeactivations:new Lw}},t}(),Fw=function(){return Fw=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new iA(e,i)})).inSingletonScope().whenTargetNamed(e)}class sA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class rA extends sA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const aA=Symbol.for("EnvContribution"),oA=Symbol.for("Global");var lA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,n){e(i,n,t)}};let dA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new rA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};dA=lA([Xw(),cA(0,qw(eA)),cA(0,$w(aA)),hA("design:paramtypes",[Object])],dA);const uA=kt-1e-8;class pA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>uA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=kt)<0&&(n+=kt),(s%=kt)<0&&(s+=kt),ss;++o,a-=At)g(a);else for(a=n-n%At+At,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const fA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,mA={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},yA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let _A,vA,bA,xA,SA,wA;var AA,kA,MA,CA,TA,EA,PA,RA,BA;function IA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function DA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Gt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=kt:T>0&&0===r&&(T-=kt);const E=Math.ceil(Math.abs(T/(At+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*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 FA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class XA extends YA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function $A(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class KA{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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function qA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new KA(s,n),t),s}function ZA(t,e,i,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,n)}class JA{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&&ZA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(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):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:ZA(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}tryUpdateLength(){return this.context.tryUpdateLength()}}function QA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("basis",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new JA(s,n),t),s}function tk(t){return t<0?-1:1}function ek(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(tk(r)+tk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function ik(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function nk(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class sk{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._lastDefined2);break;case 3:nk(this,this._t0,ik(this,this._t0),!1!==this._lastDefined2)}(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;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,nk(this,ik(this,e=ek(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:nk(this,this._t0,e=ek(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}}tryUpdateLength(){return this.context.tryUpdateLength()}}class rk extends sk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ak(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("monotoneX",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new sk(s,n),t),s}function ok(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new XA("monotoneY",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new rk(s,n),t),s}let lk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function hk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new YA("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new lk(r,e,s),t),r}class ck{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.context.closePath()}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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function dk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new ck(s,n),t),s}function uk(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}class pk extends gA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new pA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([yA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([yA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([yA.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([yA.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([yA.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([yA.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([yA.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([yA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([yA.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}toString(){if(!this.toStringCbList){const t=[];t[yA.M]=t=>`M${t[1]} ${t[2]}`,t[yA.L]=t=>`L${t[1]} ${t[2]}`,t[yA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[yA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[yA.A]=t=>{const e=[];LA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;twA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),FA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===PA.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===PA.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)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const gk=["l",0,0,0,0,0,0,0];function fk(t,e,i){const n=gk[0]=t[0];if("a"===n||"A"===n)gk[1]=e*t[1],gk[2]=i*t[2],gk[3]=t[3],gk[4]=t[4],gk[5]=t[5],gk[6]=e*t[6],gk[7]=i*t[7];else if("h"===n||"H"===n)gk[1]=e*t[1];else if("v"===n||"V"===n)gk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Pk=Object.assign(Object.assign({},Sk),{points:[],cornerRadius:0}),Rk=Object.assign(Object.assign({},Sk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Bk=Object.assign(Object.assign({},Sk),{width:0,height:0,cornerRadius:0,length:0}),Ik=Object.assign(Object.assign({},Sk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Dk=Object.assign(Object.assign(Object.assign({},Sk),bk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Lk=Object.assign(Object.assign({},Sk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ok=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Sk),{fill:!0}),Fk=Object.assign(Object.assign({},Ok),{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});var zk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Hk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Dk.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(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._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};Hk=zk([Xw()],Hk);var jk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Nk=Symbol.for("TextMeasureContribution");let Vk=class extends Hk{};Vk=jk([Xw()],Vk);const Wk=new Nw;const Gk=new class{},Uk=Symbol.for("CanvasFactory"),Yk=Symbol.for("Context2dFactory");function Xk(t){return Wk.getNamed(Uk,Gk.global.env)(t)}const $k=1e-4,Kk=Math.sqrt(3),qk=1/3;function Zk(t){return t>-dM&&tdM||t<-dM}const Qk=[0,0],tM=[0,0],eM=[0,0];function iM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function nM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function sM(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 rM(t){return(t%=Mt)<0&&(t+=Mt),t}function aM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function oM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Mt);let d=Math.atan2(l,o);return d<0&&(d+=Mt),d>=n&&d<=s||d+Mt>=n&&d+Mt<=s}function cM(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(Zk(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 pM=[-1,-1,-1],gM=[-1,-1];function fM(){const t=gM[0];gM[0]=gM[1],gM[1]=t}function mM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Zk(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,qk):Math.pow(i,qk),n=n<0?-Math.pow(-n,qk):Math.pow(n,qk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Kk*Math.sin(e)))/(3*a),h=(-o+i*(n-Kk*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,pM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&fM(),p=sM(e,n,r,o,gM[0]),u>1&&(g=sM(e,n,r,o,gM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(Zk(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,pM);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=nM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);pM[0]=-l,pM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Mt-1e-4){n=0,s=Mt;const e=r?1:-1;return a>=pM[0]+t&&a<=pM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Mt,s+=Mt);let c=0;for(let e=0;e<2;e++){const i=pM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=s||t+Mt>=n&&t+Mt<=s)&&(t>wt/2&&t<1.5*wt&&(e=-e),c+=e)}}return c}function vM(t){return Math.round(t/wt*1e8)/1e8%2*wt}function bM(t,e){let i=vM(t[0]);i<0&&(i+=Mt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Mt?s=i+Mt:e&&i-s>=Mt?s=i-Mt:!e&&i>s?s=i+(Mt-vM(i-s)):e&&i1&&(i||(h+=aM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;xM[0]=S,xM[1]=w,bM(xM,Boolean(a[6])),S=xM[0],w=xM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case yA.M:u=m,p=y,c=u,d=p;break;case yA.L:if(i){if(cM(c,d,m,y,e,n,s))return!0}else h+=aM(c,d,m,y,n,s)||0;c=m,d=y;break;case yA.C:if(i){if(lM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=mM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case yA.Q:if(i){if(oM(c,d,m,y,_,v,e,n,s))return!0}else h+=yM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case yA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=aM(c,d,o,l,n,s),i){if(hM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=_M(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case yA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(cM(u,p,o,p,e,n,s)||cM(o,p,o,l,e,n,s)||cM(o,l,u,l,e,n,s)||cM(u,l,u,p,e,n,s))return!0}else h+=aM(o,p,o,l,n,s),h+=aM(u,l,u,p,n,s);break;case yA.Z:if(i){if(cM(c,d,u,p,e,n,s))return!0}else h+=aM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kM=function(t,e){return function(i,n){e(i,n,t)}};let MM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Xk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:bk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new He(Object.assign({defaultFontParams:{fontFamily:bk.fontFamily,fontSize:bk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var CM;MM=wM([Xw(),kM(0,qw(eA)),kM(0,$w(Nk)),kM(1,qw(oA)),AM("design:paramtypes",[Object,Object])],MM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(CM||(CM={}));const TM=new qt;let EM=class{constructor(){this.matrix=new qt}init(t){return this.mode=CM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=CM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(TM.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(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}scale(t,e,i){return this.mode===CM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return TM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}translate(t,e){return this.mode===CM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===CM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};EM=wM([Xw(),AM("design:paramtypes",[])],EM);const PM={arc:wk,area:Ak,circle:kk,line:Tk,path:Ek,symbol:Ik,text:Dk,rect:Rk,rect3d:Bk,polygon:Pk,richtext:Lk,richtextIcon:Fk,image:Ok,group:Mk,glyph:Ck},RM=Object.keys(PM);function BM(){return{arc:Object.assign({},PM.arc),area:Object.assign({},PM.area),circle:Object.assign({},PM.circle),line:Object.assign({},PM.line),path:Object.assign({},PM.path),symbol:Object.assign({},PM.symbol),text:Object.assign({},PM.text),rect:Object.assign({},PM.rect),rect3d:Object.assign({},PM.rect3d),polygon:Object.assign({},PM.polygon),richtext:Object.assign({},PM.richtext),richtextIcon:Object.assign({},PM.richtextIcon),image:Object.assign({},PM.image),group:Object.assign({},PM.group),glyph:Object.assign({},PM.glyph)}}function IM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const DM=new Array(60).fill(0).map((()=>BM()));class LM{constructor(){this._defaultTheme=DM.pop()||BM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?IM(this.userTheme,t.userTheme,!1):this.userTheme=P(t.userTheme),IM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);RM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const OM=new LM;function FM(t,e){return t.glyphHost?FM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):OM.getTheme()}return null}(t)||OM.getTheme()}class zM{static GenAutoIncrementId(){return zM.auto_increment_id++}}zM.auto_increment_id=0;var HM=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 jM extends r{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=zM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return HM(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){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof WM))return void console.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(XM(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=XM(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");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),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 WM))return void console.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=XM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=XM(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.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=YM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(XM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(XM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,XM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof WM))return void console.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"):XM(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 GM))return void console.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.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;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.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){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=0&&t<=C(this.rootTarget,"width")&&e>=0&&e<=C(this.rootTarget,"height")?this.rootTarget:null,i}}const KM={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof NM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new UM(t,e))}},qM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class ZM{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(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,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new $M(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new WM,this.rootWheelEvent=new GM,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&f(t)&&!E(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class JM{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const QM=(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"},tC=(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 eC extends r{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=YM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=YM.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||QM(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=tC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=YM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=tC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=QM(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=YM.now()-i>this.config.press.time&&tC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class nC{static Avaliable(){return!0}avaliable(){return nC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class sC{static Avaliable(){return!!Gk.global.getRequestAnimationFrame()}avaliable(){return sC.Avaliable()}tick(t,e){Gk.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var rC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(rC||(rC={}));class aC{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-aC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*aC.bounceIn(2*t):.5*aC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}aC.quadIn=aC.getPowIn(2),aC.quadOut=aC.getPowOut(2),aC.quadInOut=aC.getPowInOut(2),aC.cubicIn=aC.getPowIn(3),aC.cubicOut=aC.getPowOut(3),aC.cubicInOut=aC.getPowInOut(3),aC.quartIn=aC.getPowIn(4),aC.quartOut=aC.getPowOut(4),aC.quartInOut=aC.getPowInOut(4),aC.quintIn=aC.getPowIn(5),aC.quintOut=aC.getPowOut(5),aC.quintInOut=aC.getPowInOut(5),aC.backIn=aC.getBackIn(1.7),aC.backOut=aC.getBackOut(1.7),aC.backInOut=aC.getBackInOut(1.7),aC.elasticIn=aC.getElasticIn(1,.3),aC.elasticOut=aC.getElasticOut(1,.3),aC.elasticInOut=aC.getElasticInOut(1,.3*1.5);const oC=new class{constructor(){this.id=zM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===CA.END?this.removeAnimate(e):e.status===CA.RUNNING||e.status===CA.INITIAL?(this.animateCount++,e.advance(t)):e.status===CA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class lC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class hC extends lC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let cC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oC;this.id=t,this.timeline=e,this.status=CA.INITIAL,this.tailAnimate=new dC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&TA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:MA.ANIMATE_PLAY})}runCb(t){const e=new hC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===CA.RUNNING&&(this.status=CA.PAUSED)}resume(){this.status===CA.PAUSED&&(this.status=CA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new dC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===CA.RUNNING&&(this.status=CA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=CA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};cC.mode=TA.NORMAL,cC.interpolateMap=new Map;class dC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new uC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?aC[i]:i,s=this._addStep(e,null,n);return s.type=EA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?aC[i]:i,r=this._addStep(e,null,s);return r.type=EA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=EA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=EA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new uC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class uC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const pC=200,gC="cubicOut",fC=1e3,mC="quadInOut";var yC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(yC||(yC={}));const _C=[!1,!1,!1,!1],vC=[0,0,0,0],bC=t=>t?m(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(vC[0]=t[0],vC[2]=t[0],vC[1]=t[1],vC[3]=t[1],vC):t:t:0,xC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],SC=[1,2,3,0,1,2,3,0];function wC(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;xC[0].x=i,xC[1].y=i,xC[2].x=-i,xC[3].y=-i;const s=Math.ceil(t/At)%4,r=Math.ceil(e/At)%4;if(n.add(Et(t)*i,Bt(t)*i),n.add(Et(e)*i,Bt(e)*i),s!==r||e-t>wt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ht(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=AC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class RC extends lC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:MA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class BC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=Gk.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class IC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=Gk.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class DC extends lC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Mt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+wt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z}}class LC extends lC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class OC extends lC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?aC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function FC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function zC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{rt(e,n)&&rt(i,s)||t.push(e,i,n,s,n,s)};function GC(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function UC(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 i=t.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),qC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ZC=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return qC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return qC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);ZC(s[0],n,i),ZC(s[1],e-n,i)}};var JC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const QC={};for(const t in JC)E(JC,t)&&(QC[JC[t]]=t);const tT={to:{},get:{}};function eT(t,e,i){return Math.min(Math.max(e,t),i)}function iT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}tT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=tT.get.hsl(t,n),i="hsl";break;case"hwb":e=tT.get.hwb(t,n),i="hwb";break;default:e=tT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},tT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=JC[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=eT(e[n],0,255);return e[3]=eT(e[3],0,1),e},tT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},tT.to.keyword=function(t){return QC[t.slice(0,3)]};const nT=tT;var sT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(sT||(sT={}));class rT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===sT.Color1){let e=rT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=tT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];rT.store1[t]=s,rT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=rT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=tT.get(t),n&&n.value){const e=n.value;rT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],rT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===sT.Color1){if(rT.store1[t])return;rT.store1[t]=i,rT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(rT.store255[t])return;rT.store255[t]=i,rT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function aT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 oT(t,e,i,n,s){if(!t||!e)return t&&aT(t)||e&&aT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=rT.Get(t,sT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=rT.Get(e,sT.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:aT(a)})))});return o?oT(r,l,i,n,s):oT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),aT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}rT.store255={},rT.store1={};const lT=[0,0,0,0],hT=[0,0,0,0];function cT(t,e,i){return rT.Get(t,sT.Color255,lT),rT.Get(e,sT.Color255,hT),`rgba(${Math.round(lT[0]+(hT[0]-lT[0])*i)},${Math.round(lT[1]+(hT[1]-lT[1])*i)},${Math.round(lT[2]+(hT[2]-lT[2])*i)},${lT[3]+(hT[3]-lT[3])*i})`}const dT=(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=oT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},uT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?GC(t):[],s=GC(e);i&&n&&(i.fromTransform&&UC(n,i.fromTransform.clone().getInverse()),UC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},gT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],fT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!gT.includes(s))return;const r=e[s];h(r)||h(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?rT.Get(t[s],sT.Color255):t[s],to:"string"==typeof r?rT.Get(r,sT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class mT extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;uT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&dT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const yT=(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=pT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=fT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new mT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:fC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:mC)),c};class _T extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;uT(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&&dT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const vT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>MC.includes(t))(i)||(e[i]=t[i])})),e},bT=(t,e,i)=>{const n=vT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Gk.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},xT=(t,e,i)=>{const n=[],s=i?null:vT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:vT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=XC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Gk.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=XC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=XC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return $C(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 $C(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Gk.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:KC(i)}];const n=[];return ZC(i,e,n),n})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&v(t.x)&&v(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 ZC(r,e,h),h})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=GC(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Gk.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&bT(t,n,e),n};class wT{static GetImage(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=wT.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},wT.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gk.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gk.global.loadBlob(t):"json"===e&&(i.dataPromise=Gk.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}wT.cache=new Map;const AT=new qt,kT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],MT=["x","y"],CT=["scaleX","scaleY"],TT=["angle"],ET=new Ht;class PT extends jM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Wt,this._updateTag=AA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=FM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;ET.x=i+e,ET.y=n+s}else ET.x=i,ET.y=n;return ET}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new qt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&AA.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&AA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=AA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===kA.GLOBAL){const i=new Ht(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Gk.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!h(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:pC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:gC)}else this.setAttributes(t,!1,{type:MA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();E(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=AA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=AA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&AA.UPDATE_SHAPE_AND_BOUNDS)===AA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=AA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=AA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=mk.x,y:e=mk.y,scaleX:i=mk.scaleX,scaleY:n=mk.scaleY,angle:s=mk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Et(a),f=Bt(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(mk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=AT.setValue(a.a,a.b,a.c,a.d,a.e,a.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:MA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=oT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return FM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gk.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return f(t,!0)?this.pathProxy=(new pk).fromString(t):this.pathProxy=new pk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",x(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(wT.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new UM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}PT.mixin(KM);var RT=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 BT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let IT=0;function DT(){return IT++}const LT=DT(),OT=DT(),FT=DT(),zT=DT(),HT=DT(),jT=DT(),NT=DT(),VT=DT(),WT=DT(),GT=DT(),UT=DT(),YT=DT(),XT=DT(),$T=DT(),KT=DT(),qT=DT(),ZT=Symbol.for("GraphicService"),JT=Symbol.for("GraphicCreator");var QT;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(QT||(QT={}));let tE=class t extends PT{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=jT,this._childUpdateTag=AA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new LM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new LM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===kA.GLOBAL){const i=new Ht(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&AA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=FM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Gk.graphicService.updateGroupAABBBounds(t,FM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=bC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS,this._childUpdateTag&=AA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&AA.UPDATE_BOUNDS||(this._childUpdateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Gk.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Gk.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Gk.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Gk.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&AA.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=Gk.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const eE=Symbol.for("LayerHandlerContribution");class iE extends tE{get offscreen(){return this.layerHandler.offscreen}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=Wk.get(eE),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 LM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Gk.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Gk.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var nE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rE=function(t,e){return function(i,n){e(i,n,t)}};let aE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new iE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};aE=nE([Xw(),rE(0,qw(oA)),sE("design:paramtypes",[Object])],aE);var oE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hE=function(t,e){return function(i,n){e(i,n,t)}};const cE=Symbol.for("Window"),dE=Symbol.for("WindowHandlerContribution");let uE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new rA(["x","y","width","height"])},this._uid=zM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Wk.getNamed(dE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};oE([tA(),lE("design:type",Function),lE("design:paramtypes",[]),lE("design:returntype",void 0)],uE.prototype,"postInit",null),uE=oE([Xw(),hE(0,qw(oA)),lE("design:paramtypes",[Object])],uE);const pE=Symbol.for("TransformUtil"),gE=Symbol.for("GraphicUtil"),fE=Symbol.for("LayerService");var mE=new Vw((t=>{t(dA).toSelf().inSingletonScope(),t(oA).toService(dA),t(uE).to(uE),t(cE).toService(uE),t(MM).toSelf().inSingletonScope(),t(gE).toService(MM),t(EM).toSelf().inSingletonScope(),t(pE).toService(EM),t(aE).toSelf().inSingletonScope(),t(fE).toService(aE)}));function yE(t){return!!t}function _E(t,e){let i;return i=m(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function vE(t,e){return t*e>0}function bE(t,e,i,n){return t*e>0&&i>0&&n>0}function xE(t,e){return t*e>0}function SE(t,e,i,n){return t*e>0&&i>0&&n>0}function wE(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=FM(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,m=vE(d,u),y=xE(d,g),_=yE(h),v=_E(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return FA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function AE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function ME(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(s=Mt-St)e.moveTo(i+s*Et(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>St&&(e.moveTo(i+r*Et(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*Et(f),T=s*Bt(f),E=r*Et(y),P=r*Bt(y);let R,B,I,D;if((A>St||w>St)&&(R=s*Et(m),B=s*Bt(m),I=r*Et(_),D=r*Bt(_),hSt){const t=Rt(v,k),r=Rt(b,k),o=kE(I,D,C,T,s,t,Number(c)),l=kE(R,B,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Et(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+R,n+s*Bt(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>St)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>St){const t=Rt(S,M),s=Rt(x,M),o=kE(E,P,R,B,r,-s,Number(c)),l=kE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Et(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*Et(_),n+r*Bt(_))}return a?a[3]&&e.lineTo(i+s*Et(l),n+s*Et(l)):e.closePath(),d}class CE{static GetCanvas(){try{return CE.canvas||(CE.canvas=Gk.global.createCanvas({})),CE.canvas}catch(t){return null}}static GetCtx(){if(!CE.ctx){const t=CE.GetCanvas();CE.ctx=t.getContext("2d")}return CE.ctx}}class TE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=CE.GetCanvas(),n=CE.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=TE.dataMap.get(i);return n||(n=new TE(t,e),TE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){TE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return TE.dataMap.get(t)}}TE.dataMap=new Map;class EE{static GetSize(t){for(let e=0;e=t)return EE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=EE.GenKey(t,e,i,n,s),l=EE.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=EE.GenKey(t,e,i,n,s);EE.cache[l]?EE.cache[l].push({width:a,height:o,pattern:r}):EE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}EE.cache={},EE.ImageSize=[20,40,80,160,320,640,1280,2560];const PE=Symbol.for("ArcRenderContribution"),RE=Symbol.for("AreaRenderContribution"),BE=Symbol.for("CircleRenderContribution"),IE=Symbol.for("GroupRenderContribution"),DE=Symbol.for("ImageRenderContribution"),LE=Symbol.for("PathRenderContribution"),OE=Symbol.for("PolygonRenderContribution"),FE=Symbol.for("RectRenderContribution"),zE=Symbol.for("SymbolRenderContribution"),HE=Symbol.for("TextRenderContribution"),jE=Symbol.for("InteractiveSubRenderContribution");var NE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WE=function(t,e){return function(i,n){e(i,n,t)}};let GE=class{constructor(t){this.arcRenderContribitions=t,this.numberType=LT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Ct(d-c),p=d>c;let g=!1;if(sSt||M>St)&&(D=s*Et(v),L=s*Bt(v),O=r*Et(x),F=r*Bt(x),uSt){const t=Rt(S,T),r=Rt(w,T),a=kE(O,F,P,R,s,t,Number(p)),o=kE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>St)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>St){const t=Rt(k,E),s=Rt(A,E),a=kE(B,I,D,L,r,-s,Number(p)),o=kE(P,R,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Et(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,l){const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x:_=h.x,y:v=h.y}=t.attribute,b=vE(p,g),x=xE(p,m),S=yE(c),w=_E(u,f);if(!t.valid||!y)return;if(!(S||w||d))return;if(!(b||x||a||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=!1;const{isFullStroke:E,stroke:P}=(t=>{var e;let i=!0;if(o(t,!0)){for(let n=0;n<4;n++)_C[n]=t,i&&(i=!(null!==(e=_C[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)_C[e]=!!t[e],i&&(i=!!_C[e]);else _C[0]=!1,_C[1]=!1,_C[2]=!1,_C[3]=!1;return{isFullStroke:i,stroke:_C}})(u);if(S||E||d){if(e.beginPath(),ME(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,_-i,v-n,h),e.fill())),w&&E&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,_-i,v-n,h),e.stroke()))}if(!E&&w){if(e.beginPath(),ME(t,e,i,n,A,k,P),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if(M&&C){const{startAngle:r,endAngle:o}=t.getParsedAngle();if(Ct(o-r)>=Mt-St){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:o=h.endAngle,fill:c=h.fill}=t.attribute,d=o;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;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),oT(o.color,l.color,h,!1)}(0,0,o,s);a||vE&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};GE=NE([Xw(),WE(0,qw(eA)),WE(0,$w(PE)),VE("design:paramtypes",[Object])],GE);var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XE=function(t,e){return function(i,n){e(i,n,t)}};let $E=class{constructor(t){this.circleRenderContribitions=t,this.numberType=zT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(y,f),w=xE(y,m),A=yE(h),k=_E(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};$E=UE([Xw(),XE(0,qw(eA)),XE(0,$w(BE)),YE("design:paramtypes",[Object])],$E);const KE=["radius","startAngle","endAngle",...kT];class qE extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=zT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=FM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateCircleAABBBounds(i,FM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function JE(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function QE(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class tP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=qT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=FM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=FM(this).text,n=Gk.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=JE(c,s),e=QE(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=JE(c,s),_=QE(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=FM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;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 g=Gk.graphicUtil.textMeasure,f=new tP(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).text[t]}needUpdateTags(t){for(let e=0;e{WP[t.type]=t}));const GP=["symbolType","size",...kT];let UP=class t extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=KT}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return m(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=FM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=WP[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new pk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Pt(r,a);return s.transform(0,0,o,o),this._parsedPath=new VP(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=FM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateSymbolAABBBounds(i,FM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=VT}isValid(){return super.isValid()&&this._isValid()}_isValid(){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=kC(i,n,e))}doUpdateAABBBounds(){const t=FM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateLineAABBBounds(e,FM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const $P=["width","height","cornerRadius",...kT];class KP extends PT{constructor(t){super(t),this.type="rect",this.numberType=YT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=FM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRectAABBBounds(e,FM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).rect[t]}needUpdateTags(t){for(let e=0;e<$P.length;e++){const i=$P[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$P.length;e++)if(t===$P[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=t.width,i=t.height,n=new pk;return n.moveTo(0,0),n.rect(0,0,e,i),n}clone(){return new KP(Object.assign({},this.attribute))}}const qP=[[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 ZP extends KP{constructor(t){super(t),this.type="rect3d",this.numberType=XT}findFace(){const t={polygons:[],vertices:[],edges:[]},e=FM(this).rect3d,{width:i=e.width,height:n=e.width,length:s=Rt(e.width,e.height)}=this.attribute;for(let e=0;e{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){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=Gk.graphicService.updateGlyphAABBBounds(this.attribute,FM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new JP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const QP={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"}},tR=!0,eR=!1,iR=/\w|\(|\)/,nR=/[.?!,;:/,。?!、;:]/,sR=/\S/;function rR(t,e,i,n,s){if(!e||e<=0)return 0;const r=Gk.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=function(t,e){let i=e;for(;iR.test(t[i-1])&&iR.test(t[i])||nR.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function aR(t,e){const i=Gk.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class oR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=QP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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,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=this.lines[i].getWidthWithEllips();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((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=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(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=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class lR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=aR(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=aR(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=rR(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=aR(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||eR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||tR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=rR(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=aR(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const hR=["width","height","image",...kT];class cR extends PT{constructor(t){super(t),this.type="image",this.numberType=NT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=FM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateImageAABBBounds(e,FM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ok[t]}needUpdateTags(t){for(let e=0;e{if(m(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=bC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Ok.width,height:e=Ok.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 uR{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 dR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=QP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof lR){const e=sR.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof dR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof dR?t.width:t.getWidthWithEllips(this.direction)})),e}}class pR{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=QP[this.direction]}store(t){if(t instanceof dR){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 uR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof dR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=rR(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new lR(i,t.newLine,t.character),new lR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const gR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...kT];class fR extends PT{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=$T}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=FM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRichTextAABBBounds(e,FM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new pR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const mR=["path","customPath",...kT];class yR extends PT{constructor(t){super(t),this.type="path",this.numberType=WT}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=FM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pk?e.path:(h(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pk?this.cache:t.path)}doUpdateAABBBounds(){const t=FM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePathAABBBounds(e,FM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;f(t.path,!0)?this.cache=(new pk).fromString(t.path):t.customPath&&(this.cache=new pk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).path[t]}needUpdateTags(t){for(let e=0;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 vR(Object.assign({},this.attribute))}}const bR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kT];class xR extends PT{constructor(t){super(t),this.type="arc",this.numberType=LT}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=FM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(v(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=FM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Xt(e),i=e+r,n&&Ct(r)St&&o>St)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=FM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=It(n*n+s*s)}=this.attribute,o=Ct(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>St&&a>St){const i=e>t?1:-1;let r=Ot(Number(a)/s*Bt(u)),o=Ot(Number(a)/n*Bt(u));return(p-=2*r)>St?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>St?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateArcAABBBounds(i,FM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Mt-St)o.moveTo(0+s*Et(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>St&&(o.moveTo(0+n*Et(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Et(e),r=s*Bt(e),l=n*Et(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new xR(Object.assign({},this.attribute))}}class SR extends xR{constructor(t){super(t),this.type="arc3d",this.numberType=OT}doUpdateAABBBounds(){const t=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateArc3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const wR=["points","cornerRadius",...kT];class AR extends PT{constructor(t){super(t),this.type="polygon",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePolygonAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=kC(i,n,e))}getDefaultAttribute(t){return FM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new AR(Object.assign({},this.attribute))}}class kR extends AR{constructor(t){super(t),this.type="pyramid3d",this.numberType=UT}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePyramid3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}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}}var MR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CR=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};CR=MR([Xw()],CR);var TR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ER=Symbol.for("RectBoundsContribution");let PR=class extends CR{};PR=TR([Xw()],PR);var RR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const BR=Symbol.for("SymbolBoundsContribution");let IR=class extends CR{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;BT(i,n+r+o/2,!0,a)}return i}};IR=RR([Xw()],IR);var DR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const LR=Symbol.for("CircleBoundsContribution");let OR=class extends CR{};OR=DR([Xw()],OR);var FR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const zR=Symbol.for("ArcBoundsContribution");let HR=class extends CR{};HR=FR([Xw()],HR);var jR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const NR=Symbol.for("PathBoundsContribution");let VR=class extends CR{};VR=jR([Xw()],VR);class WR{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return WR.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$R=function(t,e){return function(i,n){e(i,n,t)}};function KR(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=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]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function qR(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 ZR(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function JR(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),KR(t,t,[s+o,r+l,a+h]),KR(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),KR(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=UR.allocate(),n=[0,0];if(y){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]}KR(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),KR(i,i,[-n[0],-n[1],0]),ZR(t,t,i)}}let QR=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new rA(["graphic"]),onSetStage:new rA(["graphic","stage"]),onRemove:new rA(["graphic"]),onAddIncremental:new rA(["graphic","group","stage"]),onClearIncremental:new rA(["graphic","group","stage"]),beforeUpdateAABBBounds:new rA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new rA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Wt,this.tempAABBBounds2=new Wt}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)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new pA(t);return FA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),Nt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Mt-St?i.set(-a,-a,a,a):wC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=St?i.set(0,0,0,0):Math.abs(a-o)>Mt-St?i.set(-s,-s,s,s):(wC(o,a,s,i),wC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(m(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){BT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){BT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Nt(e,e,s.transMatrix)}};QR=YR([Xw(),$R(0,qw(JT)),$R(1,qw(eA)),$R(1,$w(ER)),$R(2,qw(eA)),$R(2,$w(BR)),$R(3,qw(eA)),$R(3,$w(LR)),$R(4,qw(eA)),$R(4,$w(zR)),$R(5,qw(eA)),$R(5,$w(NR)),XR("design:paramtypes",[Object,Object,Object,Object,Object,Object])],QR);class tB extends tE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const eB=["heightLimit","lineClamp"];class iB extends iP{_isValid(){const{text:t}=this.attribute;return m(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=FM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;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),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=Gk.graphicUtil.textMeasure,f=new tP(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=UR.allocate(),s=UR.allocate();JR(s,t,e),ZR(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),UR.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,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()}};function xB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),SB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=PA.ROW:"y"===n?c=PA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let AB=class extends bB{constructor(){super(...arguments),this.numberType=VT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const y=null!==(f=this.z)&&void 0!==f?f:0;xB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:y}),u.cache&&!m(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:_=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,_-c,v-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,_-c,v-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=vE(d,u),y=xE(d,p),_=yE(h),v=_E(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(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),s=uk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=uk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],Rt(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function kB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),MB(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),MB(t,l,1,n),o=!1):o=!0}t.closePath()}function MB(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]=VA(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)}}AB=wB([Xw()],AB);var CB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EB=function(t,e){return function(i,n){e(i,n,t)}};function PB(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}let RB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=FT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=FM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=vE(y,m),A=yE(f),k=_E(b,x),M=xE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=PB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=PB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=PB(i,n),a=PB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],Rt(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=FM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?PA.ROW:PA.COLUMN,Number.isFinite(c)||(o=PA.COLUMN),Number.isFinite(d)||(o=PA.ROW);const u=i*(o===PA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===BA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,y-h,_-c,o),t.fill())),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;m(i)&&i[0]&&!1===i[1]&&(t.beginPath(),xB(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,y-h,_-c,o),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===BA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1}};RB=CB([Xw(),EB(0,qw(eA)),EB(0,$w(RE)),TB("design:paramtypes",[Object])],RB);var BB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DB=function(t,e){return function(i,n){e(i,n,t)}};let LB=class extends bB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=FM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=vE(f,p),w=xE(f,g),A=yE(d),k=_E(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)FA(t.pathShape.commandList,e,i,n,1,1,x);else{FA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};LB=BB([Xw(),DB(0,qw(eA)),DB(0,$w(LE)),IB("design:paramtypes",[Object])],LB);const OB=wt/2;function FB(t,e,i,n,s,r){let a;if(v(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!G(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-OB,0,!1)}if(t.lineTo(_[0],_[1]),!G(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,OB,!1)}if(t.lineTo(b[0],b[1]),!G(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],OB,wt,!1)}if(t.lineTo(g[0],g[1]),!G(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],wt,wt+OB,!1)}return t.closePath(),t}var zB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jB=function(t,e){return function(i,n){e(i,n,t)}};let NB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:y=l.fillOpacity,lineWidth:_=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=bE(f,y,u,p),A=SE(f,v,u,p),k=yE(h),M=_E(d,_);if(!t.valid||!b)return;if(!(k||M||c))return;if(!(w||A||a||o||c))return;0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),FB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};NB=zB([Xw(),jB(0,qw(eA)),jB(0,$w(FE)),HB("design:paramtypes",[Object])],NB);var VB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class extends bB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=vE(f,p),A=xE(f,g),k=yE(d),M=_E(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};UB=VB([Xw(),GB(0,qw(eA)),GB(0,$w(zE)),WB("design:paramtypes",[Object])],UB);var YB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$B=function(t,e){return function(i,n){e(i,n,t)}};let KB=class extends bB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=qT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=vE(f,p),C=xE(f,g),T=yE(d),E=_E(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const P=!b,R=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===BA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,R,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,R);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,R,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,R);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,R))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,R),this.drawUnderLine(_,v,t,i,n+r,R,h,e)))}P&&this.restoreTransformUseContext2d(t,h,R,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=JE(l,g),m=QE(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=JE(h,a),f=QE("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};KB=YB([Xw(),$B(0,qw(eA)),$B(0,$w(HE)),XB("design:paramtypes",[Object])],KB);var qB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZB=class{};function JB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nI=function(t,e){return function(i,n){e(i,n,t)}};let sI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:y=l.lineWidth,opacity:_=l.opacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(_,p),w=xE(_,f),A=yE(c),k=_E(d,y);t.valid&&v&&(A||k||g)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||m(u)&&u.every((t=>0===t))?JB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)JB(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=tI(l,y,_,c,d),S=tI(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=QB(w,A),M=tI(l,QB(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};sI=eI([Xw(),nI(0,qw(eA)),nI(0,$w(OE)),iI("design:paramtypes",[Object])],sI);var rI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oI=function(t,e){return function(i,n){e(i,n,t)}};const lI=["","repeat-x","repeat-y","repeat"];let hI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=NT}drawShape(t,e,i,n,s,r,a){const o=FM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=vE(d,u),_=yE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,lI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=FM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};hI=rI([Xw(),oI(0,qw(eA)),oI(0,$w(DE)),aI("design:paramtypes",[Object])],hI);const cI=Symbol.for("IncrementalDrawContribution"),dI=Symbol.for("ArcRender"),uI=Symbol.for("Arc3dRender"),pI=Symbol.for("AreaRender"),gI=Symbol.for("CircleRender"),fI=Symbol.for("GraphicRender"),mI=Symbol.for("GroupRender"),yI=Symbol.for("LineRender"),_I=Symbol.for("PathRender"),vI=Symbol.for("PolygonRender"),bI=Symbol.for("RectRender"),xI=Symbol.for("Rect3DRender"),SI=Symbol.for("SymbolRender"),wI=Symbol.for("TextRender"),AI=Symbol.for("RichTextRender"),kI=Symbol.for("Pyramid3dRender"),MI=Symbol.for("GlyphRender"),CI=Symbol.for("ImageRender"),TI=Symbol.for("RenderSelector"),EI=Symbol.for("DrawContribution");function PI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function RI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(m(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const BI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(t)},t));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};return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(e)},e))}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(){this.pools=[]}};var II=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LI=function(t,e){return function(i,n){e(i,n,t)}};let OI=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};OI=II([Xw()],OI);let FI=class{constructor(t){this.subRenderContribitions=t,this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};FI=II([Xw(),LI(0,qw(eA)),LI(0,$w(jE)),DI("design:paramtypes",[Object])],FI);let zI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=BI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return BI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Mt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};zI=II([Xw()],zI);var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),ME(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),ME(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};jI=HI([Xw()],jI);let NI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};NI=HI([Xw()],NI);let VI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};VI=HI([Xw()],VI);var WI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let GI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};GI=WI([Xw()],GI);let UI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};UI=WI([Xw()],UI);let YI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};YI=WI([Xw()],YI);var XI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $I=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};$I=XI([Xw()],$I);var KI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};qI=KI([Xw()],qI);var ZI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),FB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),FB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};JI=ZI([Xw()],JI);let QI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};QI=ZI([Xw()],QI);let tD=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};tD=ZI([Xw()],tD);let eD=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};eD=ZI([Xw()],eD);let iD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};iD=ZI([Xw()],iD);var nD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};sD=nD([Xw()],sD);class rD extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}}class aD extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}}var oD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hD=function(t,e){return function(i,n){e(i,n,t)}};const cD=Symbol.for("RenderService");let dD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}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)}};dD=oD([Xw(),hD(0,qw(EI)),lD("design:paramtypes",[Object])],dD);var uD=new Vw((t=>{t(dD).toSelf(),t(cD).toService(dD)})),pD=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 gD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return pD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function mD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var yD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const _D=Symbol.for("PickItemInterceptor");let vD=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===OT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};vD=yD([Xw()],vD);var bD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SD=function(t,e){return function(i,n){e(i,n,t)}};const wD=Symbol.for("PickerService");let AD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new qt(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=UR.allocate();if(qR(i,e),a){if(i){const t=UR.allocate();r.modelMatrix=ZR(t,a,i),UR.free(i)}}else qR(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Ht(e.x,e.y),a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Ht(e.x,e.y);l.transformPoint(r,r);const a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&UR.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),GR.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};AD=bD([Xw(),SD(0,qw(oA)),SD(1,qw(eA)),SD(1,$w(_D)),xD("design:paramtypes",[Object,Object])],AD);var kD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CD=function(t,e){return function(i,n){e(i,n,t)}};const TD=Symbol.for("GlobalPickerService");let ED=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new qt(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 Ht(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function PD(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function RD(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}ED=kD([Xw(),CD(0,qw(oA)),MD("design:paramtypes",[Object])],ED);class BD{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=UR.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=UR.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const LD=[0,0,0],OD=new qt(1,0,0,1,0,0);let FD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},yk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},vk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new qt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.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&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Mt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),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&&EE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gk.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Gk.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:bk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:bk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[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={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=RI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}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={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=ZE(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=ZE(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(OD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};FD.env="browser",FD=ID([Xw(),DD("design:paramtypes",[Object,Number])],FD);var zD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const jD={WIDTH:500,HEIGHT:500,DPR:1};let ND=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=jD.WIDTH,height:n=jD.HEIGHT,dpr:s=jD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=Gk.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new FD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}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.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};ND.env="browser",ND=zD([Xw(),HD("design:paramtypes",[Object])],ND);const VD=Symbol.for("CanvasArcPicker"),WD=Symbol.for("CanvasArc3dPicker"),GD=Symbol.for("CanvasAreaPicker"),UD=Symbol.for("CanvasCirclePicker"),YD=Symbol.for("CanvasImagePicker"),XD=Symbol.for("CanvasLinePicker"),$D=Symbol.for("CanvasPathPicker"),KD=Symbol.for("CanvasRectPicker"),qD=Symbol.for("CanvasRect3dPicker"),ZD=Symbol.for("CanvasSymbolPicker"),JD=Symbol.for("CanvasTextPicker"),QD=Symbol.for("CanvasPolygonPicker"),tL=Symbol.for("CanvasPyramid3dPicker"),eL=Symbol.for("CanvasRichTextPicker"),iL=Symbol.for("CanvasGlyphPicker"),nL=Symbol.for("CanvasPickerContribution"),sL=Symbol.for("MathArcPicker"),rL=Symbol.for("MathAreaPicker"),aL=Symbol.for("MathCirclePicker"),oL=Symbol.for("MathLinePicker"),lL=Symbol.for("MathPathPicker"),hL=Symbol.for("MathRectPicker"),cL=Symbol.for("MathSymbolPicker"),dL=Symbol.for("MathTextPicker"),uL=Symbol.for("MathPolygonPicker"),pL=Symbol.for("MathGlyphPicker"),gL=Symbol.for("MathPickerContribution");var fL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yL=function(t,e){return function(i,n){e(i,n,t)}};let _L=class extends AD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new ND(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xL=new qt(1,0,0,1,0,0),SL={x:0,y:0};let wL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0),this.path=new pk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},SL),function(t,e,i){return SM(t,0,!1,e,i)}(this.path.commandList,SL.x,SL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},SL);const i=PI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return SM(t,e,!0,i,n)}(this.path.commandList,i,SL.x,SL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(xL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};wL=vL([Xw(),bL("design:paramtypes",[Object,Number])],wL);var AL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ML=function(t,e){return function(i,n){e(i,n,t)}};let CL=class extends AD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new wL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};AL([tA(),kL("design:type",Function),kL("design:paramtypes",[]),kL("design:returntype",void 0)],CL.prototype,"init",null),CL=AL([Xw(),ML(0,qw(eA)),ML(0,$w(gL)),ML(1,qw(oA)),ML(2,qw(eA)),ML(2,$w(_D)),kL("design:paramtypes",[Object,Object,Object])],CL);var TL=new Vw((t=>{t(_L).toSelf().inSingletonScope(),t(CL).toSelf().inSingletonScope(),t(wD).toService(_L),t(ED).toSelf().inSingletonScope(),t(TD).toService(ED),t(vD).toSelf().inSingletonScope(),t(_D).toService(vD),nA(t,_D)})),EL=new Vw((t=>{t(QR).toSelf().inSingletonScope(),t(ZT).toService(QR),t(PR).toSelf().inSingletonScope(),t(ER).toService(PR),nA(t,ER),t(IR).toSelf().inSingletonScope(),t(BR).toService(IR),nA(t,BR),t(OR).toSelf().inSingletonScope(),t(LR).toService(OR),nA(t,LR),t(HR).toSelf().inSingletonScope(),t(zR).toService(HR),nA(t,zR),t(VR).toSelf().inSingletonScope(),t(NR).toService(VR),nA(t,NR),t(JT).toConstantValue(mB)}));const PL=Symbol.for("AutoEnablePlugins"),RL=Symbol.for("PluginService");var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DL=function(t,e){return function(i,n){e(i,n,t)}};let LL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Wk.isBound(PL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};LL=BL([Xw(),DL(0,qw(eA)),DL(0,$w(PL)),IL("design:paramtypes",[Object])],LL);var OL=new Vw((t=>{t(LL).toSelf(),t(RL).toService(LL),nA(t,PL)})),FL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};zL=FL([Xw()],zL);var HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function NL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let VL=class extends zL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(b(o)?o:1),y:(s-r.top)/(b(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return NL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return NL(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:zM.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(){}};function WL(){Wk.rebind(wD).toService(CL)}VL=HL([Xw(),jL("design:paramtypes",[])],VL);var GL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YL=class extends zL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};YL=GL([Xw(),UL("design:paramtypes",[])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KL=class extends zL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Wk.rebind(wD).toService(CL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=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){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}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(){}};KL=XL([Xw(),$L("design:paramtypes",[])],KL);var qL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JL=!1;try{JL=!!lynx.createCanvasNG}catch(t){}let QL=class extends zL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=JL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,JL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(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(){}};QL=qL([Xw(),ZL("design:paramtypes",[])],QL);var tO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eO=class extends zL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};eO=tO([Xw()],eO);var iO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let rO=class extends zL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return sO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{WL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};rO=iO([Xw(),nO("design:paramtypes",[])],rO);var aO=new Vw((t=>{t(VL).toSelf().inSingletonScope(),t(aA).toService(VL),t(YL).toSelf().inSingletonScope(),t(aA).toService(YL),t(KL).toSelf().inSingletonScope(),t(aA).toService(KL),t(QL).toSelf().inSingletonScope(),t(aA).toService(QL),t(rO).toSelf().inSingletonScope(),t(aA).toService(rO),t(eO).toSelf().inSingletonScope(),t(aA).toService(eO),nA(t,aA)})),oO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hO=class{constructor(){this._uid=zM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};hO=oO([Xw(),lO("design:paramtypes",[])],hO);var cO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uO=function(t,e){return function(i,n){e(i,n,t)}};let pO=class extends hO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}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 this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ND(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new ND({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};pO.env="browser",pO=cO([Xw(),uO(0,qw(oA)),dO("design:paramtypes",[Object])],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}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;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};fO.env="feishu",fO=gO([Xw()],fO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _O={WIDTH:500,HEIGHT:500,DPR:1};let vO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=_O.WIDTH,height:n=_O.HEIGHT,dpr:s=_O.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new fO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};vO.env="feishu",vO=mO([Xw(),yO("design:paramtypes",[Object])],vO);var bO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SO=function(t,e){return function(i,n){e(i,n,t)}};let wO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 vO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};wO.env="feishu",wO=bO([Xw(),SO(0,qw(oA)),xO("design:paramtypes",[Object])],wO);var AO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kO=class extends FD{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(RI(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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(PI(this,l,this.dpr)),r.setStrokeStyle(RI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=ZE(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=ZE(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}};kO.env="taro",kO=AO([Xw()],kO);var MO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const TO={WIDTH:500,HEIGHT:500,DPR:1};let EO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=TO.WIDTH,height:n=TO.HEIGHT,dpr:s=TO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new kO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};EO.env="taro",EO=MO([Xw(),CO("design:paramtypes",[Object])],EO);var PO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BO=function(t,e){return function(i,n){e(i,n,t)}};let IO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 EO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};IO.env="taro",IO=PO([Xw(),BO(0,qw(oA)),RO("design:paramtypes",[Object])],IO);var DO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let LO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};LO.env="lynx",LO=DO([Xw()],LO);var OO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zO={WIDTH:500,HEIGHT:500,DPR:1};let HO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=zO.WIDTH,height:n=zO.HEIGHT,dpr:s=zO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new LO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};HO.env="lynx",HO=OO([Xw(),FO("design:paramtypes",[Object])],HO);var jO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VO=function(t,e){return function(i,n){e(i,n,t)}};let WO=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",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:zM.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)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 HO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};WO.env="lynx",WO=jO([Xw(),VO(0,qw(oA)),NO("design:paramtypes",[Object])],WO);var GO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YO=class extends FD{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 qt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};YO.env="node",YO=GO([Xw(),UO("design:paramtypes",[Object,Number])],YO);var XO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$O=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const KO={WIDTH:500,HEIGHT:500,DPR:1};let qO=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=KO.WIDTH,height:n=KO.HEIGHT,canvasControled:s=!0,dpr:r=KO.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new YO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&l(this._nativeCanvas.release)&&this._nativeCanvas.release()}};qO.env="node",qO=XO([Xw(),$O("design:paramtypes",[Object])],qO);var ZO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QO=function(t,e){return function(i,n){e(i,n,t)}};let tF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new qO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new qO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};tF.env="node",tF=ZO([Xw(),QO(0,qw(oA)),JO("design:paramtypes",[Object])],tF);var eF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iF=class extends FD{draw(){}createPattern(t,e){return null}};iF.env="wx",iF=eF([Xw()],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rF={WIDTH:500,HEIGHT:500,DPR:1};let aF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=rF.WIDTH,height:n=rF.HEIGHT,dpr:s=rF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new iF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};aF.env="wx",aF=nF([Xw(),sF("design:paramtypes",[Object])],aF);var oF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hF=function(t,e){return function(i,n){e(i,n,t)}};class cF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let dF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new cF}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:zM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new aF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new aF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};dF.env="wx",dF=oF([Xw(),hF(0,qw(oA)),lF("design:paramtypes",[Object])],dF);var uF=new Vw((t=>{t(pO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(pO))).whenTargetNamed(pO.env),t(wO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(wO))).whenTargetNamed(wO.env),t(IO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(IO))).whenTargetNamed(IO.env),t(WO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(WO))).whenTargetNamed(WO.env),t(dF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(dF))).whenTargetNamed(dF.env),t(tF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(tF))).whenTargetNamed(tF.env)})),pF=new Vw((t=>{t(Vk).toSelf().inSingletonScope(),t(Nk).toService(Vk),nA(t,Nk)})),gF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mF=function(t,e){return function(i,n){e(i,n,t)}};let yF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Xk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,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()}};yF=gF([Xw(),mF(0,qw(oA)),fF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bF=function(t,e){return function(i,n){e(i,n,t)}};let xF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=Xk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};xF=_F([Xw(),bF(0,qw(oA)),vF("design:paramtypes",[Object])],xF);var SF=new Vw((t=>{t(yF).toSelf(),t(xF).toSelf(),t(eE).toService(yF)}));var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const AF=Symbol.for("DrawItemInterceptor"),kF=new Wt;let MF=class{constructor(){this.order=1}afterDrawItem(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){kF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(kF),!0}};MF=wF([Xw()],MF);let CF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=UR.allocate();qR(l,o);const h=r.modelMatrix;if(h){if(l){const t=UR.allocate();r.modelMatrix=ZR(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===OT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&UR.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};CF=wF([Xw()],CF);var TF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},EF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PF=function(t,e){return function(i,n){e(i,n,t)}};let RF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=be(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=mD(e,i,Sk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Se(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):gD(t,Sk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_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||Wk.get(cI);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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IF=class{selector(t){return null}};IF=BF([Xw()],IF);var DF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let FF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:y=l.fillOpacity,strokeOpacity:_=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=bE(u,y,p,g),A=SE(u,_,p,g),k=yE(h),M=_E(d,x);if(!t.valid||!S)return;if(!f){if(!(k||M||c))return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===v||m(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),FB(e,i,n,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=FM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=UR.allocate(),i=UR.allocate();JR(i,t,a),ZR(e,o||e,i),s.modelMatrix=e,UR.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&UR.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};FF=DF([Xw(),OF(0,qw(eA)),OF(0,$w(IE)),LF("design:paramtypes",[Object])],FF);var zF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HF=class extends AB{constructor(){super(...arguments),this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=FM(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,y=vE(u,p),_=xE(u,g),v=yE(c),b=_E(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};HF=zF([Xw()],HF);var jF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NF=class extends RB{constructor(){super(...arguments),this.numberType=FT}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=FM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=vE(u,d),f=yE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};NF=jF([Xw()],NF);var VF,WF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UF=function(t,e){return function(i,n){e(i,n,t)}},YF=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"}(VF||(VF={}));let XF=class extends RF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=VF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new rA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return YF(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,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.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 YF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return YF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>YF(this,void 0,void 0,(function*(){if(2!==t.count)yield fD(t,Sk.zIndex,((i,n)=>{if(this.status===VF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return YF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return YF(this,void 0,void 0,(function*(){this.rendering&&(this.status=VF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=VF.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 YF(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:()=>YF(this,void 0,void 0,(function*(){yield fD(t,Sk.zIndex,(t=>YF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};WF([qw(oA),GF("design:type",Object)],XF.prototype,"global",void 0),XF=WF([Xw(),UF(0,Zw(fI)),UF(1,qw(TI)),UF(2,qw(HF)),UF(3,qw(NF)),UF(4,qw(fE)),UF(5,qw(eA)),UF(5,$w(AF)),GF("design:paramtypes",[Array,Object,Object,Object,Object,Object])],XF);var $F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KF=class extends bB{constructor(){super(...arguments),this.type="rect3d",this.numberType=XT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=bE(g,f,u,p),x=SE(g,y,u,p),S=yE(c),w=_E(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}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){const l=nT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};KF=$F([Xw()],KF);var qF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZF=class{constructor(){this.numberType=$T}drawShape(t,e,i,n,s){const r=FM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&vE(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=FM(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:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),FB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).richtext;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);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};ZF=qF([Xw()],ZF);var JF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let QF=class{constructor(){this.numberType=HT}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=FM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};QF=JF([Xw()],QF);var tz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ez=class extends bB{constructor(){super(...arguments),this.numberType=OT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=vE(p,g),v=xE(p,m),b=yE(c),x=_E(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=nT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(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 d=!1;if(r=Mt-St)e.moveTo(i+r*Et(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>St&&(e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*Et(p),_=r*Bt(p),v=a*Et(f),b=a*Bt(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>St)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Mt,!0,E.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),d=h>l;let u=!1;if(a<=St)e.moveTo(i,n,s);else if(c>=Mt-St)e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Et(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Et(c),f=a*Bt(c),m=a*Et(p),y=a*Bt(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};ez=tz([Xw()],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let nz=class extends bB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=UT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=vE(u,p),x=xE(u,f),S=yE(c),w=_E(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=nT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={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+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};nz=iz([Xw()],nz);var sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};rz=sz([Xw()],rz);let az=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};az=sz([Xw()],az);var oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};lz=oz([Xw()],lz);let hz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};hz=oz([Xw()],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};dz=cz([Xw()],dz);let uz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:CC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:CC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:CC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:CC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};uz=cz([Xw()],uz);var pz=new Vw((t=>{t(RF).toSelf(),t(EI).toService(RF),t(XF).toSelf(),t(cI).toService(XF),t(IF).toSelf(),t(TI).toService(IF),t($E).toSelf().inSingletonScope(),t(gI).to($E),t(fI).to($E),t(GI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(YI).toSelf().inSingletonScope(),t(BE).toService(GI),t(BE).toService(UI),t(BE).toService(YI),nA(t,BE),t(NB).toSelf().inSingletonScope(),t(bI).to(NB),t(fI).to(NB),t(KF).toSelf().inSingletonScope(),t(xI).toService(KF),t(fI).toService(xI),t(JI).toSelf().inSingletonScope(),t(QI).toSelf().inSingletonScope(),t(tD).toSelf().inSingletonScope(),t(eD).toSelf().inSingletonScope(),t(iD).toSelf().inSingletonScope(),t(FE).toService(JI),t(FE).toService(QI),t(FE).toService(tD),t(FE).toService(eD),t(FE).toService(iD),nA(t,FE),t(KB).toSelf().inSingletonScope(),t(wI).to(KB),t(fI).to(KB),nA(t,HE),t(LB).toSelf().inSingletonScope(),t(_I).to(LB),t(fI).to(LB),t(lz).toSelf().inSingletonScope(),t(hz).toSelf().inSingletonScope(),t(LE).toService(lz),t(LE).toService(hz),nA(t,LE),t(UB).toSelf().inSingletonScope(),t(SI).to(UB),t(fI).to(UB),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(aD).toSelf().inSingletonScope(),t(zE).toService(sD),t(zE).toService(rD),t(zE).toService(aD),nA(t,zE),t(GE).toSelf().inSingletonScope(),t(dI).to(GE),t(fI).to(GE),t(ez).toSelf().inSingletonScope(),t(uI).toService(ez),t(fI).toService(uI),t(jI).toSelf().inSingletonScope(),t(NI).toSelf().inSingletonScope(),t(VI).toSelf().inSingletonScope(),t(PE).toService(jI),t(PE).toService(NI),t(PE).toService(VI),nA(t,PE),t(AB).toSelf().inSingletonScope(),t(yI).to(AB),t(fI).to(AB),t(HF).toSelf().inSingletonScope(),t(NF).toSelf().inSingletonScope(),t(RB).toSelf().inSingletonScope(),t(pI).to(RB),t(fI).to(RB),t(dz).toSelf().inSingletonScope(),t(uz).toSelf().inSingletonScope(),t(RE).toService(dz),t(RE).toService(uz),nA(t,RE),t(FF).toSelf().inSingletonScope(),t(mI).to(FF),t(fI).to(FF),t($I).toSelf().inSingletonScope(),t(IE).toService($I),nA(t,IE),t(sI).toSelf().inSingletonScope(),t(vI).to(sI),t(fI).to(sI),t(rz).toSelf().inSingletonScope(),t(az).toSelf().inSingletonScope(),t(OE).toService(rz),t(OE).toService(az),nA(t,OE),t(QF).toSelf().inSingletonScope(),t(MI).toService(QF),t(fI).toService(MI),t(hI).toSelf().inSingletonScope(),t(CI).toService(hI),t(fI).toService(CI),t(qI).toSelf().inSingletonScope(),t(DE).toService(qI),nA(t,DE),t(ZF).toSelf().inSingletonScope(),t(AI).toService(ZF),t(fI).toService(AI),t(nz).toSelf().inSingletonScope(),t(kI).toService(nz),t(fI).toService(kI),t(FI).toSelf().inSingletonScope(),t(HE).toService(FI),t(PE).toService(FI),t(LE).toService(FI),t(zE).toService(FI),t(FE).toService(FI),t(DE).toService(FI),t(BE).toService(FI),t(RE).toService(FI),t(OE).toService(FI),nA(t,jE),nA(t,fI),t(MF).toSelf().inSingletonScope(),t(AF).toService(MF),t(CF).toSelf().inSingletonScope(),t(AF).toService(CF),nA(t,AF)}));var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mz=function(t,e){return function(i,n){e(i,n,t)}};let yz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};yz=gz([Xw(),mz(0,qw(gI)),fz("design:paramtypes",[Object])],yz);var _z=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bz=function(t,e){return function(i,n){e(i,n,t)}};const xz=new Wt;let Sz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=PI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;xz.setValue(i.x1,i.y1,i.x2,i.y2),xz.expand(-r/2),h=!xz.containsPoint(e)}}return n.highPerformanceRestore(),h}};Sz=_z([Xw(),bz(0,qw(bI)),vz("design:paramtypes",[Object])],Sz);var wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Az=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kz=function(t,e){return function(i,n){e(i,n,t)}};let Mz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Mz=wz([Xw(),kz(0,qw(dI)),Az("design:paramtypes",[Object])],Mz);var Cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ez=function(t,e){return function(i,n){e(i,n,t)}};let Pz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Pz=Cz([Xw(),Ez(0,qw(pI)),Tz("design:paramtypes",[Object])],Pz);var Rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Bz=class{constructor(){this.type="image",this.numberType=NT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Bz=Rz([Xw()],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dz=class extends bB{};Dz=Iz([Xw()],Dz);var Lz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fz=function(t,e){return function(i,n){e(i,n,t)}};let zz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};zz=Lz([Xw(),Fz(0,qw(yI)),Oz("design:paramtypes",[Object])],zz);var Hz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nz=function(t,e){return function(i,n){e(i,n,t)}};let Vz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Vz=Hz([Xw(),Nz(0,qw(_I)),jz("design:paramtypes",[Object])],Vz);var Wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Yz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=KT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=FM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Yz=Wz([Xw(),Uz(0,qw(SI)),Gz("design:paramtypes",[Object])],Yz);var Xz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kz=function(t,e){return function(i,n){e(i,n,t)}};let qz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=qT}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=FM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=QE(a,u,s),y=JE(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&UR.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};qz=Xz([Xw(),Kz(0,qw(wI)),$z("design:paramtypes",[Object])],qz);var Zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qz=function(t,e){return function(i,n){e(i,n,t)}};let tH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};tH=Zz([Xw(),Qz(0,qw(vI)),Jz("design:paramtypes",[Object])],tH);var eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let sH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=$T}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};sH=eH([Xw(),nH(0,qw(AI)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};lH=rH([Xw(),oH(0,qw(MI)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let uH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=XT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};uH=hH([Xw(),dH(0,qw(xI)),cH("design:paramtypes",[Object])],uH);var pH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let mH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mH=pH([Xw(),fH(0,qw(kI)),gH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let bH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=OT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};bH=yH([Xw(),vH(0,qw(uI)),_H("design:paramtypes",[Object])],bH);var xH=new Vw(((t,e,i,n)=>{t(yz).toSelf().inSingletonScope(),t(UD).toService(yz),t(nL).toService(UD),t(Sz).toSelf().inSingletonScope(),t(KD).toService(Sz),t(nL).toService(KD),t(uH).toSelf().inSingletonScope(),t(qD).toService(uH),t(nL).toService(qD),t(Mz).toSelf().inSingletonScope(),t(VD).toService(Mz),t(nL).toService(VD),t(Pz).toSelf().inSingletonScope(),t(GD).toService(Pz),t(nL).toService(GD),t(Bz).toSelf().inSingletonScope(),t(YD).toService(Bz),t(nL).toService(YD),t(zz).toSelf().inSingletonScope(),t(XD).toService(zz),t(nL).toService(XD),t(Vz).toSelf().inSingletonScope(),t($D).toService(Vz),t(nL).toService($D),t(Yz).toSelf().inSingletonScope(),t(ZD).toService(Yz),t(nL).toService(ZD),t(qz).toSelf().inSingletonScope(),t(JD).toService(qz),t(nL).toService(JD),t(tH).toSelf().inSingletonScope(),t(QD).toService(tH),t(nL).toService(QD),t(mH).toSelf().inSingletonScope(),t(tL).toService(mH),t(nL).toService(tL),t(bH).toSelf().inSingletonScope(),t(WD).toService(bH),t(nL).toService(WD),t(sH).toSelf().inSingletonScope(),t(eL).toService(sH),t(nL).toService(eL),t(lH).toSelf().inSingletonScope(),t(iL).toService(lH),t(nL).toService(iL),nA(t,nL)})),SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([Xw(),AH(0,qw(_I)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([Xw(),TH(0,qw(gI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BH=function(t,e){return function(i,n){e(i,n,t)}};const IH=new Wt;let DH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;IH.setValue(i.x1,i.y1,i.x2,i.y2),IH.expand(-r/2),h=!IH.containsPoint(e)}}return n.highPerformanceRestore(),h}};DH=PH([Xw(),BH(0,qw(bI)),RH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FH=function(t,e){return function(i,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};zH=LH([Xw(),FH(0,qw(dI)),OH("design:paramtypes",[Object])],zH);var HH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NH=function(t,e){return function(i,n){e(i,n,t)}};let VH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};VH=HH([Xw(),NH(0,qw(pI)),jH("design:paramtypes",[Object])],VH);var WH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let YH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};YH=WH([Xw(),UH(0,qw(yI)),GH("design:paramtypes",[Object])],YH);var XH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KH=function(t,e){return function(i,n){e(i,n,t)}};let qH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=KT}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=FM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qH=XH([Xw(),KH(0,qw(SI)),$H("design:paramtypes",[Object])],qH);var ZH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JH=class{constructor(){this.type="text",this.numberType=qT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};JH=ZH([Xw()],JH);var QH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ej=function(t,e){return function(i,n){e(i,n,t)}};let ij=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ij=QH([Xw(),ej(0,qw(vI)),tj("design:paramtypes",[Object])],ij);var nj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rj=function(t,e){return function(i,n){e(i,n,t)}};let aj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};aj=nj([Xw(),rj(0,qw(MI)),sj("design:paramtypes",[Object])],aj);var oj=new Vw((t=>{t(EH).toSelf().inSingletonScope(),t(aL).toService(EH),t(gL).toService(aL),t(DH).toSelf().inSingletonScope(),t(hL).toService(DH),t(gL).toService(hL),t(zH).toSelf().inSingletonScope(),t(sL).toService(zH),t(gL).toService(sL),t(VH).toSelf().inSingletonScope(),t(rL).toService(VH),t(gL).toService(rL),t(YH).toSelf().inSingletonScope(),t(oL).toService(YH),t(gL).toService(oL),t(kH).toSelf().inSingletonScope(),t(lL).toService(kH),t(gL).toService(lL),t(qH).toSelf().inSingletonScope(),t(cL).toService(qH),t(gL).toService(cL),t(JH).toSelf().inSingletonScope(),t(dL).toService(JH),t(gL).toService(dL),t(ij).toSelf().inSingletonScope(),t(uL).toService(ij),t(gL).toService(uL),t(aj).toSelf().inSingletonScope(),t(pL).toService(aj),t(aj).toService(pL),nA(t,gL)}));var lj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new ND(t))).whenTargetNamed(ND.env),t(Yk).toDynamicValue((()=>(t,e)=>new FD(t,e))).whenTargetNamed(FD.env)})),hj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new EO(t))).whenTargetNamed(EO.env),t(Yk).toDynamicValue((()=>(t,e)=>new kO(t,e))).whenTargetNamed(kO.env)})),cj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new vO(t))).whenTargetNamed(vO.env),t(Yk).toDynamicValue((()=>(t,e)=>new fO(t,e))).whenTargetNamed(fO.env)})),dj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new HO(t))).whenTargetNamed(HO.env),t(Yk).toDynamicValue((()=>(t,e)=>new LO(t,e))).whenTargetNamed(LO.env)})),uj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new aF(t))).whenTargetNamed(aF.env),t(Yk).toDynamicValue((()=>(t,e)=>new iF(t,e))).whenTargetNamed(iF.env)})),pj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new qO(t))).whenTargetNamed(qO.env),t(Yk).toDynamicValue((()=>(t,e)=>new YO(t,e))).whenTargetNamed(YO.env)}));Wk.load(mE),Wk.load(EL),Wk.load(uD),Wk.load(TL),Wk.load(OL),function(t){t.load(aO),t.load(uF),t.load(pF),t.load(SF)}(Wk),function(t){t.load(pz)}(Wk),function(t){t.load(xH),t.load(oj)}(Wk),function(t){t.load(lj),t.load(cj),t.load(hj),t.load(dj),t.load(uj),t.load(pj)}(Wk);const gj=Wk.get(oA);Gk.global=gj;const fj=Wk.get(gE);Gk.graphicUtil=fj;const mj=Wk.get(pE);Gk.transformUtil=mj;const yj=Wk.get(ZT);Gk.graphicService=yj,Wk.get(TD);const _j=Wk.get(fE);Gk.layerService=_j;class vj{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Gk.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Gk.graphicService.hooks.onAttributeUpdate.taps=Gk.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onSetStage.taps=Gk.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class bj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class xj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.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))})),Gk.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){Gk.graphicService.hooks.onAddIncremental.taps=Gk.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onClearIncremental.taps=Gk.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gk.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({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Sj=new Wt;class wj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Gk.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&&(Sj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Sj,t.parent&&t.parent.globalTransMatrix)))})),Gk.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))})),Gk.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Gk.graphicService.hooks.beforeUpdateAABBBounds.taps=Gk.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.afterUpdateAABBBounds.taps=Gk.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onRemove.taps=Gk.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Aj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===rC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=rC.INITIAL,Gk.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Gk.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:sC},{mode:"timeout",cons:nC},{mode:"manual",cons:iC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==rC.INITIAL&&(this.status=rC.PAUSE,!0)}resume(){return this.status!==rC.INITIAL&&(this.status=rC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===rC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===rC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=rC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=rC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Aj.addTimeline(oC),Aj.setFPS(60);class kj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=nT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=It(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=Rt(Pt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=f(e)?nT.get(e).value:e;const r=this.colorRgb;return nT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const Mj="white";class Cj extends tE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:Mj}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new LM,this.hooks={beforeRender:new rA(["stage"]),afterRender:new rA(["stage"])},this.global=Wk.get(oA),this.window=Wk.get(cE),this.renderService=Wk.get(cD),this.pickerService=Wk.get(wD),this.pluginService=Wk.get(RL),this.layerService=Wk.get(fE),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Wt,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Mj,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new ZM({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Aj,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new kj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new BD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new bj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new vj))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new xj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new wj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}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))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive"}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Ht(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Wk.get(cE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Tj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Tj||(Tj={}));const Ej="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Pj=Ej,Rj=14,Bj=18,Ij=4,Dj={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Rj}}},Lj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Oj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Rj,offset:12,position:"outside"}}},Fj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},zj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},Hj="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",jj={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:Hj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Hj,fill:"#ddd"}}},Nj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Vj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Wj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},Gj={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj}}},Uj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Yj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Xj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Rj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Rj}}},$j={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Rj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Rj,textBaseline:"middle",textAlign:"center"}}},Kj="__VCHART",qj=500,Zj=500,Jj=`${Kj}_LABEL_LIMIT`,Qj=`${Kj}_LABEL_ALIGN`,tN=`${Kj}_LABEL_TEXT`,eN=`${Kj}_LABEL_VISIBLE`,iN=`${Kj}_LABEL_X`,nN=`${Kj}_LABEL_Y`,sN=`${Kj}_ARC_RATIO`,rN=`${Kj}_ARC_START_ANGLE`,aN=`${Kj}_ARC_END_ANGLE`,oN=`${Kj}_ARC_K`,lN=`${Kj}_ARC_LABEL_HOVER_AX`,hN=`${Kj}_ARC_LABEL_HOVER_AY`,cN=`${Kj}_ARC_LABEL_POINT_AX`,dN=`${Kj}_ARC_LABEL_POINT_AY`,uN=`${Kj}_ARC_LABEL_POINT_BX`,pN=`${Kj}_ARC_LABEL_POINT_BY`,gN=`${Kj}_ARC_LABEL_POINT_CX`,fN=`${Kj}_ARC_LABEL_POINT_CY`,mN=`${Kj}_ARC_LABEL_SELECTED_AX`,yN=`${Kj}_ARC_LABEL_SELECTED_AY`,_N=`${Kj}_ARC_MIDDLE_ANGLE`,vN=`${Kj}_ARC_QUADRANT`,bN=`${Kj}_ARC_RADIAN`,xN=-Math.PI/2,SN=3*Math.PI/2,wN=-90,AN=270,kN=.6,MN={},CN=[],TN=(t,e,i)=>{MN[t]=Object.assign(e,{type:t}),i||CN.push(t)},EN=()=>{CN.slice().forEach((t=>{(t=>{delete MN[t];const e=CN.indexOf(t);e>=0&&CN.splice(e,1)})(t)}))};function PN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:f(t)?t:h(s=t)?null:s.fname})):null}function RN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function BN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const IN=":vGrammar_identifier:";function DN(t,e){return N(t).reduce(((t,i)=>{const n=f(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function LN(t,e){if(h(t))return[];if(!l(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(f(i))return N(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!l(t)&&!!(null==t?void 0:t.callback)}(t))return DN(t.dependency,e);var i;return[]}function ON(t){return l(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function FN(t,e,i,n){if(h(t))return t;if(l(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return f(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function zN(t,e){return HN(t)?t.output():e[t]}const HN=t=>t&&!h(t.grammarType),jN=t=>l(t)?t:e=>e[t],NN=t=>f(t)&&se.parseColorString(t)?t:null;function VN(t){return!!(null==t?void 0:t.scale)}function WN(t){return!!(null==t?void 0:t.field)}function GN(t,e){if(!t)return[];let i=[];return t.scale&&(i=HN(t.scale)?[t.scale]:N(e.getScaleById(t.scale))),i.concat(LN(t,e))}class UN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return f(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=N(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const YN={},XN=t=>YN[t],$N=(t,e,i,n,s)=>(YN[t]=new UN(e,i,n,s),YN[t]);function KN(t){return null===t?0:t}function qN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const ZN=["fillOpacity","x","y","dx","dy"],JN=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=KN(i.x),["x"]):"y"===e?(t.y=KN(i.y),["y"]):"dx"===e?(t.dx=KN(i.dx),["dx"]):"dy"===e?(t.dy=KN(i.dy),["dy"]):[]};var QN,tV,eV,iV,nV,sV,rV,aV,oV,lV,hV,cV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(QN||(QN={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(tV||(tV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(eV||(eV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(iV||(iV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(nV||(nV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(sV||(sV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(rV||(rV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(aV||(aV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(oV||(oV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(lV||(lV={})),function(t){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_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"}(hV||(hV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(cV||(cV={}));const dV={[tV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),b(e.length)||!b(e.z1)&&b(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):b(e.z1)||!b(e.length)&&b(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[tV.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[tV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return b(e)&&b(i)&&b(n)&&b(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[tV.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const uV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=f(t)?dV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(ZN.includes(r)?JN(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{ZN.includes(t)?JN(s,t,e):s[t]=e[t]}));return s},pV=(t,e,i)=>!(!h(t)||!h(e))||!h(t)&&!h(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(f(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function gV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case tV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case tV.group:case tV.rect:case tV.image:return["width","height","y1"].includes(e);case tV.path:case tV.shape:return["path","customPath"].includes(e);case tV.line:return"defined"===e;case tV.area:return["x1","y1","defined"].includes(e);case tV.rule:return["x1","y1"].includes(e);case tV.symbol:return"size"===e;case tV.polygon:return"points"===e;case tV.text:return"text"===e}return!1}function fV(t,e,i,n,s){i&&(ON(i)?e.forEach((e=>{const s=FN(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],c=s&&!gV(t.mark.markType,r)?[e[0]]:e;if(VN(l)){const t=zN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!h(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=f(null==l?void 0:l.field),d=s?ll(l.field):null;let u=s?null:h(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=v(u)||v(i)?u+e+i:u}))}else if(WN(l)){const t=ll(l.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=FN(l,n,e.datum,t)}))})))}function mV(t,e,i,n){if(!t)return null;if(ON(t))return FN(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const c=t[r];if(VN(c)){const t=zN(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!h(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=f(null==c?void 0:c.field),p=u?ll(c.field):null,g=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):h(null==c?void 0:c.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,c.value);s[r]=v(g)||v(d)?g+i+d:g}else if(WN(c)){const t=ll(c.field);s[r]=t(e)}else s[r]=FN(c,n,e,i)})),s}function yV(t){if(t)return t.type===Fl.Band?t.bandwidth():t.type===Fl.Point?t.step():void 0}const _V={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=l(i)?i:pl(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!h(s)){if(h(t))return;t[s]=e}return e})),e;const r=n(e,i);return h(s)||h(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=We.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=ll(a),c=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),d=h(t.default)?null:t.default,u=s.map((t=>ll(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),h(n)&&(n=o);const t=o.map((t=>ll(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],l=o.length;return(h(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=h(r)?d:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=PN(i,t.as||[]),s=i.map((t=>f(t)?ll(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Y(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],x=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),w=b(S*_)?S/_:null,A=b(_*_)?_/x:null;return d&&(y[d]=x),p&&(y[p]=S),r&&(y[r]=w),a&&(y[a]=0===i?1:A),o&&(y[o]=!0===g?w:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:S/v[1]),c&&(y[c]=0===i?1:x/v[1]),u&&(y[u]=_),y}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=RN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=BN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return BN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;h(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=h(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=h(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{h(n[IN])&&(n[IN]=0);let s=n[IN];const r=t.as;return e.forEach((t=>{t&&h(t[r])&&(s+=1,t[r]=s)})),n[IN]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=yV(a.y),l="y"===t.dodgeChannel||h(t.dodgeChannel)&&o>0?"y":"x",c="y"===l?o:yV(a.x);if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!h(t.dodgeBy)){const e=rl(N(t.dodgeBy));o=t=>e(t.getDatum())}const d=[];e.forEach((t=>{const e=o(t);d.includes(e)||d.push(e)}));const u=d.length;if(u<1)return e;const p=ml(a,c);let g=p>=c?c:c-p;const f=ml(i,g);let m=(g-Math.max(u-1,0)*f)/u;m>t.maxWidth?(g-=(m-t.maxWidth)*u,m=t.maxWidth):m{y[t]=-g/2+e*(m+f)}));const _=r.markType;"rect"===_||"interval"===_?e.forEach((t=>{const e=o(t),i=y[e],n=t.getItemAttribute();if("x"===l){const e={x:(h(n.width)&&!h(n.x1)?Math.min(n.x,n.x1):n.x)+(h(n.width)?h(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};h(n.width)?e.x1=e.x+m:e.width=m,t.setItemAttributes(e)}else if("y"===l){const e={y:(h(n.height)&&!h(n.y1)?Math.min(n.y,n.y1):n.y)+(h(n.height)?h(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};h(n.height)?e.y1=e.y+m:e.height=m,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=y[e];if("x"===l){const e=t.getItemAttribute("x")+c/2;t.setItemAttributes({x:e+i+m/2})}else if("y"===l){const e=t.getItemAttribute("y")+c/2;t.setItemAttributes({y:e+i+m/2})}}))}return e},markPhase:"afterEncodeItems"}},vV="__vgrammar_scene_item__",bV=[tV.line,tV.area],xV=[tV.arc3d,tV.rect3d,tV.pyramid3d],SV="key",wV=[{}],AV=["key"],kV="VGRAMMAR_IMMEDIATE_ANIMATION",MV=0,CV=1e3,TV=0,EV=!1,PV=!1,RV="quintInOut",BV={stopWhenStateChange:!1,immediatelyApply:!0},IV={},DV=t=>IV[t],LV=(t,e)=>{IV[t]={creator:e}};class OV extends tE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new pk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Ik.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new pk;let a,o;r.clear();const l=v(s)?s:Pt(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(hV.BEFORE_CREATE_VRENDER_MARK),e===tV.largeRects)return new OV(i);if(e===tV.largeSymbols)return new FV(i);const n=zV[e]?zV[e](i):DV(e)?DV(e).creator(i):null;return t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}function jV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(hV.BEFORE_CREATE_VRENDER_MARK);const n=new JP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=zV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}const NV=t=>{t&&(t[vV]=null,t.release(),t.parent&&t.parent.removeChild(t))};class VV{constructor(t){this.data=null,this.states=[],this.diffState=QN.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if(l(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));fV(this,o,a,this.mark.parameters());const h=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?uV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),h(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===QN.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(hV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=jN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(hV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=N(FN(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===QN.unChange&&(this.diffState=QN.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||this.useStates(this.states),this.mark.markType===tV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new pk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===QN.enter?(r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.update?(n&&r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.exit&&a&&fV(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=o(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=N(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&f(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=N(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=o(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)fl(n,i,t)&&E(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let c=null==l?void 0:l.nextAttrs;if(t&&t.length&&h(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||qN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[tV.line,tV.area,tV.largeRects,tV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===tV.line||e===tV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>qN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=KN(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=KN(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=KN(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=KN(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===tV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>pV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=uV(tV.line,t.attrs,i);return n.points=e.slice(t.startIndex,h(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?Object.assign(c,{segments:e,points:null}):Object.assign(c,{points:t,segments:null})}else p?Object.assign(c,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(c,{points:s,segments:null})}else e===tV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=KN(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=KN(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=KN(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=KN(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===tV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=KN(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=KN(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!M(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!h(e=C(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return C(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!E(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!E(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(NV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(NV(this.graphicItem),this.graphicItem[vV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?h(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):h(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?m(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const WV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(b(e.center.x)&&(s.x=e.center.x),b(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},GV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),UV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const YV=["visible","path","text","lineWidth","textBaseline","textAlign"],XV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:c+u/2,width:h(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:d+p/2,height:h(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:c+u/2,x1:c+u/2,y:d+p/2,y1:d+p/2,width:h(o)?void 0:0,height:h(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:h(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:h(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:h(n)?void 0:0,height:h(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:h(n)?void 0:0}}:{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:h(n)?void 0:0}}:{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:WV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:GV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:GV(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:UV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:UV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return YV.forEach((t=>{delete n[t],delete s[t]})),N(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{fl(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},$V=Object.assign({},XV),KV=t=>$V[t],qV=(t,e)=>{$V[t]=e},ZV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.from.min=l,m.to.min=d),b(u)&&(m.from.max=l,m.to.max=u),b(p)&&(m.from.q1=l,m.to.q1=p),b(g)&&(m.from.q3=l,m.to.q3=g),b(f)&&(m.from.median=l,m.to.median=f),m},JV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.to.min=l,m.from.min=d),b(u)&&(m.to.max=l,m.from.max=u),b(p)&&(m.to.q1=l,m.from.q1=p),b(g)&&(m.to.q3=l,m.from.q3=g),b(f)&&(m.to.median=l,m.from.median=g),m},QV=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(b(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return b(f)?f:b(_)&&b(v)?(_+v)/2:b(m)&&b(y)?(m+y)/2:b(y)?y:b(m)?m:NaN},tW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),b(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(b(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),b(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const eW=(t,e,i)=>{var n,s,r,a;if(b(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return b(o)?o:b(c)&&b(d)?(c+d)/2:b(l)&&b(h)?(l+h)/2:b(h)?h:b(l)?l:NaN},iW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),b(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(b(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),b(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const nW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},sW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},rW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sW:nW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function hW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(SV,i?t.slice().sort(i):t.slice()),{keys:AV,data:n};const s=jN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class cW{constructor(t,e,i){this.prevData=hW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const dW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const uW=(t,e,i,n,s)=>l(i)?i(t.getDatum(),t,s):i;class pW extends lC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class gW extends lC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{h(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}cC.mode|=TA.SET_ATTR_IMMEDIATELY;let fW=0;const mW=t=>!h(t)&&t.prototype instanceof lC;class yW{constructor(t,e,i){this.id=fW++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),b(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=l(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!KV(e.type))return null;const r=KV(e.type)(t,s,i);return dW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return m(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):d(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!h(null===(r=s[i])||void 0===r?void 0:r.from),l=!h(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?uW(t,0,s[i].from,0,n):void 0,e.to[i]=l?uW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),dW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),c=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=mW(o);return h(o)||mW(o)?u?new o(a.from,a.to,r,t.easing,c):a.to?new gW(a.from,a.to,r,t.easing):void 0:new pW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:c})})).filter((t=>!h(t)));1===e.length?t.play(e[0]):t.play(new OC(r,e))}}}function _W(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(vW(i,t[i]))})),e}function vW(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return N(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,c,d,u;if(h(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:MV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:PV,loop:null!==(n=l.loop)&&void 0!==n?n:EV,controlOptions:L({},BV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:CV,delay:null!==(a=l.delay)&&void 0!==a?a:TV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:RV,customParameters:l.customParameters,options:l.options}]}]}}const p=N(t.timeSlices).filter((t=>t.effects&&N(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:MV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:PV,loop:null!==(d=t.loop)&&void 0!==d?d:EV,controlOptions:L({},BV,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:TV,effects:N(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:RV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function bW(t,e,i){return l(t)?t.call(null,e.getDatum(),e,i):t}class xW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!h(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class SW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=_W(null!=e?e:{})}updateConfig(t){this.configs=_W(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==QN.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=vW(kV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return h(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=N(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===QN.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(h(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},o),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new yW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===QN.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(hV.ANIMATION_START,d),this.mark.emit(hV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=FN(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=bW(t.startTime,e,s),o=bW(t.totalTime,e,s),l=bW(t.oneByOne,e,s),h=bW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=bW(t.delay,e,s),l=null!==(i=bW(t.duration,e,s))&&void 0!==i?i:o/n,h=N(t.effects).map((t=>Object.assign({},t,{customParameters:bW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=v(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:v(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===QN.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===QN.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===kV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===QN.exit&&0===a[QN.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(hV.ANIMATION_END,h),this.mark.emit(hV.ELEMENT_ANIMATION_END,h,i)}}const wW=(t,e)=>HN(t)?t.output():t&&d(t)?l(t.callback)?i=>t.callback(i,e):l(t.value)?t.value(e):t:t,AW=(t,e)=>t?d(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=wW(s,e),i}),{}):t.map((t=>wW(t,e))):t;var kW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let MW=-1;class CW extends r{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=N(this.spec.dependency).map((t=>f(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=N(t).map((t=>f(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((i=>{var n;h(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return h(this.spec[e])||this.detach(LN(this.spec[e],this.view)),this.spec[e]=t,this.attach(LN(t,this.view)),this.commit(),this}}const TW=(t,e,i)=>{var n,s;if("callback"===t&&l(e))return{references:[],value:{callback:e,dependency:[]}};if(!h(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!h(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!h(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=LN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},EW=(t,e)=>{const i=(n=t.type,MN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(DN(a,e))));const o=((t,e,i)=>{if(h(e))return{value:e};if(m(e)){const n=e.map((e=>TW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return TW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},PW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=EW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class RW extends VV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if(l(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return fV(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?uV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=o(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===QN.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!h(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===QN.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=uV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{E(this.items[0].nextAttrs,e)||E(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=dV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{E(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===tV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return bV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&E(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),E(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),E(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)fl(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[vV]=null})),this.glyphGraphicItems=null),super.release()}}const BW=t=>t.markType===tV.glyph?new RW(t):new VV(t);function IW(t){return h(t.offsetX)?h(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function DW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return b(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),b(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&b(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&b(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const LW="window",OW="view",FW={trap:!1},zW="default",HW="width",jW="height",NW="viewWidth",VW="viewHeight",WW="padding",GW="viewBox",UW="autoFit";function YW(t,e,i,n,s){if(s===LW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{DW(t,IW(t),!1)}))}));const e=IW(t);DW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var XW=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 $W extends CW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new SW(this,{}),this.differ=new cW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=f(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=f(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!h(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===QN.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===lV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:wV,e);let n=i;i.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(hV.AFTER_MARK_ENCODE)}return this.emit(hV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(hV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>h(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return XW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,h(t)||(f(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return f(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];ON(i)?this.detach(GN(i,this.view)):f(e)?this.detach(GN(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(GN(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return f(e)?(this.spec.encode[t][e]=i,this.attach(GN(i,this.view))):ON(e)?(this.spec.encode[t]=e,this.attach(GN(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(GN(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=PW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{h(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{h(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return bV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!h(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===QN.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];ON(s)||Object.keys(s).forEach((t=>{VN(s[t])&&(e[t]=zN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV];if((null==n?void 0:n.mark)===this){const i=YW(this.view,t,n,e,OW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new SW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=zN(this.spec.group,e);this.group=t,t&&(this.emit(hV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(hV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==tV.group){if(!this.graphicItem){const t=HV(this,tV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||xV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==tV.group?(h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=jN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>SV),a=jN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>SV),o=this.spec.sort,l=this.spec.groupSort,c=this.isCollectionMark(),d=new Set(this.elements.filter((t=>t.diffState===QN.enter))),u=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(h(e))s=this.elementMap.get(n),s&&(s.diffState=QN.exit);else if(h(i)){s=this.elementMap.has(n)?this.elementMap.get(n):BW(this),s.diffState===QN.exit&&(s.diffState=QN.enter,this.animate.getElementAnimators(s,QN.exit).forEach((t=>t.stop("start")))),s.diffState=QN.enter;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),u.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=QN.update;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),u.push(s)}d.delete(s)}));const p=null!=t?t:wV;this.differ.setCurrentData(hW(p,c?a:t=>`${a(t)}-${r(t)}`,c?l:void 0)),this.differ.doDiff(),d.forEach((t=>{this.elementMap.delete(c?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=u,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:HV(this,this.markType,t);if(this.emit(hV.BEFORE_ADD_VRENDER_MARK),this.markType===tV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(hV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==tV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=hW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=jN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>SV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=BW(this);e.diffState=QN.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=BW(this);i.diffState=QN.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(ON(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===tV.glyph&&XN(i)){const t=XN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>gV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{gV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(gV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(hV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(hV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(hV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||AV).forEach((t=>{const e=HV(this,tV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(hV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==QN.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return dV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=QN.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&NV(this.graphicItem),this.detachAll(),super.release()}}class KW extends $W{constructor(t,e,i){super(t,tV.component,i),this._componentDatum={[SV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:DV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,SV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[SV]+=1}evaluateJoin(t){return this.spec.key=SV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=f(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=f(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const qW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class ZW extends tE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){p(this.attribute[t])?L(this.attribute[t],e):this.attribute[t]=e,qW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>qW.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){h(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ct(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ct(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onSliderPointerMove),gj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onSliderPointerMove),gj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=dt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ge(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]=Ge(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new UM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function QW(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&QW(t,e)}))}JW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const tG=t=>!h(t)&&!1!==t.visible,eG=["#ffffff","#000000"];function iG(t,e,i,n,s){const r=aG(t),a=aG(e);return nG(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...eG);for(const s of r)if(t!==s&&nG(s,e,i,n))return s}(r,a,i,n,s)}function nG(t,e,i,n){return n?sG(t,e)>n:"largeText"===i?sG(t,e)>3:sG(t,e)>4.5}function sG(t,e){const i=rG(t),n=rG(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function rG(t){const e=ae(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 aG(t){if(null==t?void 0:t.includes("#"))return t;const e=new se(t),{r:i,g:n,b:s}=e.color;return"#"+oe(i,n,s)}function oG(t,e){return[t[0]*e,t[1]*e]}function lG(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const hG=-.5*Math.PI,cG=1.5*Math.PI,dG="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var uG;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uG||(uG={}));const pG={[uG.selectedReverse]:{},[uG.selected]:{},[uG.hover]:{},[uG.hoverReverse]:{}},gG=(t,e,i)=>new He(Object.assign({defaultFontParams:{fontFamily:dG,fontSize:11},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function fG(t,e){var i,n;if(!t)return{width:0,height:0};const s=_B({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var mG=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);sl&&(y=l,k.setAttribute("maxLineWidth",l-g[1]-g[2])));let D=0,L=0;"center"===B?(D-=y/2,m&&m.setAttribute("x",(m.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===B||"end"===B?(D-=y,m&&m.setAttribute("x",(m.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==B&&"start"!==B||f.setAttribute("x",g[3]),"middle"===I?(L-=_/2,m&&m.setAttribute("y",0)):"bottom"===I?(L-=_,m&&m.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===I&&(f.setAttribute("y",g[0]),m&&m.setAttribute("y",E/2));const{visible:O}=s,F=mG(s,["visible"]);if(u&&o(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:O&&!!e,x:D,y:L,width:y,height:_}),"rect");M(null==p?void 0:p.panel)||(t.states=p.panel)}}}yG.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var _G=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);sf?H=f:Hde&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>ge&&deme&&pece&&feue&&ye=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wG=class{render(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;this.poptipComponent||(this.poptipComponent=new vG(t.attribute.poptip));let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};g=n,L(e,xG.poptip,g),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const s=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:s.e,y:s.f}));const r=h.stage.getLayer("_builtin_interactive");r&&r.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wG=SG([Xw()],wG);var AG=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kG=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kG=AG([Xw()],kG);let MG=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MG=AG([Xw()],MG);const CG=new Vw((t=>{t(wG).toSelf().inSingletonScope(),t(jE).toService(wG),t(kG).toSelf().inSingletonScope(),t(PL).toService(kG),t(MG).toSelf().inSingletonScope(),t(PL).toService(MG)}));class TG extends ZW{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EG extends TG{constructor(t){super(L({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PG extends TG{constructor(t){super(L({},PG.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})}}PG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RG extends TG{constructor(t){super(L({},RG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}RG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class BG extends TG{constructor(t){super(L({},BG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=hG,endAngle:n=cG}=this.attribute,s=n-i,r=Ut(Kt(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}BG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class IG extends TG{constructor(t){super(L({},IG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=$t(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}IG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const DG=new Uint32Array(33),LG=new Uint32Array(33);LG[0]=0,DG[0]=~LG[0];for(let t=1;t<=32;++t)LG[t]=LG[t-1]<<1|1,DG[t]=~LG[t];function OG(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.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:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&DG[31&n]&LG[1+(31&s)])return!0}else{if(i[r]&DG[31&n])return!0;if(i[a]&LG[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,DG[31&i]&LG[1+(31&s)]);else for(n(r,DG[31&i]),n(a,LG[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,LG[31&i]|DG[1+(31&n)]);else for(s(r,LG[31&i]),s(a,DG[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FG(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function zG(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=FG(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function HG(t,e){return!(!t||!e)&&e.encloses(t)}function jG(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return jG(t,e,s,h,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return jG(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}if("moveX"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return jG(t,e,s,r,null===(c=n.overlap)||void 0===c?void 0:c.clampForce)}return!1}const VG=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],WG=["top","inside-top","inside"];const GG={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UG(t,e){var i,n;return null!==(n=null===(i=GG[e])||void 0===i?void 0:i.call(GG,t))&&void 0!==n?n:{from:{},to:{}}}const YG="same-time",XG=300,$G="linear";class KG extends ZW{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||M(e.states)||(e.addState(uG.hover,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this,(t=>{M(t.states)||(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void QW(this,(t=>{M(t.states)||(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));M(e.states)||(e.addState(uG.selected,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!M(e)&&(t.states=e)}_createLabelText(t){const e=dB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if(l(s)&&(s=s({})),!s||0===s.length)return[];let r=[];l(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],h=this.getBaseMarkGroup(),c=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==h?void 0:h.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==h?void 0:h.AABBBounds.height())&&void 0!==s?s:0};if(0===c.width||0===c.height)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:p=!0,clampForce:g=!0}=e,f=this._bmpTool||OG(c.width,c.height),m=this._bitmap||f.bitmap(),y=u.some((t=>"bound"===t.type));d&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&m.setRange(FG(f,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:YG,h=null!==(n=a.duration)&&void 0!==n?n:XG,c=null!==(s=a.easing)&&void 0!==s?s:$G,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=UG(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&b(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new TC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(UG(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==MA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===MA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=iG(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=iG(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=iG(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class qG extends KG{constructor(t){super(L({},qG.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZG extends KG{constructor(t){super(L({},ZG.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}ZG.tag="rect-label",ZG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const JG={rect:ZG,symbol:qG};class QG extends ZW{constructor(t){super(L({},QG.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!b(n*i))return;this._componentMap||(this._componentMap=new Map);const s=OG(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function tU(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 eU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=jt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function iU(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=tU(t,!!s),o=tU(r,!!s);const h=jt.distancePP(n,l),c=jt.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=eU(e,t,!1,!!s),o=eU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=tU(t,!!s),o=tU(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}QG.defaultAttributes={pickable:!1};class nU extends ZW{constructor(t){super(L({},nU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!M(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let h="";if("line"===t||"polygon"===t)h=tU(o,!!n);else if("circle"===t){const{center:t}=this.attribute;h=eU(t,o,!1,!!n)}const c=lB(Object.assign({path:h,z:r},l(i)?L({},nU.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;o.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=tU(o,!!n),g=Ct(o[0].x-o[1].x),f=Ct(o[0].y-o[1].y),m=lB(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*wt/2:0,beta:gf?[o[0].x,0]:[0,o[0].y]},l(i)?L({},nU.defaultAttributes.style,i(t,e)):i));m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${s}`),this.add(m)})),e.length>1&&s)){const t=m(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=oB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),M(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=uB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),M(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var rU,aU;sU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(rU||(rU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(aU||(aU={}));const oU={[aU.selectedReverse]:{},[aU.selected]:{},[aU.hover]:{},[aU.hoverReverse]:{}},lU={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var hU=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.name&&!M(e.states)&&(e.addState(uG.hover,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(uG.selected))return this._lastSelect=null,void QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));e.name&&!M(e.states)&&(e.addState(uG.selected,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);L(this.attribute,t);const i=aB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=aB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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,grid:r,items:a,panel:o}=this.attribute,l=aB({x:0,y:0,zIndex:1});if(l.name=rU.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=aB({x:0,y:0,pickable:!1});t.name=rU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=hB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=rU.background,e.id=this._getNodeId("background"),M(o.state)||(e.states=L({},pG,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){const e=this.getTickLineItems(),i=aB({x:0,y:0,pickable:!1});i.name=rU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=oB(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=rU.tick,r.id=this._getNodeId(t.id),M(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=null;else{const t=this.data[n],e=L({},pG,this.attribute.tick.state);Object.keys(e).forEach((i=>{l(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(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=oB(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=rU.subTick,r.id=this._getNodeId(`${s}`),M(n.state))r.states=null;else{const i=L({},pG,n.state);Object.keys(i).forEach((n=>{l(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&&l(n)&&(e=n(e,i));const s=this._transformItems(e),r=aB({x:0,y:0,pickable:!1});r.name=`${rU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,o=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=dB(u);if(p.name=rU.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),M(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=null;else{const n=L({},pG,this.attribute.label.state);Object.keys(n).forEach((r=>{l(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),o=Math.max(o,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),o=Math.abs(o*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new yG(Object.assign({},e));i.name=rU.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return rt(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&l(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=wt/2*(l.x>e.x?1:-1):h=wt/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===_[1]?m+=(this.axisLabelLayerSize[n-1].height+C(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+C(this.attribute,"label.space",4))*n);const v=this.getVerticalCoord(t.point,m,p),b=this.getVerticalVector(m,p,v),x=g?g(t.label,t,e,i,n):t.label;let{style:S}=f;return S=l(S)?L({},lU.label.style,S(t,e,i,n)):S,S=L({textAlign:this.getTextAlign(b),textBaseline:this.getTextBaseline(b,p)},S),l(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},v),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new nU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${rU.grid}-sub`:`${rU.grid}`,n.id=this._getNodeId(t),e.add(n)}}const dU={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&&uU(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function uU(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function pU(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function fU(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ce(t,i),r=Ce(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Me(t),l=Me(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:ke(t.angle);let f=i?t.angle+At:ke(90-t.angle);const m=i?e.angle:ke(e.angle);let y=i?e.angle+At:ke(90-e.angle);f>Mt&&(f-=Mt),y>Mt&&(y-=Mt);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(we(s,i)+we(s,n))/2>we(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function mU(t,e){"bottom"!==t&&"top"!==t||function(t,e){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"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var yU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return oG([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:m}=l,y=yU(l,["position","space","textStyle","autoRotate","shape","background","state"]);let _=.5;"start"===c?_=0:"end"===c&&(_=1);const{verticalFactor:v=1}=this.attribute,b=-1*v,x=this.getTickCoord(_),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+C(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,T=this.getVerticalCoord(x,k,!1),E=this.getVerticalVector(k,!1);let P,R,{angle:B}=y;if(P="start"===c?"start":"end"===c?"end":"center",h(B)&&p){B=lG(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else P=this.getTextAlign(E),R=this.getTextBaseline(E,!1);const I=Object.assign(Object.assign(Object.assign({},T),y),{textStyle:Object.assign({textAlign:P,textBaseline:R},u),state:M(m)?null:{text:m.text,shape:m.shape,panel:m.background}});return I.angle=B,g&&g.visible&&(I.shape=Object.assign({visible:!0},g.style),g.space&&(I.space=g.space)),f&&f.visible&&(I.panel=Object.assign({visible:!0},f.style)),I}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=hG,endAngle:r=cG}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(M(t))return;const{verticalLimitSize:o,label:c,title:d,line:u,tick:p,orient:g}=this.attribute,f=null!==(s=c.space)&&void 0!==s?s:4;let m=o,y=0,_=0;const v=(null==u?void 0:u.visible)?null!==(r=u.style.lineWidth)&&void 0!==r?r:1:0,x=(null==p?void 0:p.visible)?null!==(a=p.length)&&void 0!==a?a:4:0;(null==d?void 0:d.visible)&&(y=fG(d.text,d.textStyle).height,_=d.space),m&&(m=(m-f-_-y-v-x)/n);const{layoutFunc:S,autoRotate:w,autoRotateAngle:A,autoLimit:k,limitEllipsis:C,autoHide:T,autoHideMethod:E,autoHideSeparation:P}=c;l(S)?S(t,e,i,this):(w&&function(t,e){if(M(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Gt(e)})),mU(i,t),!fU(t))break}}(t,{labelRotateAngle:A,orient:g}),k&&b(m)&&m>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!M(t)&&b(i)&&t.forEach((t=>{const e=0===t.attribute.angle||h(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:m,ellipsis:C,orient:g}),T&&function(t,e){if(M(t))return;const i=t.filter(gU);if(M(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=l(s)?s:dU[s]||dU.parity;if(n.length>=3&&pU(n,r)){do{n=a(n,r)}while(n.length>=3&&pU(n,r));n.length<3&&!V(i).attribute.opacity&&(n.length>1&&V(n).setAttribute("opacity",0),V(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:g,method:E,separation:P}))}}_U.defaultAttributes=lU;var vU,bU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=rB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=rU.line,c.id=this._getNodeId("line"),M(null==a?void 0:a.state)||(c.states=L({},oU,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=hG,endAngle:i=cG}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=hG,endAngle:i=cG,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return $t(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return oG(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:m,state:y}=u,_=bU(u,["space","textStyle","shape","background","state"]);let v=l,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=C(this.attribute.label,"style.fontSize",12)+C(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;h(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",v={x:l.x,y:l.y-S}):"end"===A&&(w="top",v={x:l.x,y:l.y+S});const k=Object.assign(Object.assign(Object.assign({},v),_),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:M(y)?null:{text:y.text,shape:y.shape,panel:y.background}}),{angle:T}=_;return k.angle=T,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}xU.defaultAttributes=lU;class SU extends lC{constructor(){super(...arguments),this.mode=TA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return QW(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},QW(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=b(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=_t.lastIndex=vt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=_t.exec(t))&&(n=vt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=vt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=vU.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=vU.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=vU.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===vU.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===vU.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=vU.endHandler):this.state.start=this.state.start+o:this._activeTag===vU.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===gj.env&&(gj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),gj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===vU.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ct(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ct(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=AU(t,["formatMethod"]),{formatMethod:s}=e,r=AU(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const m=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,y=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(m+y)/2,f={x:f.x+m/2,y:f.y}):(g-=(m+y)/2,f={x:f.x,y:f.y+m})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+P*I,y:B.y,width:(R-P)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+P*D,width:I,height:(R-P)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+P*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(P+R)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+P*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(P+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i}=this.attribute,{start:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new yG(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;c(t)&&c(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...N(a))}setUpdateStateCallback(t){l(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){l(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){l(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){l(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){l(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){l(t)&&(this._statePointToData=t)}};var MU,CU,TU;kU.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(MU||(MU={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(CU||(CU={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(TU||(TU={}));class EU extends ZW{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=aB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const PU={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:MU.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]}},RU={start:{textAlign:"right",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:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},BU={label:{position:CU.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}},IU={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"}},DU={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"}};let LU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},RU[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new sU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new yG(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};LU.defaultAttributes=PU;let OU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},IU[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=gB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new yG(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};OU.defaultAttributes=BU;let FU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=TU.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},DU[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=uB(Object.assign(Object.assign({},e),n)):"text"===i?o=new yG(Object.assign({},e)):"richText"===i?o=fB(Object.assign(Object.assign({},e),s)):"image"===i?o=pB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new sU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=oB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};FU.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const zU={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class HU extends ZW{getCurrent(){return this._current}constructor(t){super(L({},HU.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new UM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new UM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.hasState(WU.selected)?this._setLegendItemState(t,WU.selectedHover):this._setLegendItemState(t,WU.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(GU.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(GU.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=a.delegate;if(a.name===UU.focus){const e=t.hasState(WU.focus);t.toggleState(WU.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover,WU.focus]),this._setLegendItemState(t,WU.selected)})):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover,WU.focus]),this._setLegendItemState(e,WU.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(WU.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(WU.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(GU.legendItemClick,t);n?(this._removeLegendItemState(t,[WU.selected,WU.selectedHover]),this._setLegendItemState(t,WU.unSelected)):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]))}else this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}this._dispatchEvent(GU.legendItemClick,t)}}}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,WU.selected),this._removeLegendItemState(e,[WU.unSelected,WU.unSelectedHover])):(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||M(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=aB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=jU,spaceRow:f=NU,maxWidth:m,width:y,height:_}=t;c(m)?c(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:c(y)&&(this._itemWidthByUser=y),c(_)&&(this._itemHeightByUser=_);let v=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!M(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,c(l)&&(o>=l?(v=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,c(h)&&h0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;v&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:l=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:m={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),m=this._handleStyle(m,t,e,i,n);const y=Ge(l);let _;!1===m.visible?(_=aB({x:0,y:0,cursor:(null==m?void 0:m.style).cursor}),this._appendDataToShape(_,UU.item,t,_)):(_=aB(Object.assign({x:0,y:0},null==m?void 0:m.style)),this._appendDataToShape(_,UU.item,t,_,null==m?void 0:m.state)),_.addState(e?WU.selected:WU.unSelected);const v=aB({x:0,y:0,pickable:!1});_.add(v);let b=0;const x=C(p,"style.size",10),S=C(p,"space",8),w=uB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&h(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&h(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,UU.itemShape,t,_,null==p?void 0:p.state),w.addState(e?WU.selected:WU.unSelected),v.add(w);let k=0;if(d){const e=C(u,"size",10);A=uB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:y})),this._appendDataToShape(A,UU.focus,t,_),k=e}const M=dB(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,UU.itemLabel,t,_,null==g?void 0:g.state),M.addState(e?WU.selected:WU.unSelected),v.add(M);const T=C(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+T,c(a)){const n=C(f,"space",d?8:0),s=dB(Object.assign(Object.assign({x:b+T,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));this._appendDataToShape(s,UU.itemValue,t,_,null==f?void 0:f.state),s.addState(e?WU.selected:WU.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-M.AABBBounds.width()-T-k-n),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-y[1]-y[3]-k-n})),b=s.AABBBounds.x2+n,v.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-k);A&&(A.setAttribute("x",b),v.add(A));const E=v.AABBBounds,P=E.width(),R=E.height(),B=this._itemWidthByUser||P+y[1]+y[3],I=this._itemHeightByUser||R+y[0]+y[2];return _.attribute.width=B,_.attribute.height=I,v.translateTo(-E.x1+y[3],-E.y1+y[0]),_}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=jU,spaceRow:h=NU}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=VU}=o,f=XU(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new HU(Object.assign({layout:1===r?"horizontal":"vertical",total:99},L({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new HU(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=aB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(WU.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=L({},$U,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new UM(t,{item:e,data:e.data,selected:e.hasState(WU.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=L({},t);return t.style&&l(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&l(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var qU;function ZU(t){return m(t)?t:[t,t]}function JU(t){return t?"ew-resize":"ns-resize"}KU.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:jU,spaceRow:NU,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:VU,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"}(qU||(qU={}));let QU=class t extends ZW{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(L({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onHandlerPointerMove),gj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ct(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===gj.env)gj.removeEventListener("pointermove",this._onHandlerPointerMove),gj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onTrackPointerMove),gj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ct(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ct(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onTrackPointerMove),gj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,d;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,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(c(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=N(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;h(u)&&(u=[o,l]),this._currentValue={startValue:ZU(u)[0],endValue:ZU(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=aB({x:0,y:0});g.name=qU.innerView,this.add(g),this._innerView=g;let f,m=0;if(r&&r.visible){f=dB(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=qU.startText,g.add(f);const e=c(r.space)?r.space:0;m+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const y=aB({x:p?m:0,y:p?0:m});g.add(y);const _=aB({x:0,y:0});let v;if(_.name=qU.railContainer,this._railContainer=_,y.add(_),this._renderRail(_),m+=p?n:s,a&&a.visible){const t=c(a.space)?a.space:0;v=dB(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),v.name=qU.endText,g.add(v)}this._renderTrack(_),d&&(this._renderHandlers(y),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=hB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=qU.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:c}=this.attribute;let{value:d}=this.attribute;h(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?l:o,[f,m]=ZU(d),y=(f-i)/(n-i)*g,_=this._renderHandler(Object.assign({x:p?y:l/2,y:p?o/2:y,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(_.name=qU.startHandler,this._startHandler=_,t.add(_),this._currentValue.startPos=y,u){const e=this._renderHandlerText(f);e.name=qU.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(m-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(a.name=qU.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(m);e.name=qU.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:c}=this.attribute;h(c)&&(c=[i,n]);const u=this._isHorizontal,p=u?r:s;let[g,f]=ZU(c);e||(g=i);const m=aB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=qU.trackContainer;const y=d(e)&&!0===e.draggableTrack;let _;_=!1===l?"default":!1===e||!1===y?"pointer":JU(u);const v=(f-g)/(n-i)*p,b=hB(Object.assign({x:u?(g-i)/(n-i)*p:0,y:u?0:(g-i)/(n-i)*p,width:u?v:r,height:u?s:v,cursor:_},a));b.name=qU.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return uB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":JU(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),dB(f)}_bindEvents(){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),d(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===qU.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===qU.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===qU.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===qU.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new UM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};QU.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},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}}};class tY extends YU{constructor(t){super(L({},tY.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,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:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function eY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}tY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class iY extends YU{constructor(t){super(L({},iY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,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:y,sizeBackground:_}=this.attribute,v=aB({x:0,y:0});this._innerView.add(v);const b=new QU({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:eY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=lB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}iY.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)"}};let nY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,P,R,B,I,D,L,O,F,z,H,j,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:mt,minHeight:yt,maxHeight:_t,align:vt,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ge(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&c(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else c(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(h=null==ct?void 0:ct.maxLineWidth)&&void 0!==h?h:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&c(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(m=ut.y)&&void 0!==m?m:At,width:null!==(_=null!==(y=ut.width)&&void 0!==y?y:pt)&&void 0!==_?_:0,height:null!==(b=null!==(v=ut.height)&&void 0!==v?v:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else c(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(c(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),c(gt)&&(Et=gt),c(ft)&&Ttmt&&(Tt=mt)),c(yt)&&Et_t&&(Et=_t)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],c(vt)||c(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:vt,e=null!==(O=null==ct?void 0:ct.width)&&void 0!==O?O:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","left")):"center"===t?(null===(H=this._mainTitle)||void 0===H||H.setAttribute("x",e/2),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(c(vt)||c(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:vt,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};nY.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 sY={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"}}};let rY=class extends ZW{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(c(i))if(!1!==i.visible){const t=L({},C(sY,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:c(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&b(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&b(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(c(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=N(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=L({},C(sY,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:c(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&b(a)&&this._setAutoFit(a,d,e),e.autoLimit&&b(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;h+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=fG(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",c(i.style.lineHeight)?i.style.lineHeight:s)}}};class aY extends UP{constructor(t){super(t)}}var oY,lY;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oY||(oY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lY||(lY={}));class hY extends ZW{constructor(t){super(L({},hY.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style: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"},hY.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style: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"},hY.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{h(this._playController)&&(this._playController=new aY(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{h(this._backwardController)&&(this._backwardController=new aY(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{h(this._forwardController)&&(this._forwardController=new aY(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new UM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(oY.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(oY.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(oY.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(oY.OnBackward);this.dispatchEvent(t)},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()}}hY.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hY.defaultAttributes={visible:!0,[lY.Start]:{},[lY.Pause]:{},[lY.Backward]:{},[lY.Forward]:{}};const cY={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dY=[200,10];var uY,pY;!function(t){t.Default="default",t.Reverse="reverse"}(uY||(uY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(pY||(pY={}));const gY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},fY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},mY=t=>"top"===t||"bottom"===t;class yY extends ZW{constructor(t){super(L({},yY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;b(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Pt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:b(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(mY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:dY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:dY[1];s.layout="vertical",s.railWidth=e,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 QU(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return mY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},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 hY(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=mY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=v(i)?i:Pt(i[0],i[1]);return t+e.space+n}),0),l=(mY(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,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new UM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}yY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},cY),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cY),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cY),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cY),{key:"backward",position:"start"})}};class _Y extends yY{constructor(t){super(L({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:uY.Default,this._dataIndex=h(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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(pY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=gj.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(pY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(pY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=gj.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(),gj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var vY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class bY extends yY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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,n=i/this._maxIndex;this._elapsed=n*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(pY.OnChange))},this.play=()=>vY(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(pY.OnPlay),this._rafId=gj.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=gj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},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(pY.OnBackward)},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(pY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const xY={debounce:gt,throttle:ft};let SY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",xY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=gB(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return L(t,...i,{shape:s.every(h)?void 0:L({},...s),key:r.every(h)?void 0:L({},...r),value:a.every(h)?void 0:L({},...a)})},AY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},kY={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:dG,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Wt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},MY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let CY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=Ge(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",L({symbolType:"circle"},d.shape,{visible:tG(d)&&tG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:tG(d)&&tG(d.value)},AY(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:tG(d)&&tG(d.value)},d.value),"text");const u=tG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-h[3]-h[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const m=tG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+m);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!tG(l))return;const h=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let u=0;if(tG(l.shape)&&d.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),tG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},AY(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(tG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},AY(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";c(l.value.textAlign)?e=l.value.textAlign:tG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>MY.includes(t)))?(this._mergeAttributes(e,n),h(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&tG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=tG(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=gG(u),v=gG(p);let b=0;if(tG(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(tG(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&WP[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return wY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};CY.defaultAttributes=kY;const TY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class EY extends KW{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=f(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}LV(nV.lineAxis,((t,e)=>new _U(t,e))),LV(nV.circleAxis,(t=>new xU(t)));class PY extends EY{constructor(t,e,i){super(t,eV.axis,e),this.spec.componentType=eV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=L({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=DV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=mV(s,e,i,n);const c=FN(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=FN(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=FN(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case nV.lineAxis:return((t,e,i)=>{var n,s;const r=TY.axis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p);case nV.circleAxis:return((t,e,i)=>{var n,s;const r=TY.circleAxis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(h(e)){const i=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?nV.circleAxis:nV.lineAxis,this._axisComponentType}}LV(sV.discreteLegend,(t=>new KU(t))),LV(sV.colorLegend,(t=>new tY(t))),LV(sV.sizeLegend,(t=>new iY(t)));class RY extends EY{constructor(t,e){super(t,eV.legend,e),this.spec.componentType=eV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==sV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":GU.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=f(t)?this.view.getDataById(t):t,l=f(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,iV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=DV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=mV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case sV.discreteLegend:return((t,e)=>{const i=TY.discreteLegend;return t?L({},i,{items:Array.from(new Set(N(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=NN(n),r=s?Object.assign(Object.assign({},TY.discreteLegend.items[0].shape),{fill:s,stroke:s}):TY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):L({},i,null!=e?e:{})})(o,a);case sV.colorLegend:return((t,e)=>{const i=TY.colorLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{colors:t.range().slice(),min:n[0],max:V(n)},null!=e?e:{})})(o,a);case sV.sizeLegend:return((t,e)=>{const i=TY.sizeLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&zl(i)){const t=e.getScale().range();NN(null==t?void 0:t[0])?this._legendComponentType=sV.colorLegend:this._legendComponentType=sV.sizeLegend}else this._legendComponentType=sV.discreteLegend}return this._legendComponentType}}LV(rV.lineCrosshair,(t=>new EG(t))),LV(rV.rectCrosshair,(t=>new PG(t))),LV(rV.sectorCrosshair,(t=>new BG(t))),LV(rV.circleCrosshair,(t=>new RG(t))),LV(rV.polygonCrosshair,(t=>new IG(t)));const BY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(jl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Yt(Kt(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else zl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Kt(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class IY extends EY{constructor(t,e){super(t,eV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case rV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return L({},l,BY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case rV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=BY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=L({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case rV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(jl(e.type)){const i=Yt(Kt(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else zl(e.type)&&(f=Kt(u,t));return L({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=TY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(jl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else zl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return L({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(jl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else zl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return L({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=DV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?rV.sectorCrosshair:rV.rectCrosshair:"radius"===n?rV.circleCrosshair:"radius-polygon"===n?rV.polygonCrosshair:rV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}LV(eV.slider,(t=>new QU(t)));class DY extends KW{constructor(t,e){super(t,eV.slider,e),this.spec.componentType=eV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=f(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=f(t)?this.view.getDataById(t):t,a=f(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,iV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>L({},TY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(h(this.spec.min)?0:FN(this.spec.min,i,t,e),h(this.spec.max)?1:FN(this.spec.max,i,t,e),mV(n,t,e,i))}),e}),{});this._encoders=e}}LV(eV.label,(t=>new QG(t)));let LY=class extends KW{constructor(t,e){super(t,eV.label,e),this.spec.componentType=eV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=FN(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=TY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case tV.line:r=TY.lineLabel;break;case tV.rect:r=TY.rectLabel;break;case tV.symbol:r=TY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[vV],n=mV(i,e.getDatum(),e,s),o=L({},r.data[0],n);a.push(o)}}));const o=FN(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return L({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!h(t)));return L({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};LV(eV.datazoom,(t=>new kU(t)));class OY extends KW{constructor(t,e){super(t,eV.datazoom,e),this.spec.componentType=eV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!h(this.spec.preview)){const t=this.spec.preview.data,e=f(t)?this.view.getDataById(t):t;this.detach(e),this.detach(GN(this.spec.preview.x,this.view)),this.detach(GN(this.spec.preview.y,this.view)),this.detach(GN(this.spec.preview.x1,this.view)),this.detach(GN(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=f(t)?this.view.getDataById(t):t;this.attach(r),this.attach(GN(e,this.view)),this.attach(GN(i,this.view)),this.attach(GN(n,this.view)),this.attach(GN(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t,c=f(e)?(t,i)=>{if(h(i.start)||h(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,iV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},TY.datazoom,t),n=DV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=f(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=mV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=TY.datazoom;return t?L({},l,{previewData:t,previewXCallback:e?t=>mV({x:e},t,r,a).x:null,previewYCallback:i?t=>mV({y:i},t,r,a).y:null,previewX1Callback:n?t=>mV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>mV({y1:s},t,r,a).y1:null},null!=o?o:{}):L({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=f(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}LV(oV.continuousPlayer,(t=>new bY(t))),LV(oV.discretePlayer,(t=>new _Y(t)));let FY=class extends KW{constructor(t,e){super(t,eV.player,e),this.spec.componentType=eV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=m(t)?null:f(t)?this.view.getDataById(t):t;this.detach(e)}const r=m(e)?null:f(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=f(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(pY.OnChange,this._filterCallback),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t;return this._filterData(o,l,iV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(pY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=L({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:DV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=mV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=m(o)?null:f(o)?this.view.getDataById(o):o,h=m(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>L({},TY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>L({},TY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};LV(eV.tooltip,(t=>new CY(t)));let zY=class extends KW{constructor(t,e){super(t,eV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ft(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Wt).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>L({},TY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!h(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return N(t).reduce(((t,e)=>(t=t.concat(LN(e.visible,this.view)),WN(e.key)||(t=t.concat(LN(e.key,this.view))),WN(e.value)||(t=t.concat(LN(e.value,this.view))),WN(e.symbol)||(t=t.concat(LN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=FN(t.visible,n,e,i);return o=!!h(o)||!!o,s=WN(t.key)?ll(t.key.field)(e):FN(t.key,n,e,i),s=h(s)?void 0:u(s)?s:{text:s},r=WN(t.value)?ll(t.value.field)(e):FN(t.value,n,e,i),r=h(r)?void 0:u(r)?r:{text:r},a=WN(t.symbol)?ll(t.symbol.field)(e):FN(t.symbol,n,e,i),a=h(a)?void 0:u(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?N(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var HY=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 jY extends CW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],h(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=LN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];N(t.source).forEach((t=>{const i=HN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return HY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return h(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return h(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=N(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=PW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(N(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=N(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function NY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function VY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,NY(t,e,s,n)}class WY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}return this.nodes.push(t),NY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,VY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class GY{constructor(t){this.list=[],this.ids={},this.idFunc=t||hl}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var UY=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 YY{constructor(){this.grammars=[],this.logger=We.getInstance(),this._curRank=0,this._committed=new GY((t=>t.uid)),this._heap=new WY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return UY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>h(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new GY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return UY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const XY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===tV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class $Y{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(hV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return RT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gk.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(hV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Cj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(hV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(hV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(hV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new JM(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=d(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new eC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class KY extends CW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?FN(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(m(t)&&m(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function rX(t,e,i){FN(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=FN(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),h(null==n?void 0:n.clamp)||(l(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function aX(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i),rX(t,e,i)}function oX(t,e,i){t.round&&e.round(FN(t.round,i,e),!0),t.padding&&e.padding(FN(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(FN(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(FN(t.paddingOuter,i,e),!0),t.align&&e.align(FN(t.align,i,e),!0)}function lX(t,e,i,n){const s=t.field,r=zN(t.data,i),a=f(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),zl(e.type)?(n&&a.filter((t=>v(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function hX(t,e,i){if(ZY(t.domain)?e.domain(lX(t.domain,e,i,!0),!0):e.domain(FN(t.domain,i,e),!0),ZY(t.range))e.range(lX(t.range,e,i),!0);else if(JY(t.range)){const n=zN(t.range.coordinate,i);!function(t){switch(t){case Fl.Quantile:case Fl.Quantize:case Fl.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(FN(t.range,i,e),!0);switch(t.type){case"linear":aX(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){oX(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){aX(t,e,i);const n=FN(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i);const n=FN(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){aX(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){aX(t,e,i);const n=FN(t.constant,i,e);b(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class cX extends CW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=qY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=qY(this.spec.type)),hX(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return h(this.spec.domain)||this.detach(tX(this.spec.domain,this.view)),this.spec.domain=t,this.attach(tX(t,this.view)),this.commit(),this}range(t){return h(this.spec.range)||this.detach(tX(this.spec.range,this.view)),this.spec.range=t,this.attach(tX(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!h(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!h(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return h(e)?null:this.parameters()[e]}configure(t){return this.detach(eX(this.spec.type,t,this.view)),h(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(eX(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let dX=-1;const uX=[HW,jW,WW,NW,VW,GW,UW],pX=t=>{var e,i,n,s;return v(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},gX=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:RV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:TV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:CV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:PV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},fX=(t,e)=>(null==e?void 0:e.debounce)?gt(t,e.debounce):(null==e?void 0:e.throttle)?ft(t,e.throttle):t,mX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:OW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):zV[t]?(i.markType=t,i.source=e):i.source=t===LW?LW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},yX={},_X=()=>yX;let vX=class extends $W{constructor(t,e){super(t,tV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return dV.rect}evaluateJoin(t){return super.evaluateJoin(wV)}};function bX(t,e){if(b(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return b(t)?t*e:0}return 0}function xX(t,e){return Math.min(t<0?t+e:t-1,e)}function SX(t,e,i){let n=xX(t,i),s=xX(e,i);if(b(t)||b(e)?b(t)?b(e)||(n=xX(Math.max(0,s-1),i)):s=xX(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const wX=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>bX(t,i))),u=l.map((t=>bX(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=SX(e,i,r),{start:h,end:c}=SX(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},AX=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=ml(r.maxChildWidth,s.width()),o=ml(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=pX(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==tV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(l(r))r.call(null,t,s,a,e);else if(l(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=AX(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(NW,o),i.updateSignal(VW,l),i.updateSignal(WW,h)}else AX(t,s,a,e);else"grid"===r.display&&wX(t,s,a);kX(s,e,i)}))};class MX extends $W{constructor(t,e,i){super(t,tV.glyph,i),this.glyphType=e,this.glyphMeta=XN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=jV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let CX=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return h(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return h(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return m(t)?(i.x=t[0],i.y=t[1]):v(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new qt,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class TX extends CX{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=h(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=h(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=m(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class EX extends CX{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Yt(s);const r=rt(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function PX(t){switch(t){case"cartesian":default:return new TX;case"polar":return new EX}}class RX extends CW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=PX(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=PX(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,c;!h(t.start)&&e.start(null!==(n=FN(t.start,i))&&void 0!==n?n:[0,0]),!h(t.end)&&e.end(null!==(s=FN(t.end,i))&&void 0!==s?s:[0,0]),!h(t.origin)&&e.origin(null!==(r=FN(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!h(t.translate)){const e=FN(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!h(t.rotate)){const e=FN(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!h(t.scale)){const e=FN(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}h(t.transpose)||FN(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const BX=Symbol.for("key");class IX{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i[0]}):h(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=hW(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=hW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!h(e.morphElementKey)){const i=jN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i}):h(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:BX})),r=hW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:BX}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==BX){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=FN(i.animation.delay,s,o,l),d=FN(i.animation.duration,s,o,l),u=FN(i.animation.oneByOne,s,o,l),p=FN(i.animation.splitPath,s,o,l),g=b(u)&&u>0?t=>v(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(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);yT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>pT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>fT(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:MA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new mT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:fC,null!==(l=i.easing)&&void 0!==l?l:mC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:MA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new _T({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:fC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:mC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):yT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class DX{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=f(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),h(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),h(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),h(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),h(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class LX{constructor(t){this.view=t}stop(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.stop()})),this}pause(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.pause()})),this}resume(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.resume()})),this}enable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.enable()})),this}disable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.disable()})),this}enableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.enableAnimationState(t)})),this}disableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.disableAnimationState(t)})),this}animate(){return this.view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){}}class OX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=mV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===Fl.Band){if(!h(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===Fl.Band){if(!h(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:dV.rect}addGraphicItem(t,e){const i=HV(this,this.coord&&"polar"===this.coord.output().type?tV.arc:tV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class FX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=mV(e,t,i,s);if(h(r.size)){const t=n.x?yV(n.x):void 0,e=n.y?yV(n.y):void 0;h(t)&&h(e)?r.size=10:h(t)?r.size=e:h(e)&&(r.size=t),r.size=[t,e]}return h(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(v(i.padding)&&i.padding>0)t.size=m(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(m(i.padding)&&2===i.padding.length){const e=m(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(dV.symbol)}release(){super.release(),this._encoders=null}}var zX=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 HX extends r{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV],s=YW(0,t,n,e,OW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){f(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new KY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new jY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new cX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new RX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=f(e)?this.getMarkById(e):e;let s;switch(t){case tV.group:s=new vX(this,n);break;case tV.glyph:s=new MX(this,null==i?void 0:i.glyphType,n);break;case tV.component:s=((t,e,i,n)=>{switch(e){case eV.axis:return new PY(t,i,n);case eV.legend:return new RY(t,i);case eV.crosshair:return new IY(t,i);case eV.slider:return new DY(t,i);case eV.label:return new LY(t,i);case eV.datazoom:return new OY(t,i);case eV.player:return new FY(t,i);case eV.tooltip:return new zY(t,i)}return new KW(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case tV.interval:s=new OX(this,t,n);break;case tV.cell:s=new FX(this,t,n);break;default:s=new $W(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(tV.group,t)}glyph(t,e){return this.mark(tV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(tV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(tV.component,t,{componentType:eV.axis,mode:e})}legend(t){return this.mark(tV.component,t,{componentType:eV.legend})}crosshair(t){return this.mark(tV.component,t,{componentType:eV.crosshair})}slider(t){return this.mark(tV.component,t,{componentType:eV.slider})}label(t){return this.mark(tV.component,t,{componentType:eV.label})}datazoom(t){return this.mark(tV.component,t,{componentType:eV.datazoom})}player(t){return this.mark(tV.component,t,{componentType:eV.player})}tooltip(t){return this.mark(tV.component,t,{componentType:eV.tooltip})}customized(t,e){const i=(t=>yX[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=f(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&uX.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(hV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++dX;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(HW,t.width),this.updateSignal(jW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=_X();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(hV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=lV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:HW,value:null!==(i=t[HW])&&void 0!==i?i:0},{id:jW,value:null!==(n=t[jW])&&void 0!==n?n:0},{id:WW,value:pX(null!==(s=t[WW])&&void 0!==s?s:e[WW])},{id:NW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[HW]-i.left-i.right},dependency:[HW,WW]}},{id:VW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[jW]-i.top-i.bottom},dependency:[jW,WW]}},{id:GW,update:{callback:(t,e)=>{const i=pX(e[WW]);return(t||new Vt).setValue(i.left,i.top,i.left+e[NW],i.top+e[VW])},dependency:[NW,VW,WW]}},{id:UW,value:null!==(r=t[UW])&&void 0!==r?r:e[UW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===tV.glyph?{glyphType:t.glyphType}:t.type===tV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(HW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(NW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(VW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(WW);if(arguments.length){const i=pX(t);return this.updateSignal(e,i),i}return pX(e.output())}autoFit(t){const e=this.getSignalById(UW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(GW);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=lV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===tV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||kX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(hV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(hV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(hV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{XY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(hV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(hV.BEFORE_MARK_RENDER_END),XY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(hV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return zX(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return zX(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(hV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(hV.AFTER_DO_RENDER)}evaluate(t){var e,i;return zX(this,void 0,void 0,(function*(){const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!uX.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return XY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=en(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return zX(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(HW,t)),e!==this.height()&&(n=!0,this.updateSignal(jW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,c=mX(e);if(!c)return;const{source:u,type:p}=c,g=h((v=c).markId)?t=>t&&t.mark.id()===v.markId:h(v.markName)?t=>t&&t.mark.name()===v.markName:h(v.type)?t=>t&&t.mark.markType===v.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:f(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),y=DN(l,this),_=fX(((t,e)=>{const n=u===OW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===LW&&(t=YW(0,t,e,p,LW));let s=!1;if((!i||i(t))&&(!g||g(e))&&m.length){const e=y.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var v;if(u===OW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||d(n)&&!n[i])}(this._eventConfig,OW,p))return this.addEventListener(p,_,FW),()=>{this.removeEventListener(p,_)}}else if(u===LW)return gj.addEventListener(p,_),this._eventListeners.push({type:p,source:gj,handler:_}),()=>{gj.removeEventListener(p,_);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===gj&&t.handler===_));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);f(e)?i.type=e:d(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:zW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?f(r)?r:r.user:zW,o=r&&a===r.user&&(s===r.element||h(s)&&h(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==zW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!h(document)&&document.body:this.container;return e?h(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new $Y(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new DX((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new DX((t=>t.id())),this._options.logger&&We.setInstance(this._options.logger),this.logger=We.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new YY,this.animate=new LX(this),this._morph=new IX,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{m(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[OW,LW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&gj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=lV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==tV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=gj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&gj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),EN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const jX=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{TN(e,t[e],!0)}))}))};jX(_V);const NX=["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 VX,WX,GX;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(VX||(VX={})),function(t){t.chart="chart",t.window="window"}(WX||(WX={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(GX||(GX={}));const UX=`${Kj}_waterfall_default_seriesField`,YX=`${Kj}_DEFAULT_DATA_INDEX`,XX=`${Kj}_DEFAULT_DATA_KEY`,$X=`${Kj}_DEFAULT_DATA_SERIES_FIELD`,KX=`${Kj}_DEFAULT_SERIES_STYLE_NAME`;var qX;!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.Built_In=99]="Built_In"}(qX||(qX={}));const ZX=`${Kj}_STACK_START`,JX=`${Kj}_STACK_END`,QX=`${Kj}_STACK_START_PERCENT`,t$=`${Kj}_STACK_END_PERCENT`,e$=`${Kj}_STACK_START_OffsetSilhouette`,i$=`${Kj}_STACK_END_OffsetSilhouette`,n$=`${Kj}_SEGMENT_START`,s$=`${Kj}_SEGMENT_END`;var r$,a$;!function(t){t[t.Axis_Grid=100]="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"}(r$||(r$={})),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"}(a$||(a$={}));const o$=["linear","radial","conical"],l$={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}},h$={innerRadius:0,outerRadius:1,startAngle:wN,endAngle:AN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var c$,d$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(c$||(c$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(d$||(d$={}));const u$={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,tickSize:Ij,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Ij/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Rj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Rj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},p$={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},g$={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},f$={name:"light",padding:12,fontFamily:Pj,colorScheme:{default:{dataScheme:[{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"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Yj,line:Nj,area:Dj,bar:Lj,bar3d:Oj,pie:Wj,pie3d:Gj,map:Vj,radar:Uj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:Fj,funnel3d:zj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:Xj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:jj,treemap:$j,sunburst:h$,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Rj},minLabel:{position:d$.end},maxLabel:{position:d$.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Rj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...g$,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...g$,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...g$},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...g$}},axis:u$,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10},maxHeight:"30%"},axisY:{label:{space:20},title:{space:20,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Rj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Rj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!0,background:{size:6,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:4,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:p$,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Bj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Rj,lineHeight:Bj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:12,fontWeight:"bold",fill:"#4E5969"},contentStyle:{fontSize:12,fill:"#4E5969"},panel:{visible:!0,fill:"#fff",stroke:"#ffffff",lineWidth:0,cornerRadius:3,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:"rgba(0, 0, 0, 0.1)",size:0,space:12}}}},m$=new Map([[f$.name,f$]]),y$=f$.name;class _${static instances=new Map;static registerInstance(t){_$.instances.set(t.id,t)}static unregisterInstance(t){_$.instances.delete(t.id)}static getInstance(t){return _$.instances.get(t)}static instanceExist(t){return _$.instances.has(t)}static forEach(t,e=[],i){const n=N(e);return _$.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class v${static themes=new Map;static _currentThemeName=y$;static registerTheme(t,e){t&&v$.themes.set(t,L({},v$.getDefaultTheme(),e))}static getTheme(t){return v$.themes.get(t)||v$.getDefaultTheme()}static removeTheme(t){return v$.themes.delete(t)}static themeExist(t){return v$.themes.has(t)}static getDefaultTheme(){return v$.themes.get(y$)}static setCurrentTheme(t){v$.themeExist(t)&&(v$._currentThemeName=t,_$.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return v$.getTheme(v$._currentThemeName)}static getCurrentThemeName(){return v$._currentThemeName}}v$.registerTheme(y$,m$.get(y$)),m$.forEach(((t,e)=>{e!==y$&&v$.registerTheme(e,t)}));const b$=(t,e,i)=>new He({defaultFontParams:{fontFamily:Ej,fontSize:14},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),x$=fB({});function S$(t,e){for(let i=0;it.key===e))}function A$(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const k$=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sP$(t.style(e,i,n,s)):M(t.style)||(e.style=P$(t.style)),!M(t.state)){const i={};Object.keys(t.state).forEach((e=>{l(t.state[e])?i[e]=(i,n,s,r)=>P$(t.state[e](i,n,s,r)):M(t.state[e])||(i[e]=P$(t.state[e]))})),e.state=i}return e}function T$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e,n,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function E$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e.rawValue,n,e,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function P$(t){return M(t)||t.angle&&(t.angle=Gt(t.angle)),t}var R$;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.image="image",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(R$||(R$={}));class B${static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Qa,fields:io,filter:pn,fold:eo};static dataParser={csv:fo,dsv:go,tsv:mo};static _layout={};static registerChart(t,e){B$._charts[t]=e}static registerSeries(t,e){B$._series[t]=e}static registerComponent(t,e){B$._components[t]=e}static registerMark(t,e){B$._marks[t]=e}static registerRegion(t,e){B$._regions[t]=e}static registerTransform(t,e){B$.transforms[t]=e}static registerLayout(t,e){B$._layout[t]=e}static createChart(t,e,i){if(!B$._charts[t])return null;return new(0,B$._charts[t])(e,i)}static createRegion(t,e,i){if(!B$._regions[t])return null;return new(0,B$._regions[t])(e,i)}static createSeries(t,e,i){if(!B$._series[t])return null;return new(0,B$._series[t])(e,i)}static createMark(t,e,i){if(!B$._marks[t])return null;const n=new(0,B$._marks[t])(e,i);return n.type===R$.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(B$._components)}static getComponentInKey(t){return B$._components[t]}static getLayout(t){return B$._layout[t]}static getSeries(t){return B$._series[t]}}const I$=(t,e,i)=>{const n=t.getRegionsInIds(N(e.layoutBindRegionID));return 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})}))},D$=(t,e)=>t===e||!h(t)&&!h(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),L$=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},O$="monotone",F$="linearClosed";var z$;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(z$||(z$={}));var H$;function j$(t){return"bottom"===t||"top"===t}function N$(t){return"left"===t||"right"===t}function V$(t){return"z"===t}function W$(t,e){return Uh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(H$||(H$={}));const G$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&I$(t,n,i)));return n.length?n:null},U$=t=>t.fieldX[0],Y$=t=>t.fieldY[0],X$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=$$(t,n,"x",U$);e&&o.push(e)})),a&&a.forEach((t=>{const e=$$(t,s,"y",Y$);e&&o.push(e)})),o.length?o:null},$$=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return K$(t,a,n)},K$=(t,e,i)=>{const n=t.getScale();if(!n||!jl(n.type))return null;if(h(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=L$(e,t,"cartesian",i??(j$(t.orient)?U$:Y$));return{index:s,value:e,axis:t,data:r}},q$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&I$(t,n,i)));return n.length?n:null},Z$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&jl(e.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=Il({x:1,y:0},d);u=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(u,r);const p=Dl(d),g=a[0]?.getScale(),f=g?.range();if((u-r?.[0])*(u-r?.[1])>0||(p-f?.[0])*(p-f?.[1])>0)return;const m=Math.abs(r[0]-r[1])/i.length/2,y=e.invert(u+m);if(h(y))return;let _=e.domain().findIndex((t=>t?.toString()===y.toString()));_<0&&(_=void 0);const v=L$(y,t,"polar",l);o.push({index:_,value:y,axis:t,data:v})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&jl(e.type)){const a=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let d=Il({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const u=Dl(c),p=r[0]?.getScale(),g=p?.range();if((d-g?.[0])*(d-g?.[1])>0||(u-i?.[0])*(u-i?.[1])>0)return;const f=e.invert(u);if(h(f))return;let m=e.domain().findIndex((t=>t?.toString()===f.toString()));m<0&&(m=void 0);const y=L$(f,t,"polar",l);o.push({index:m,value:f,axis:t,data:y})}})),o.length?o:null};class J${_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=X$(this._chart,{x:t,y:e})??[],n=Z$(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!jl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=K$(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var Q$;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Q$||(Q$={}));const tK={[Q$.dimensionHover]:class extends J${_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:WX.chart},callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:WX.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!D$(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[Q$.dimensionClick]:class extends J${constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:WX.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let eK=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(tK[t]){const e=new tK[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(tK[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class iK{_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(GX.vchart,[]),this._levelNodes.set(GX.chart,[]),this._levelNodes.set(GX.model,[]),this._levelNodes.set(GX.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),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=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const nK={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 sK{globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||WX.chart),n=this.getEventListeners(e.filter?.source||WX.chart);i.get(t)||i.set(t,new iK);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||WX.chart),s=this.getEventListeners(e?.filter?.source||WX.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||WX.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||WX.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(GX.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(GX.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(WX.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(WX.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if(l(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&C(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return nK[n]&&(n=nK[n]),(!t.type||n===t.type)&&(!c(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=c(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=c(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&c(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();c(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:C(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:c(t.id)?GX.model:GX.vchart:GX.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ft(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=gt(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=WX.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==GX.model&&i!==GX.mark||(n=e.type),e?.source&&(s=e.source),c(e?.id)&&(o=e?.id,i=GX.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case WX.chart:return this._viewBubbles;case WX.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case WX.chart:return this._viewListeners;case WX.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return NX.includes(t)||Object.values(hV).includes(t)||Object.values(VX).includes(t)}}function rK(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function aK(t,e,i){t.getParser(e)||t.registerParser(e,i)}const oK=new Map;let lK;function hK(t,e,i={type:"geojson",centroid:!0}){oK.has(t)&&Yo(`map type of '${t}' already exists, will be overwritten.`),lK||(lK=new jo,aK(lK,"geojson",Do),aK(lK,"topojson",Oo),rK(lK,"simplify",Qa));const n=new Vo(lK),s=L({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),oK.set(t,n)}function cK(t,e=!1){let i=e;return t.latestData instanceof Vo&&(i=!1),i?R(t.latestData):t.latestData.slice()}const dK=(t,e)=>0===t.length?[]:1===t.length?cK(t[0],e?.deep):t.map((t=>cK(t,e?.deep)));function uK(t,e,i){rK(e=e instanceof jo?e:t.dataSet,"copyDataView",dK);const n=new Vo(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function pK(t,e,i=[]){if(t instanceof Vo)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new Vo(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!f(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Xo("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const gK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)}}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!f(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&gj.getCancelAnimationFrame()(this._rafId),this._rafId=gj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const n=function(n,s){const r=s?.mark?.context??{},a=c(r.modelId)?r.modelId:null,o=c(r.markId)?r.markId:null,l=c(r.modelUserId)?r.modelUserId:null,h=c(r.markUserId)?r.markUserId:null,d={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,d)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===WX.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();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===WX.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(h(e))return;const i=e.id(),n=t.grammarType;h(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(h(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];c(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return c(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return Zo(this._option.mode)?globalThis:this.getStage()?.window}}async function SK(t){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){console.error("getCanvasDataURL",t)}return t.toDataURL()}class wK{id=el();static useChart(t){t.forEach((t=>B$.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>B$.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>B$.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>B$.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>B$.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){B$.registerTransform(t,e)}static registerMap(t,e,i){hK(t,e,i)}static unregisterMap(t){!function(t){oK.has(t)?oK.delete(t):Yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,oK.get(e);var e}static hideTooltip(t=[]){_$.forEach((t=>t?.hideTooltip?.()),t)}static InstanceManager=_$;static ThemeManager=v$;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=L(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,poptip:a,...o}=this._option;i&&(this._container=f(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=v$.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new xK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,pluginList:!1!==a?["poptipForText"]:[],...o,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new sK(this,this._compiler),this._event=new eK(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!Zo(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(VX.initialized,{}),_$.registerInstance(this)):Xo("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=Jh(f(t)?JSON.parse(t):t))}_initData(){if(h(this._dataSet))return void Yo("dataSet is not initialized");const t=N(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Xo("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=gt(((...t)=>{const{width:e,height:i}=en(this._container,qj,Zj),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof jo?t:new jo,aK(this._dataSet,"dataview",Fo),aK(this._dataSet,"array",cn),rK(this._dataSet,"stackSplit",gK),rK(this._dataSet,"copyDataView",dK);for(const t in B$.transforms)rK(this._dataSet,t,B$.transforms[t]);for(const t in B$.dataParser)aK(this._dataSet,t,B$.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return c(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),oK.clear(),lK=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,_$.unregisterInstance(this)}async updateData(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):m(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(f(t)&&(t=JSON.parse(t)),e&&(t=L({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=Jh(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}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)}_updateCurrentTheme(){var t;f(this._spec?.theme)?(this._currentTheme=L({},v$.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=L({},v$.getTheme(this._currentThemeName),this._spec?.theme??{}),t=L({},this._currentTheme.component?.poptip),L(xG.poptip,bG,t)}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return v$.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===un.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(c(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await SK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!Zo(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await 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):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(c(this._container))return this._container;let t;return t=f(this._canvas)?document?.getElementById(this._canvas):this._canvas,c(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(M(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),Zh(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||h(t)||M(e))return null;if(!m(t)){const{axisId:n,axisIndex:s}=e;let r;if(c(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):c(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Yo("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?Zh(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!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"}(yK||(yK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(_K||(_K={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(vK||(vK={}));class AK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){h(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,L({},AK.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]}getMarksInType(t){const e=N(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]))))}}class kK{event;interaction;_option;_marks=new AK;_markReverse=new AK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){M(t.stateStyle[yK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),M(t.stateStyle[yK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Q$.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=m(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(yK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(yK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class MK{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class CK extends MK{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=a$.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Kh(qh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=h(t.minHeight)?null:$h(t.minHeight,e.height,e),this._maxHeight=h(t.maxHeight)?null:$h(t.maxHeight,e.height,e),this._minWidth=h(t.minWidth)?null:$h(t.minWidth,e.width,e),this._maxWidth=h(t.maxWidth)?null:$h(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:$h(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:$h(t.height,e.height,e)},{height:9}),h(t.offsetX)||(this.layoutOffsetX=$h(t.offsetX,e.width,e)),h(t.offsetY)||(this.layoutOffsetY=$h(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{h(this._spec[i])||(e[i]=$h(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};h(n)||(r.width-=n),h(s)||(r.width-=s),h(e)||(r.height-=e),h(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):(h(n)?h(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,h(e)?h(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){b(t)&&(this._layoutStartPoint.x=t),b(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){b(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),b(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}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={...t};return this._layoutRectLevelMap.width<9?(h(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),h(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(h(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),h(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class TK extends MK{grammarType;id=el();_product;getProduct(){if(c(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return c(e)&&c(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){c(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(c(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(c);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class EK extends TK{grammarType=mK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}c(this._value)&&this._product.value(this._value),c(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class PK extends MK{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new EK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class RK extends PK{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(L(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class BK extends RK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class IK extends CK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new AK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=el(),this._originalSpec=t,this._spec=Qh(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new eK(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new BK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Qh(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(h(t)||h(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=L({},e?.[N(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),m(t))return t.map((t=>d(t)&&!l(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];d(n)&&!l(n)&&(Fh(n)?e[i]=Oh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){c(t)&&c(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!c(t)||!c(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${Kj}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=B$.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const DK={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},LK={symbol:function(t,e){return"shape"===t?DK[e]??e:e}};const OK={};Object.values(yK).forEach((t=>{OK[t]=!0}));const FK={[yK.STATE_HOVER]:yK.STATE_HOVER_REVERSE,[yK.STATE_SELECTED]:yK.STATE_SELECTED_REVERSE,[yK.STATE_DIMENSION_HOVER]:yK.STATE_DIMENSION_HOVER_REVERSE};function zK(t){return FK[t]}class HK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!M(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=zK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=zK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=zK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=zK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class jK extends RK{id=el();stateKeyToSignalName=t=>`${Kj}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===fK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===fK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}}}}class NK extends IK{static type="region";modelType="region";type=NK.type;_series=[];layoutType="region";layoutZIndex=r$.Region;animate;interaction=new HK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler})),c(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:R$.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",qX.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",qX.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:R$.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:R$.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",qX.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(r$.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",qX.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",qX.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",qX.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):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=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||N(t.userId).includes(e.userId))&&(!c(t.specIndex)||!e.getSpecIndex||N(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||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(VX.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new kK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in _K)M(t.stateStyle[_K[e]])||this.interaction.registerMark(_K[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class VK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const WK=[R$.line,R$.area,"trail"];function GK(t){return WK.includes(t)}class UK extends RK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),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];c(n.domain)&&(s.domain=n.domain),c(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=o(GK)?n:!t.mark||GK(t.mark.markType);let s=!1,r=!1;if(c(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!OK[t])).map((t=>[t,10])),n=!t.mark||GK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(m(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Kj)));n=t.datums.some((t=>i&&m(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(d(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Kj)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(zl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class YK extends TK{grammarType=mK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();h(t)||(h(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class XK extends YK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return c(t)?t:`${Kj}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct(t)}}class $K extends TK{grammarType=mK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=r$.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){c(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){h(this._data)&&this.initMarkData({...this._option,mark:this}),c(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new UK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new eK(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new XK(t)}stateKeyToSignalName(t){return`${Kj}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(c(e)&&this.removeProduct());if(c(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),h(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(h(this._data))return;this._data.compile();const t=this._data.getProduct();c(this._product)&&c(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[yK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!l(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(hV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===fK.appear&&this.runAnimationByState(fK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),LK[a]?LK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class KK extends $K{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(c(t.id)&&(this._userId=t.id),o(t.interactive)&&(this._interactive=t.interactive),c(t.zIndex)&&this.setZIndex(t.zIndex),o(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(v(t))return Sl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Sl)),t}return"function"==typeof t?(e,i,n,s)=>Sl(t(e,i,n,s)):t}isUserLevel(t){return[qX.User_Mark,qX.User_Series,qX.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];h(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;c(r)&&r<=n&&L(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return f(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=Nh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;return s=this.stateStyle[i]?.[t]?this._computeStateAttribute(this.stateStyle[i][t],t,e,i,n):this._computeStateAttribute(this.stateStyle.normal[t],t,e,i,n),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,s):s}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):o$.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):Hl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",qX.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=l(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,qX.User_Mark,e)}else this.setStyle(i,t,qX.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let h=s,d=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(h=t),d||(d=e)}const u=Dh(Ih(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),p={},g={...l$[n],...a};return Object.keys(g).forEach((t=>{const n=g[t];"stops"===t?p.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??h?.scale(e[d]);return l(s)&&(a=s(e,this._attributeContext,i,o)),c(n)&&(a=Uo.SetOpacity(a,n)),{offset:l(r)?r(e,this._attributeContext,i,o):r,color:a||u[0]}})):l(n)?p[t]=n(e,this._attributeContext,i,o):p[t]=n})),p.gradient=n,p}_computeThresholdAttr(t){return(new Th).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class qK extends KK{static type=R$.group;type=qK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Yo("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?(Yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class ZK extends KK{static type=R$.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(tV.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}class JK extends KK{static type=R$.image;type=JK.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}wK.useMark([ZK,qK,JK]),B$.registerRegion("region",NK),B$.registerLayout("base",VK);var QK,tq,eq;We.getInstance(Ve.Error),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(QK||(QK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(tq||(tq={}));class iq{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Nh("colorOrdinal"):Nh(t.type)),e?(m(t.range)&&e.range(t.range),m(t.domain)&&(nl(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),nl(n.domain)?e.reRender=!0:z(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)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{nl(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{S$(e,[{key:t,operations:zl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&S$(e,[{key:i.field,operations:zl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!nl(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=zl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{zl(e.type)?(h(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),h(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;zl(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){if(!h(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(zl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(zl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));zl(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(h(t.field)||!h(t.changeDomain)&&"none"!==t.changeDomain&&!h(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class nq{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(VX.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][JX]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[JX],s>=0?(t[ZX]=e,e+=t[JX],t[JX]=e):(t[ZX]=i,i+=t[JX],t[JX]=i)})),t.values.forEach((t=>{s=t[JX];const r=s>=0?e:i;n=s>=0?1:-1,t[QX]=Math.min(1,t[ZX]/r)*n,t[t$]=Math.min(1,t[JX]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[JX]=function(t){if(b(t))return t;const e=+t;return b(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class sq extends MK{type="chart";id=el();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:qj,height:Zj};getLayoutRect(){return this._layoutRect}_viewRect={width:qj,height:Zj};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:qj,y2:Zj};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=qh(t.padding??this._theme?.padding),this._event=new eK(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new nq(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),E(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=B$.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=pK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),c(t.regionId)?i=this.getRegionsInUserId(t.regionId):c(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&N(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=B$.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(B$.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(VX.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(VX.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>N(t).some((t=>c(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof IK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof KK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof KK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(c(t)&&c(e))this._canvasRect={width:t,height:e};else{let i=qj,n=Zj;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=en(this._option.container,qj,Zj);i=t,n=e}else if(r&&Zo(this._option.mode)){let t;t=f(r)?document?.getElementById(r):r;const{width:e,height:s}=en(t,qj,Zj);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;if(m(t))e.range=t.map((t=>Oh(t,this._theme?.colorScheme)));else{const i=t;Object.prototype.hasOwnProperty.call(i,"type")&&(e.type=i.type),Object.prototype.hasOwnProperty.call(i,"domain")&&(e.domain=i.domain),Object.prototype.hasOwnProperty.call(i,"range")&&(e.range=i.range),Object.prototype.hasOwnProperty.call(i,"specified")&&(e.specified=i.specified)}}return e.range?.length||(e.range=Ih(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new iq(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Ih(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&N(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};m(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Kh(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}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(M(t[n]))continue;const s=t[n];let r={stateValue:n};r=l(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(yK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(yK.STATE_HOVER,!0,t,e,i)}initEvent(){[VX.dataZoomChange,VX.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(hV.AFTER_MARK_RENDER_END,e)};this._event.on(hV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||l(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===Q$.dimensionHover||s===Q$.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===un.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===un.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class rq extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}function aq(t){t.crosshair=N(t.crosshair||{}).map((e=>L({[t.direction===Gh.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(eq||(eq={}));const oq=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!h(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!h(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!h(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=c,(h(o)||o===UX)&&(t[UX]=c?l.total:+t[n]>=0?l.increase:l.decrease)})),f={...i,lastIndex:t},d.push(i)})),d},lq=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},hq=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:cq(t.map((t=>t.latestData)).flat(),e.fields,i)}};function cq(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>cq(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class dq{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new Vo(e instanceof jo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),rK(e,"dimensionTree",hq),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const uq=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},pq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class gq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new AK;_markReverse=new AK;constructor(t,e){this._spec=t,this._option=e,this.event=new eK(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(yK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(yK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(N(i).forEach((e=>{t.on(e,{level:GX.chart},this.onHover)})),n&&"none"!==n&&N(n).forEach((e=>{t.on(e,{level:GX.vchart,source:WX.chart},this.onUnHover)}))),s&&(N(r).forEach((e=>{t.on(e,{level:GX.mark},this.onSelect)})),a&&"none"!==a&&N(a).forEach((e=>{t.on(e,{level:GX.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=pq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;o(i)?this._hover.enable=i:d(i)&&(this._hover.enable=!0,this._hover=L(this._hover,i));const n=this._spec.select;o(n)?this._select.enable=n:d(n)&&(this._select.enable=!0,this._select=L(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,yK.STATE_HOVER)||this.interaction.getEventElement(yK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(yK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(yK.STATE_HOVER,t.item),this.interaction.reverseEventElement(yK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(yK.STATE_HOVER);this.interaction.clearEventElement(yK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(yK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,yK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(yK.STATE_SELECTED);this.interaction.clearEventElement(yK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(yK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(yK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(yK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(yK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(yK.STATE_SELECTED);const e=this.interaction.getEventElementData(yK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class fq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const mq=(t,e)=>c(e)?t.map((t=>e[t])):void 0,yq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),_q=t=>!h(t)&&(m(t)?t.length>0&&t.every(c):Object.keys(t).length>0);function vq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(c(s.regionId)?[s.regionId]:void 0,c(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=c(s)?t[s]:void 0,a=c(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=mq(i,t);let d=mq(n,t);const u=_q(d),p=!u&&c(s)&&h(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,c=i.map(((t,e)=>[t,e])).filter((([,t])=>h(l?.[t])));let g=[l??[]];c.length>0&&c.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];g.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),g=s})),g.forEach((l=>{if(p){const r=t.getViewData()?.latestData.filter(yq(i,l));a.forEach((a=>{const c=r.find((t=>t[s]===a));if(d=mq(n,c),!_q(d))return;const p=t.dataToPosition(c);h(p)||isNaN(p.x)||isNaN(p.y)||o.push({pos:p,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===tq.pie){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToCentralPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}else{const t=e;if(p){const c=t.getViewData()?.latestData.filter(yq(i,l)),p=c.find((t=>t[s]===r));a.forEach((r=>{if(d=mq(n,p),!_q(d))return;const a=t.dataToPosition(p);h(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),d=r.getLayoutStartPoint(),u=r.getLayoutRect(),p=n.globalInstance.getContainer(),g={x:0,y:0,...p?nn(p):{}},f=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>yq(e,i)(t)&&yq(n,s)(t)&&(h(r)||yq([r],[a])(t))));return o},m=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),u.width),y:Math.min(Math.max(t.y,0),u.height)}))(t),i=s.x??d.x+e.x,n=s.y??d.y+e.y;return{canvasX:i,canvasY:n,clientX:g.x+i,clientY:g.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>f(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:WX.chart,event:m({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...f(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:WX.chart,event:m(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),l}return"none"}const bq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return c(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function xq(t){return h(t.mark)&&h(t.model)&&h(t.datum)}class Sq extends fq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];c(i)&&(e[t]={...i,title:c(i.title)?l(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:c(i.content)?l(i.content)?i.content:N(i.content).map((t=>l(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=bq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:c(e)?N(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of N(e)){const e=this.series.getSeriesStyle(t)?.(i);if(c(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const wq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},Aq={min:t=>t===wq.min()?0:t,max:t=>t===wq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===wq.min()?0:t,"array-max":t=>t===wq.max()?0:t};const kq={min:function(t,e){return il(e)?Math.min(t,e):t},max:function(t,e){return il(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.max(t,...i)}},Mq=(t,e)=>{const i={};let n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;n=S$([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!h(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=wq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=kq[n](i[t.key][n],s)})),i[t.key][n]=Aq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},Cq=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>il(t[s])));else if("zero"===n)return t.forEach((t=>{il(t[s])||(t[s]=0)})),t;return t};class Tq extends YK{_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const Eq=`${Kj}_HIERARCHY_DEPTH`,Pq=`${Kj}_HIERARCHY_ROOT`,Rq=`${Kj}_HIERARCHY_ROOT_INDEX`,Bq=()=>({keyMap:new Map});function Iq(t,e,i){t&&(this._seriesField||(t[$X]=this.getSeriesKeys()[0]),t[YX]=e,t[XX]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function Dq(t,e,i,n=0,s,r){void 0===r&&(r=e),Iq.bind(this)(t,e,i),t[Eq]=n,t[Pq]=s||t[this.getCategoryField()],t[Rq]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>Dq.bind(this)(e,n,i,t[Eq]+1,t[Pq],r)))}class Lq extends IK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[QK.label]:{name:QK.label,type:R$.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(VX.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&c(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(VX.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(h(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),o(this._spec.stack)&&(this._stack=this._spec.stack),o(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),o(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),c(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=uK(this._rawData,this._dataSet,{name:`${Kj}_series_${this.id}_viewDataFilter`});const t=uK(this._viewDataFilter,this._dataSet,{name:`${Kj}_series_${this.id}_viewData`});this._data=new Tq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(rK(this._option.dataSet,"invalidTravel",Cq),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new dq(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${Kj}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){rK(this._dataSet,"dimensionStatistics",Mq);const n=new Vo(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=S$(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&S$(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${Kj}_series_${this.id}_viewStackData`;this._viewStackData=new Vo(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(h(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(f(t))return e[t];if(m(t)&&t.every((t=>f(t))))return t.map((t=>e[t])).join("-");if(l(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(VX.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(VX.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(VX.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(VX.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(VX.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||h(e)?[]:f(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:R$.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||h(t.dataId)&&h(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new gq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??$X;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:KX,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,KX)}))}afterInitMark(){this.event.emit(VX.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",qX.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new Sq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??$X,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??$X}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=L({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:l,dataProductId:d,parent:u,isSeriesMark:p,dataStatistics:g,depend:f,label:m,progressive:y,support3d:_=this._spec.support3d||!!this._spec.zField,morph:v=!1}=e,b=super._createMark(t,{key:i??this._getDataIdKey(),support3d:_,dataStatistics:g??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(c(b)){this._marks.addMark(b),p&&(this._seriesMark=b),h(u)?this._rootMark?.addMark(b):!1!==u&&u.addMark(b),h(l)?(b.setDataView(this.getViewData(),this.getViewDataProductId()),b.setSkipBeforeLayouted(!0)):!1!==l&&b.setDataView(l,d),o(s)&&b.setSkipBeforeLayouted(s),c(f)&&b.setDepend(...N(f)),c(m)&&b.setLabelSpec(m);const t=this.getSpec()||{};b.setMorph(v),b.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),b.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),h(y)||b.setProgressiveConfig(y),h(n)||b.setGroupKey(n),this.initMarkStyleWithSpec(b,L({},r,a||t[b.name]))}return b}_getDataIdKey(){return super._getDataIdKey()??XX}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==JX&&t!==t$&&t!==ZX&&t!==QX||(t=this.getStackValueField()),A$(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=B$.getSeries(this.type);return Object.values(t.mark??{})}return t}}class Oq extends Lq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=N(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=N(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&N(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=Gh.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((e=>{const i={key:e,operations:[]};zl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((e=>{const i={key:e,operations:[]};zl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};zl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===Gh.vertical?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction===Gh.vertical?(this.setFieldY(JX),this.setFieldY2(ZX)):(this.setFieldX(JX),this.setFieldX2(ZX))}setValueFieldToPercent(){this.direction===Gh.vertical?(this.setFieldY(t$),this.setFieldY2(QX)):(this.setFieldX(t$),this.setFieldX2(QX))}setValueFieldToStackOffsetSilhouette(){this.direction===Gh.vertical?(this.setFieldY(i$),this.setFieldY2(e$)):(this.setFieldX(i$),this.setFieldX2(e$))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Go(t.xField,i)&&Go(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),c(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(this._spec?.x2Field),this.setFieldY2(this._spec?.y2Field),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{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)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}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._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===Gh.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===Gh.vertical?N(this._spec.yField??this.fieldY):N(this._spec.xField??this.fieldX)}}const Fq=(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};const zq={type:"clipIn"},Hq={type:"fadeIn"};function jq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Hq;default:return zq}}function Nq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=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 Vq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:Nq(t,e)}),Wq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:Nq(t,e)}),Gq={type:"fadeIn"},Uq={type:"growCenterIn"};function Yq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Gq;case"scaleIn":return Uq;default:return Vq(t)}}const Xq={type:"clipIn"},$q={type:"fadeIn"};function Kq(t,e){switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return $q;default:return Xq}}function qq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Zq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:qq(t,!0,fK.appear)}),Jq={type:"fadeIn"},Qq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:qq(t,!0,fK.enter)}),tZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:qq(t,!0,fK.exit)}),eZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:qq(t,!0,fK.exit)});function iZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Jq;case"growRadius":return Zq({...t,growField:"radius"});default:return Zq({...t,growField:"angle"})}}const nZ={type:"fadeIn"};function sZ(t,e){return"fadeIn"===e?nZ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function rZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aZ=t=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:rZ(t)}),oZ={type:"fadeIn"};function lZ(t,e){return!1===e?{}:"fadeIn"===e?oZ:(t=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:rZ(t)}))(t)}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=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const uZ=(t,e)=>({custom:BC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class pZ extends lC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;l(r)&&l(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);b(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);b(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class gZ extends PC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Ht(d,u,p,g);return f.defined=e.defined,f}}const fZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},mZ={type:"fadeIn"},yZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),_Z=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),vZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function bZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mZ;case"growAngle":return fZ({...t,growField:"angle"});default:return fZ({...t,growField:"radius"})}}const xZ={type:"fadeIn"},SZ={type:"growCenterIn"};function wZ(t,e){switch(e){case"fadeIn":return xZ;case"scaleIn":return SZ;default:return Vq(t,!1)}}const AZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},kZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),MZ={type:"fadeIn"},CZ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function TZ(t,e){return"fadeIn"===e?MZ:kZ(t)}const EZ=t=>({custom:DC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),PZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},RZ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===QN.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},IZ=(t,e,i)=>{if(M(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},DZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),LZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},OZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),FZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},zZ={type:"fadeIn"};function HZ(t){return!1===t?{}:zZ}const jZ={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"}},NZ={bar:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),bar3d:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),line:(t,e)=>({appear:Kq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:PC,duration:jZ.update.duration,easing:jZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:jq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),pie3d:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),rose:(t,e)=>({appear:bZ(t,e),enter:yZ(t),exit:_Z(t),disappear:vZ(t)}),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:cZ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:gZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:dZ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:pZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarGroup:(t,e)=>({appear:uZ(t,"in"),disappear:uZ(t,"out")}),circularProgress:(t,e)=>({appear:sZ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:AZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:lZ(t,e),enter:{type:"grow"},disappear:aZ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:IC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:IC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:EZ(t)}),rangeColumn:(t,e)=>({appear:TZ(t,e),enter:kZ(t),exit:CZ(t),disappear:CZ(t)}),waterfall:(t,e)=>({appear:wZ(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:PZ(0,e),enter:DZ(t),exit:OZ(t),disappear:OZ(t)}),circlePacking:(t,e)=>({appear:FZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:HZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:wU},update:{custom:SU},exit:{custom:LC}})},VZ=["appear","enter","update","exit","disappear","normal"];function WZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=l(n)?n(t,s,r):b(n)?n:0;let h=l(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(o+h))},delete t.oneByOne,t}function YZ(t){return t?.[YX]}function XZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function $Z(t){return!function(t){return c(t.timeSlices)}(t)&&c(t.channel)}class KZ extends KK{static type=R$.rect;type=KZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class qZ extends KK{static type=R$.text;type=qZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}wK.useMark([KZ,qZ]);class ZZ extends Oq{static type=tq.bar;type=tq.bar;_barMarkName=QK.bar;_barMarkType=R$.rect;static mark={...Lq.mark,[QK.bar]:{name:QK.bar,type:R$.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...ZZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e)},"normal",qX.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.bar(t,e),GZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Fq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Fq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Fq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class JZ extends KK{static type=R$.rule;type=JZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}wK.useMark([JZ]);class QZ extends ZZ{static type=tq.waterfall;type=tq.waterfall;static mark={...ZZ.mark,[QK.leaderLine]:{name:QK.leaderLine,type:R$.rule},[QK.stackLabel]:{name:QK.stackLabel,type:R$.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],h(this._seriesField)&&(this._seriesField=UX)}getSeriesKeys(){return this._seriesField===UX?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),rK(this._dataSet,"waterfallFillTotal",lq),rK(this._dataSet,"waterfall",oq),(h(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=uK(this.getViewData(),this._dataSet,{name:`${Kj}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new Tq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:ZX,endAs:JX,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(WZ(NZ.waterfall(t,e),GZ(QK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:i}))}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(QZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(QZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===Gh.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):Vh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===Gh.vertical?Vh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===Gh.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",qX.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",qX.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===Gh.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const tJ=`${Kj}_BOX_PLOT_OUTLIER_VALUE`;var eJ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(eJ||(eJ={}));const iJ=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];m(e)||(e=[e]),i.push(...e.map((e=>{const i={[tJ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class nJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(eJ.OUTLIER),value:this.getContentValue(eJ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(eJ.MAX),value:this.getContentValue(eJ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q3),value:this.getContentValue(eJ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MEDIAN),value:this.getContentValue(eJ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q1),value:this.getContentValue(eJ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MIN),value:this.getContentValue(eJ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.SERIES_FIELD),value:this.getContentValue(eJ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return this.series.getOutliersField();if(t===eJ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case eJ.MIN:return this.series.getMinField();case eJ.MAX:return this.series.getMaxField();case eJ.MEDIAN:return this.series.getMedianField();case eJ.Q1:return this.series.getQ1Field();case eJ.Q3:return this.series.getQ3Field();case eJ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return e[tJ];if(t===eJ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case eJ.MIN:return e[this.series.getMinField()];case eJ.MAX:return e[this.series.getMaxField()];case eJ.MEDIAN:return e[this.series.getMedianField()];case eJ.Q1:return e[this.series.getQ1Field()];case eJ.Q3:return e[this.series.getQ3Field()];case eJ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>c(t[tJ])}class sJ extends KK{static type=R$.boxPlot;type=sJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?($N("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(iW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),qV("barBoxplotScaleIn",ZV(eW)),qV("barBoxplotScaleOut",JV(eW))):($N("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(tW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),qV("boxplotScaleIn",ZV(QV)),qV("boxplotScaleOut",JV(QV)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class rJ extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:z$.circle,fill:void 0,lineWidth:0}}}class aJ extends rJ{static type=R$.symbol;type=aJ.type}wK.useMark([sJ,aJ]);class oJ extends Oq{static type=tq.boxPlot;type=tq.boxPlot;static mark={...Lq.mark,[QK.boxPlot]:{name:QK.boxPlot,type:R$.boxPlot},[QK.outlier]:{name:QK.outlier,type:R$.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};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=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(oJ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(oJ.mark.outlier,{progressive:t,key:YX,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:v(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===Gh.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Vh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Vh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Vh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Vh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Vh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},yK.STATE_NORMAL,qX.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),y:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,yK.STATE_NORMAL,qX.Series)}}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"foldOutlierData",iJ),rK(this._dataSet,"addVChartProperty",uq);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===Gh.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._outlierDataView=new Tq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===Gh.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===Gh.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===Gh.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(NZ.boxPlot()),i=this._initAnimationSpec(GZ(QK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(WZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(WZ(NZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new nJ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class lJ{setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(hJ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",qX.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:F$},"normal",qX.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===O$?t===Gh.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",qX.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(hJ.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series))}}const hJ={[QK.point]:{name:QK.point,type:R$.symbol},[QK.line]:{name:QK.line,type:R$.line}};class cJ extends KK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((c=>{const d=t[c];if(h(d)||s.includes(c))return;a&&r.includes(c)&&(Hl(d?.type)||d?.scale||l(d))&&(o=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class dJ extends cJ{static type=R$.line;type=dJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===tq.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}wK.useMark([dJ,aJ,qZ]);class uJ extends Oq{static type=tq.line;type=tq.line;_invalidType="break";static mark={...Lq.mark,...hJ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}j(uJ,lJ);class pJ extends KK{static type=R$.rect3d;type=pJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}wK.useMark([pJ,qZ]);class gJ extends ZZ{static type=tq.bar3d;type=tq.bar3d;static mark={...Lq.mark,[QK.bar3d]:{name:QK.bar3d,type:R$.rect3d}};_barMarkName=QK.bar3d;_barMarkType=R$.rect3d}function fJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===Gh.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===Gh.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===Gh.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===Gh.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",qX.Series)}class mJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class yJ extends ZZ{static type=tq.rangeColumn;type=tq.rangeColumn;_barMarkType=R$.rect;_barName=tq.bar;static mark={...ZZ.mark,[QK.minLabel]:{name:QK.minLabel,type:R$.text},[QK.maxLabel]:{name:QK.maxLabel,type:R$.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(yJ.mark.bar,{morph:XZ(this._spec.animation,this._spec.morph,GZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===c$.bothEnd?void 0:L({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===c$.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(yJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(yJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});fJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});fJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===Gh.horizontal?(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.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===Gh.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.rangeColumn({direction:this.direction},e),GZ(QK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new mJ(this)}}wK.useMark([pJ]);class _J extends yJ{static type=tq.rangeColumn3d;type=tq.rangeColumn3d;_barMarkType=R$.rect3d;_barName=tq.bar3d}class vJ extends cJ{static type=R$.area;type=vJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}wK.useMark([dJ,vJ,qZ,aJ]);class bJ extends Oq{static type=tq.area;type=tq.area;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(bJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Vh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Vh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(WZ(NZ.area(t,e),GZ(QK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}}j(bJ,lJ);class xJ extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class SJ extends bJ{static type=tq.rangeArea;type=tq.rangeArea;static mark={...bJ.mark};initMark(){this._areaMark=this._createMark(SJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new xJ(this)}}Ar();const wJ={},AJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function kJ(t,e){t&&f(t)||al("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(wJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Ar().projection(n),n.copy=n.copy||function(){const t=i();return AJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),wJ[i]||null}const MJ={albers:Wr,albersusa:function(){var t,e,i,n,s,r,a=Wr(),o=Vr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Vr().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(MJ).forEach((t=>{kJ(t,MJ[t])}));const CJ="Feature",TJ="FeatureCollection";function EJ(t){const e=N(t);return 1===e.length?e[0]:{type:TJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===TJ?t.features:N(t).filter((t=>!h(t))).map((t=>t.type===CJ?t:{type:CJ,geometry:t}))}(e))),[])}}const PJ=AJ.concat(["pointRadius","fit","extent","size"]);function RJ(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{PJ.includes(n)&&(i=i.concat(LN(t[n],e)))})),i):i}const BJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(h(i))for(let i=0;i(l(t),t)))};class IJ extends Lq{type=tq.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;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){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(h(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(h(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return h(r)||isNaN(r.x)||isNaN(r.y)?null:r}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){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Kj}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const DJ=(t,e)=>(t.features&&t.features.forEach((t=>{e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class LJ extends Sq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class OJ extends KK{static type=R$.path;type=OJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var FJ,zJ,HJ;wK.useMark([OJ,qZ]),FJ="projection",zJ=class extends CW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return h(this.spec.pointRadius)||this.detach(LN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(LN(t,this.view)),this.commit(),this}size(t){return h(this.spec.size)||this.detach(LN(this.spec.size,this.view)),this.spec.size=t,this.attach(LN(t,this.view)),this.commit(),this}extent(t){return h(this.spec.extent)||this.detach(LN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(LN(t,this.view)),this.commit(),this}fit(t){return h(this.spec.fit)||this.detach(LN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(LN(t,this.view)),this.commit(),this}configure(t){return this.detach(RJ(this.spec,this.view)),h(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(RJ(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=kJ((t||"mercator").toLowerCase());return e||al("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),AJ.forEach((t=>{var i,n,s;h(this.spec[t])||(i=this.projection,n=t,s=FN(this.spec[t],e,kJ),l(i[n])&&i[n](s))})),h(this.spec.pointRadius)||this.projection.path.pointRadius(FN(this.spec.pointRadius,e,kJ)),!(h(this.spec.fit)||h(this.spec.extent)&&h(this.spec.size))){const t=EJ(FN(this.spec.fit,e,kJ));this.spec.extent?this.projection.fitExtent(FN(this.spec.extent,e,kJ),t):this.spec.size&&this.projection.fitSize(FN(this.spec.size,e,kJ),t)}return this.projection}output(){return this.projection}},HJ="projections",yX[FJ]={grammarClass:zJ,specKey:null!=HJ?HJ:FJ};class jJ extends IJ{static type=tq.map;type=tq.map;static mark={...Lq.mark,[QK.area]:{name:QK.area,type:R$.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(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.map)throw new Error(`map type '${this.map}' is not specified !`);if(!oK.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),rK(this._dataSet,"copyDataView",dK),rK(this._dataSet,"map",DJ),rK(this._dataSet,"lookup",BJ);const t=oK.get(this.map);if(!t)throw Error("no valid map data found!");const e=new Vo(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??$X,XX],as:[this.nameField,this.valueField,this._seriesField??$X,XX]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new Tq(this._option,e)}initMark(){this._pathMark=this._createMark(jJ.mark.area,{morph:XZ(this._spec.animation,this._spec.morph,GZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(jJ.mark.label,{skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>c(t[this._seriesField??$X])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??$X]):this._theme?.defaultFillColor,path:this.getPath.bind(this)},"normal",qX.Series),this.setMarkStyle(t,{smoothScale:!0},"normal",qX.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(WZ(NZ.path(),GZ(QK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initTooltip(){this._tooltipHelper=new LJ(this)}getPath(t){const e=this._areaCache.get(t?.properties?.[this._nameProperty]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t?.properties?.[this._nameProperty],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===R$.path?s.forEach((t=>{t.getGraphicItem().scale(e,e,i)})):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===R$.path?n.forEach((t=>{t.getGraphicItem().translate(e[0],e[1])})):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return b(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]??t.properties?.[this.nameField]??""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return t=>t?.properties?.[this._nameProperty]}}class NJ extends Lq{coordinate="polar";_outerRadius=kN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=c(t)?N(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=c(t)?N(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=N(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(h(t)||h(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(t)),n=this.radiusAxisHelper.dataToPosition(N(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};zl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};zl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),c(this._spec.radius)&&(this._outerRadius=this._spec.radius),c(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Go(t.angleField,i)&&Go(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const VJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=xl(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}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},WJ=(t,e)=>{const i=t[0].latestData;return new UJ(e.series,i).updateLabels()};class GJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class UJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=b$(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[eN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:c}=n;if("inside"!==t?.position){const t=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_HOVER),n.middleAngle),i=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_SELECTED),n.middleAngle),a=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_NORMAL),n.middleAngle);s[cN]=a.x,s[dN]=a.y,s[lN]=t.x,s[hN]=t.y,s[mN]=i.x,s[yN]=i.y,s[uN]=l.x,s[pN]=l.y,s[gN]=c.x,s[fN]=c.y,s[nN]=r.y-o.height/2}else s[nN]=r.y;return s[Qj]=this._computeAlign(n),s[Jj]=Math.max(a,0),s[eN]=n.labelVisible&&!h(n.labelText),s[iN]=r.x,s[tN]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=kl(e.x,e.y,f,t.middleAngle),t.labelLimit=p,at(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=Ml(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=Ml(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(ot(t.pointB.x,n+r)||at(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.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 r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?bl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=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}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?h(i)||"auto"===i?"edge"===n?Ml(t.quadrant)?"left":"right":Ml(t.quadrant)?"right":"left":i:h(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=h(n)||h(t[n])||h(t[s]);return l(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class YJ extends KK{type=XJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),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{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+Al({angle:e[_N],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class XJ extends YJ{static type=R$.arc;type=XJ.type}wK.useMark([OJ,qZ,XJ]);class $J extends NJ{_pieMarkName=QK.pie;_pieMarkType=R$.arc;static mark={...Lq.mark,[QK.pie]:{name:QK.pie,type:R$.arc},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=xN;_endAngle=SN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=c(t),r=c(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}}(c(this._spec?.startAngle)?Sl(this._spec.startAngle):this._startAngle,c(this._spec?.endAngle)?Sl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=c(this._spec?.padAngle)?Sl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;rK(this._dataSet,"pie",VJ),rK(this._dataSet,"arcLabel",WJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:rN,asEndAngle:aN,asRatio:sN,asMiddleAngle:_N,asRadian:bN,asQuadrant:vN,asK:oN}},!1);const e=new Vo(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${Kj}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new Tq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...$J.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark($J.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark($J.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Wh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Wh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this)},void 0,qX.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(VX.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){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}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${Kj}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${Kj}_ARC_LABEL_${e}_AY`])} L${Math.round(t[uN])},${Math.round(t[pN])} L${Math.round(t[gN])},${Math.round(t[fN])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(h(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=Al({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=Al({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===fK.appear)return this._startAngle;if(i===fK.disappear)return this._endAngle;const n=[fK.disappear,fK.exit],s=e.mark.elements,r=t,a=r?.[YX];if(void 0===s.find((t=>t.data[0]?.[YX]t.data[0]?.[YX]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[YX]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class KJ extends $J{static type=tq.pie;type=tq.pie}class qJ extends YJ{static type=R$.arc3d;type=qJ.type}wK.useMark([OJ,qZ,qJ]);class ZJ extends $J{static type=tq.pie3d;type=tq.pie3d;_pieMarkName=QK.pie3d;_pieMarkType=R$.arc3d;static mark={...Lq.mark,[QK.pie3d]:{name:QK.pie3d,type:R$.arc3d},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Ol(iN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Ol(nN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this),...n},void 0,qX.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const JJ=[10,20],QJ=Fl.Linear,tQ="circle",eQ=Fl.Ordinal,iQ=["circle","square","triangle","diamond","star"];wK.useMark([aJ,qZ]);class nQ extends Oq{static type=tq.scatter;type=tq.scatter;static mark={...Lq.mark,[QK.point]:{name:QK.point,type:R$.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if(l(e))return e;if(m(e)){if(h(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${Kj}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(d(e)){if(h(t))throw new Error(`${s}Field is required.`);const r={id:`${Kj}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return h(e)?10:v(e)?e:!f(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:QJ,defaultRange:JJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return h(e)?tQ:f(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:eQ,defaultRange:iQ},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(nQ.mark.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(WZ(NZ.scatter({},t),GZ(QK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:v(this._size)||l(this._size)?this._size:10,shape:f(this._shape)||l(this._shape)?this._shape:tQ},yK.STATE_NORMAL,qX.Series),(c(this._sizeField)||c(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},yK.STATE_NORMAL,qX.User_Mark),(c(this._shapeField)||c(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},yK.STATE_NORMAL,qX.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},yK.STATE_NORMAL,qX.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class sQ extends NJ{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(JX),this.setInnerRadiusField(ZX)}setValueFieldToPercent(){this.setRadiusField(t$),this.setInnerRadiusField(QX)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}wK.useMark([XJ,qZ]);class rQ extends sQ{static type=tq.rose;type=tq.rose;static mark={...ZZ.mark,[QK.rose]:{name:QK.rose,type:R$.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(rQ.mark.rose,{morph:XZ(this._spec.animation,this._spec.morph,GZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(rQ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Vh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(wl(e)??0)+90},void 0,qX.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(WZ(NZ.rose(e,t),GZ(QK.rose,this._spec)))}}}wK.useMark([vJ,dJ,aJ,qZ]);class aQ extends sQ{static type=tq.radar;type=tq.radar;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(aQ.mark.area,{progressive:t,isSeriesMark:e})}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._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:F$},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:Sl(this._spec.startAngle)??xN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.radarGroup(t,e),GZ(QK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(c(i)){const s=NZ[n];i.setAnimationConfig(WZ(s(t,e),GZ(i.name,this._spec)))}}))}}j(aQ,lJ);class oQ extends Sq{updateTooltipSpec(){super.updateTooltipSpec(),c(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>Wo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const lQ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},hQ={fill:"#bbb",fillOpacity:.2};wK.useMark([aJ,qZ,JZ,KZ]);class cQ extends Oq{static type=tq.dot;type=tq.dot;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.grid]:{name:QK.grid,type:R$.rule},[QK.gridBackground]:{name:QK.gridBackground,type:R$.rect},[QK.dot]:{name:QK.dot,type:R$.symbol},[QK.title]:{name:QK.title,type:R$.text},[QK.subTitle]:{name:QK.subTitle,type:R$.text},[QK.symbol]:{name:QK.symbol,type:R$.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){c(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){c(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){c(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){c(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){c(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),rK(this._option.dataSet,"objFlat",lQ),rK(this._option.dataSet,"copyDataView",dK),aK(this._option.dataSet,"dataview",Fo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){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(L(hQ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(cQ.mark.group),this._containerMark=this._createMark(cQ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cQ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cQ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cQ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cQ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cQ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cQ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",qX.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i));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",qX.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",qX.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(o))}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){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??$X}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new oQ(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class dQ extends Sq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>Wo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}wK.useMark([JZ,aJ]);class uQ extends Oq{static type=tq.link;type=tq.link;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.link]:{name:QK.link,type:R$.rule},[QK.arrow]:{name:QK.arrow,type:R$.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){c(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){c(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){c(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();rK(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(uQ.mark.group),this._containerMark=this._createMark(uQ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(uQ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(uQ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",qX.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?z$.triangleDown:z$.triangleUp},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new dQ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class pQ extends NJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=Sl(this._spec.startAngle)??Sl(t?.startAngle)??xN,this._endAngle=Sl(this._spec.endAngle)??Sl(t?.endAngle)??SN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||c(n?.startAngle)||c(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[ZX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[JX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class gQ extends YJ{static type=R$.arc;static constructorType=R$.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){c(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),c(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const h=c(t.innerPadding)&&c(a)||c(t.outerPadding)&&c(o),d=c(t.innerRadius)&&s||c(t.outerRadius)&&r;if(h||d){const e=Object.assign({},t);return s&&c(a)&&(l(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+(l(s)?s(t,e,i,n):s):l(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&c(o)&&(l(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-(l(r)?r(t,e,i,n):r):l(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}wK.useMark([XJ,gQ]);class fQ extends pQ{static type=tq.circularProgress;type=tq.circularProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.progressArc},[QK.progress]:{name:QK.progress,type:R$.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(fQ.mark.track),this._progressMark=this._createMark(fQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}}class mQ extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}wK.useMark([KZ]);class yQ extends Oq{static type=tq.linearProgress;type=tq.linearProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.rect},[QK.progress]:{name:QK.progress,type:R$.rect},[QK.group]:{name:QK.group,type:R$.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(yQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(yQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(yQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Vh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(hB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Vh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(hB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",qX.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.linearProgress(t,e),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}initTooltip(){this._tooltipHelper=new mQ(this)}}const _Q=[0],vQ=[20,40],bQ=[200,500],xQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},SQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],wQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:AQ,triangle:AQ,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 AQ(){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 kQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const MQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function CQ(t){return l(t)?t:function(){return t}}class TQ{constructor(t){var e,i;switch(this.options=Object.assign({},TQ.defaultOptions,t),l(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>wQ[t]?wQ[t]():wQ.circle())(this.options.shape),this.getText=null!==(e=CQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=CQ(this.options.fontWeight),this.getTextFontSize=CQ(this.options.fontSize),this.getTextFontStyle=CQ(this.options.fontStyle),this.getTextFontFamily=CQ(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=CQ(this.options.color)}if(h(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=l(this.options.rotate)?t=>{var e;return Gt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Gt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!h(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class PQ extends TQ{constructor(t){var e;super(Object.assign({},PQ.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.spiral=f(this.options.spiral)?null!==(e=EQ[this.options.spiral])&&void 0!==e?e:EQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=CQ(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:n}=kQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));for(this.data=r;s>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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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>=n)s&&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(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(IQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}DQ(p,this._size)&&(p=LQ(p,this._size))}else if(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||BQ(p,i))&&(!i||!RQ(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function RQ(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function BQ(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,DQ=(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 LQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),U(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:n}=kQ(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}FQ.defaultOptions={enlarge:!1};const HQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?NQ(t.fontFamily):"sans-serif",u=t.fontStyle?NQ(t.fontStyle):"normal",p=t.fontWeight?NQ(t.fontWeight):"normal",g=t.rotate?NQ(t.rotate):0,f=NQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?NQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",b=null!==(r=t.shrink)&&void 0!==r&&r,x=null!==(a=t.enlarge)&&void 0!==a&&a,S=null!==(o=t.clip)&&void 0!==o&&o,w=null!==(l=t.minFontSize)&&void 0!==l?l:0,A=t.randomVisible,k=t.as||HQ,M=t.depth_3d,C=t.postProjection;let T=t.fontSize?NQ(t.fontSize):14;const E=t.fontSizeRange;if(E&&!v(T)){const t=T;T=e=>VQ(t(e),WQ(t,h),E)}let P=PQ;"fast"===t.layoutType?P=FQ:"grid"===t.layoutType&&(P=OQ);const R=new P({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:T,shrink:b,clip:S,enlarge:x,minFontSize:w,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},NQ=t=>f(t)||v(t)||l(t)?t:e=>e[t.field],VQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],WQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function GQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),XQ=(t,e)=>{let i=0;for(const e of t)YQ(e)?i+=1:i+=.53;return i};function $Q(t){return x(t)?new Promise(((e,i)=>{const n=pB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{We.getInstance().error("image 加载失败!",t)}})):null}var KQ=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 qQ(t){return KQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield $Q(e);r&&(a=yield function(t,e,i){return KQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&JQ(s,n,a-1);)--a;for(;oo&&QQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield $Q(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||ZQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function ZQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function JQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||n0(e,t,r)))return i0(e,t,r),!0}return!1}function i0(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function n0(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function s0(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,m;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(d=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function r0(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?t0(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=r0(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return t0(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){s0(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!n0(i,y,_)&&(i0(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var l0=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())}))};const h0={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},c0=(t,e,i,n)=>l0(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||al("WordcloudShape shape must be specified."),t.text||al("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(UQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||h0;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=gj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield qQ(l),p=t.colorMode||"ordinal",g={getText:f0(t.text),getFontSize:f0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?f0(t.colorField):f0(t.text),getFillingColor:f0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:f0(t.colorHexField),getFontFamily:f0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:f0(t.padding||1),getFontStyle:f0(t.fontStyle||"normal"),getFontWeight:f0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?f0(t.fontOpacity):()=>1};u0(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:f0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:f0(t.fillingFontStyle||"normal"),getFillingFontWeight:f0(t.fillingFontWeight||"normal"),getFillingPadding:f0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=XQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,P=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),R=Math.max(...P.map((t=>t.fontSize)));P.forEach((t=>t.weight=t.fontSize/R)),P.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield o0(P,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(UQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),d0=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new Wl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Wl).domain(e).range(f).scale(t)}}else(new _h).domain(g0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new _h).domain(g0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},u0=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new Mh).domain(g0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&l(s)&&!n){const e=.5,[o,l]=(i.shapeArea,g0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=p0(h,i,!0);n=[~~(e*c),~~c];const d=(new Mh).domain(g0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=p0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},p0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=XQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},f0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:l(t)?t:e=>e[t.field]:null,m0=`${Kj}_WORD_CLOUD_ANGLE`,y0=`${Kj}_WORD_CLOUD_FILLING_ANGLE`,_0=`${Kj}_WORD_CLOUD_WEIGHT`,v0=`${Kj}_WORD_CLOUD_TEXT`;wK.useMark([qZ]),TN("wordcloud",{transform:jQ,markPhase:"beforeJoin"},!0),TN("wordcloudShape",{transform:c0,markPhase:"beforeJoin"},!0);class b0 extends Lq{static mark={...Lq.mark,[QK.word]:{name:QK.word,type:R$.text},[QK.fillingWord]:{name:QK.fillingWord,type:R$.text}};_nameField;_valueField;setValueField(t){c(t)&&(this._valueField=t,this.setFontSizeRange(vQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){c(t)&&c(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??bQ,this._rotateAngles=this._spec.rotateAngles??_Q,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:xQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:_Q,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!SQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(b0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?v0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud(),GZ(QK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??$X};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:XX,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?v0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:Zo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class x0 extends b0{static type=tq.wordCloud;type=tq.wordCloud}class S0 extends b0{static type=tq.wordCloud3d;type=tq.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(b0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.fillingWord,this._spec)))}}const w0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=b(y*f)?y/f:null,x=b(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:x),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},A0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},k0=`${Kj}_FUNNEL_TRANSFORM_RATIO`,M0=`${Kj}_FUNNEL_REACH_RATIO`,C0=`${Kj}_FUNNEL_HEIGHT_RATIO`,T0=`${Kj}_FUNNEL_VALUE_RATIO`,E0=`${Kj}_FUNNEL_LAST_VALUE_RATIO`,P0=`${Kj}_FUNNEL_NEXT_VALUE_RATIO`,R0=`${Kj}_FUNNEL_LAST_VALUE`,B0=`${Kj}_FUNNEL_CURRENT_VALUE`,I0=`${Kj}_FUNNEL_NEXT_VALUE`,D0=`${Kj}_FUNNEL_TRANSFORM_LEVEL`,L0=20;class O0 extends Sq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===QK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===QK.transform){const e=t?.[M0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===QK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])?t?.[n[0]]:t?.[s]}}class F0 extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class z0 extends F0{static type=R$.polygon;type=z0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}wK.useMark([z0,qZ,JZ]);class H0 extends Lq{static type=tq.funnel;type=tq.funnel;_funnelMarkName=QK.funnel;_funnelMarkType=R$.polygon;_transformMarkName=QK.transform;_transformMarkType=R$.polygon;static mark={...Lq.mark,[QK.funnel]:{name:QK.funnel,type:R$.polygon},[QK.transform]:{name:QK.transform,type:R$.polygon},[QK.transformLabel]:{name:QK.transformLabel,type:R$.text},[QK.outerLabel]:{name:QK.outerLabel,type:R$.text},[QK.outerLabelLine]:{name:QK.outerLabelLine,type:R$.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"funnel",w0),rK(this._dataSet,"funnelTransform",A0);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new Tq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:B0,asTransformRatio:k0,asReachRatio:M0,asHeightRatio:C0,asValueRatio:T0,asNextValueRatio:P0,asLastValueRatio:E0,asLastValue:R0,asNextValue:I0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:D0}})}initMark(){if(this._funnelMark=this._createMark({...H0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...H0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(H0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(H0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(H0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(H0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new O0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>c(t[this._valueField]),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Ol(M0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",qX.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",qX.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),GZ(QK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(WZ(NZ.funnel({},t),GZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(WZ(NZ.label(),GZ(QK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[E0])/2:this._getSecondaryAxisLength(t[T0])/2,s=this._getSecondaryAxisLength(t[T0])/2):(n=this._getSecondaryAxisLength(t[T0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[P0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[D0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return c(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!c(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(v(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-L0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series)}}function V0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=U0(t.children,u.children,i+1,o,u,r);u.value=h(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else u.isLeaf=!0,u.value=h(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:l,flattenIndex:o}},Y0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=Y0(t.children,e,t,s))})),n},X0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=X0(t.children,e,t,s)),s=e(t,n,i,s)})),s},$0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:V0,slice:W0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?W0:V0)(t,e,i,n,s)}};class K0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=m(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=m(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=m(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=m(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},K0.defaultOpionts,t);const i=this.options.nodeKey,n=l(i)?i:i?ll(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?G0(this.options.aspectRatio):null!==(e=$0[this.options.splitType])&&void 0!==e?e:$0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=U0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(v(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(v(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)}))}}K0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const q0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class Z0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];V0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),q0);const n=m(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],n)return this._layoutLabel(t,o(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},Z0.defaultOpionts,t):Object.assign({},Z0.defaultOpionts);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+ml(this.options.center[0],t.width),n=t.y0+ml(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=m(r),l=o?r.map((t=>ml(t,s))):ml(r,s),c=m(a),d=this.options.gapRadius,u=c?a.map((t=>ml(t,s))):ml(a,s),p=Y(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return h(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:ih(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(m(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=ml(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(m(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=U0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("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=$t({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}Z0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const J0=4294967296;function Q0(t,e){let i,n;if(i1(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function i1(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function a1(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function o1(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function l1(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function h1(t){return{_:t,next:null,prev:null}}function c1(t,e){const i=(t=N(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];a1(s,n,r);let a,o,l,h,c,d,u,p=h1(n),g=h1(s),f=h1(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:m(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="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 h=[],c=U0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%J0)/J0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=l(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:g1.defaultOpionts.nodeSort;Y0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)Y0([u],d1(this.options.setRadius)),X0([u],u1(this._getPadding,.5,d)),Y0([u],p1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);Y0([u],d1(g1.defaultOpionts.setRadius)),X0([u],u1(cl,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&X0([u],u1(this._getPadding,u.radius/t,d)),Y0([u],p1(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}g1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const f1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):f1(t.children,e,i)))})),e},m1=(t,e={})=>{if(!t)return[];const i=[];return f1(t,i,e),i},y1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new Z0(i).layout(t,{width:n,height:s})};class _1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var v1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(v1||(v1={}));const b1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(h(s))return t;if(i.type===v1.DrillDown){return N(k$(t,s,n,"children"))}if(i.type===v1.DrillUp){const e=M$(t,s,n,"children");if(e)return N(e)}return t};class x1{pointerId;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(){}parserDragEvent(){return!0}}class S1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const w1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1}};class A1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return w1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===un.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;rK(t,"drillFilter",b1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(h(t.datum)||h(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!m(t)||M(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:v1.DrillDown},e().reRunAllTransform(),i.emit(VX.drill,{value:{path:t,type:v1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!m(i)||M(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:v1.DrillUp},t().reRunAllTransform(),e.emit(VX.drill,{value:{path:i,type:v1.DrillUp},model:this}),i}}wK.useMark([XJ,qZ]);class k1 extends NJ{static type=tq.sunburst;type=tq.sunburst;static mark={...Lq.mark,[QK.sunburst]:{name:QK.sunburst,type:R$.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),this._startAngle=Gt(this._spec.startAngle),this._endAngle=Gt(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),rK(this._dataSet,"sunburstLayout",y1),rK(this._dataSet,"flatten",m1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[c(this._centerX)?this._centerX:this.getLayoutRect().width/2,c(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(k1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){h(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.y+(c(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(k1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return d(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(c(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},yK.STATE_NORMAL,qX.Series)}initTooltip(){this._tooltipHelper=new _1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((i=>{i.setAnimationConfig(WZ(NZ.sunburst(t,e),GZ(i.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(m(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}j(k1,A1);const M1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new g1(i).layout(t,{width:n,height:s})};class C1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}wK.useMark([XJ,qZ]);class T1 extends Oq{static type=tq.circlePacking;type=tq.circlePacking;static mark={...Lq.mark,[QK.circlePacking]:{name:QK.circlePacking,type:R$.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,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();h(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"circlePackingLayout",M1),rK(this._dataSet,"flatten",m1),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(T1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){h(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},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(T1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},yK.STATE_NORMAL,qX.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new C1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((e=>{e.setAnimationConfig(WZ(NZ.circlePacking({},t),GZ(e.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}j(T1,A1);const E1=t=>{let e=0;return t.forEach(((t,i)=>{var n;h(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=E1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function P1(t){return t.depth}function R1(t,e){return e-1-t.endDepth}const B1=(t,e)=>t.y0-e.y0,I1={left:P1,right:R1,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?W(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:P1,end:R1};class D1{constructor(t){this._ascendingSourceBreadth=(t,e)=>B1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D1.defaultOptions,t);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._alignFunc=l(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I1[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];E1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(h(s.source)||h(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(f(e)){const t=ct(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(v(e)){if(r=e,v(i))a=i;else if(h(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else l(e)&&v(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}h(this.options.nodeSortBy)&&s.sort(B1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},O1=(t,e)=>{if(!t||!e?.view||!m(t))return t;const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new D1(e),s=[];return s.push(n.layout(t,i)),s},F1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],z1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class H1 extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(v(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class j1 extends KK{static type=R$.linkPath;type=j1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){$N("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),qV("linkPathGrowIn",aW),qV("linkPathGrowOut",oW),qV("linkPathUpdate",lW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}wK.useMark([KZ,j1,qZ]),TN("sankey",{transform:L1,markPhase:"beforeJoin"},!0);class N1 extends Oq{static type=tq.sankey;type=tq.sankey;static mark={...ZZ.mark,[QK.node]:{name:QK.node,type:R$.rect},[QK.link]:{name:QK.link,type:R$.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=r$.Node;_labelLayoutZIndex=r$.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Vt;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){rK(this._dataSet,"sankey",O1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new jo;aK(t,"dataview",Fo),rK(t,"sankeyNodes",F1),rK(t,"addVChartProperty",uq);const e=new Vo(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._nodesSeriesData=new Tq(this._option,e);const i=new jo;aK(i,"dataview",Fo),rK(i,"sankeyLinks",z1),rK(i,"addVChartProperty",uq);const n=new Vo(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._linksSeriesData=new Tq(this._option,n)}}initMark(){const t=this._createMark(N1.mark.node,{isSeriesMark:!0,key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(N1.mark.link,{key:YX,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(N1.mark.label,{key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},yK.STATE_NORMAL,qX.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},yK.STATE_NORMAL,qX.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(WZ(NZ.sankeyNode(t,e),GZ(QK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(WZ(NZ.sankeyLinkPath(),GZ(QK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:GX.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:GX.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(N(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||N(s[r]).includes(e.source)&&N(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(N(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new H1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Ih(this._option.getTheme().colorScheme,this.type),n=new Hh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const V1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new K0(e).layout(t,i)},W1=(t,e)=>{let i={},n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=m1(s);return i=Mq([{latestData:r}],e),i};class G1 extends Sq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class U1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,w1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return w1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;h(s)||Yh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){w1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){w1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;h(s)&&h(r)||Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:GX.chart},(t=>{if(!t.event)return;const{event:n}=t;Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:GX.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){w1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:GX.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:GX.chart,source:WX.chart},l),this._eventObj.off(n,{level:GX.chart,source:WX.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:GX.chart,source:WX.chart},l),this._eventObj.on(n,{level:GX.chart,source:WX.chart},o)}}wK.useMark([KZ,qZ]);class Y1 extends Oq{static type=tq.treemap;type=tq.treemap;static mark={...Lq.mark,[QK.nonLeaf]:{name:QK.nonLeaf,type:R$.rect},[QK.leaf]:{name:QK.leaf,type:R$.rect},[QK.nonLeafLabel]:{name:QK.nonLeafLabel,type:R$.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Vt;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qt),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),b(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"treemap",V1),rK(this._dataSet,"flatten",m1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){rK(this._dataSet,"hierarchyDimensionStatistics",W1),rK(this._dataSet,"flatten",m1);const i=new Vo(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initMark(){const t=this._createMark(Y1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(Y1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(Y1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(Y1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},yK.STATE_NORMAL,qX.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()},yK.STATE_NORMAL,qX.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}initAnimation(){this.getMarksInType(R$.rect).forEach((t=>{t.setAnimationConfig(WZ(NZ.treemap(),GZ(t.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}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 G1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(hV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(hV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}j(Y1,U1),j(Y1,A1),wK.useMark([OJ,KZ]);class X1 extends pQ{static type=tq.gaugePointer;type=tq.gaugePointer;static mark={...Lq.mark,[QK.pin]:{name:QK.pin,type:R$.path},[QK.pinBackground]:{name:QK.pinBackground,type:R$.path},[QK.pointer]:{name:QK.pointer,type:[R$.path,R$.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?R$.rect:R$.path}initMark(){this._pinBackgroundMark=this._createMark(X1.mark.pinBackground),this._pointerMark=this._createMark({...X1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(X1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===R$.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return c(this.radiusAxisHelper)&&c(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.pointer,this._spec)))}}wK.useMark([gQ]);class $1 extends pQ{static type=tq.gauge;type=tq.gauge;static mark={...Lq.mark,[QK.segment]:{name:QK.segment,type:R$.progressArc},[QK.track]:{name:QK.track,type:R$.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=Sl(this._spec.padAngle??0)}initData(){super.initData();rK(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[s$]=t[this._angleField[0]],t[n$]=e>0?i[e-1][s$]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark($1.mark.track),this._segmentMark=this._createMark($1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(c(t[n$])?this.angleAxisHelper.dataToPosition([t[n$]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[s$]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.segment,this._spec)))}}class K1 extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return c(i)&&"dimension"===t&&(i.visible=!1),i}}class q1 extends rJ{static type=R$.cell;type=q1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}wK.useMark([q1,qZ]);class Z1 extends Oq{static type=tq.heatmap;type=tq.heatmap;static mark={...Lq.mark,[QK.cell]:{name:QK.cell,type:R$.cell},[QK.cellBackground]:{name:QK.cellBackground,type:R$.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=N(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(Z1.mark.cell,{morph:XZ(this._spec.animation,this._spec.morph,GZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(Z1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=Ge(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",qX.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(WZ(NZ.heatmap(t),GZ(QK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new K1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}wK.useSeries([bJ]);class J1 extends rq{static type=eq.area;static view="singleDefault";type=eq.area;seriesType=tq.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([ZZ]);class Q1 extends rq{static type=eq.bar;static view="singleDefault";type=eq.bar;seriesType=tq.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class t2 extends rq{static type=eq.bar3d;static view="singleDefault";type=eq.bar3d;seriesType=tq.bar3d}wK.useSeries([oJ]);class e2 extends rq{static type=eq.boxPlot;static view="singleDefault";type=eq.boxPlot;seriesType=tq.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??Gh.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===Gh.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),aq(t)}}wK.useSeries([T1]);class i2 extends sq{static type=eq.circlePacking;static view="singleDefault";type=eq.circlePacking;seriesType=tq.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=tq.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class n2 extends sq{static type=eq.common;static view="singleDefault";type=eq.common}class s2 extends sq{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([H0]);class r2 extends s2{static type=eq.funnel;static view="singleDefault";type=eq.funnel;seriesType=tq.funnel}wK.useSeries([N0]);class a2 extends s2{static type=eq.funnel3d;static view="singleDefault";type=eq.funnel3d;seriesType=tq.funnel3d}const o2={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function l2(t){let e=0;return C(t,"tick.visible")&&(e+=C(t,"tick.tickSize")),C(t,"label.visible")&&(e+=C(t,"label.space")),e}function h2(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function c2(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function d2(t){const e=t?.orient;return"angle"===e||"radius"===e}const u2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},j$(t)?r:a)},p2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class g2 extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=N(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return c(i)&&e.forEach((t=>{h(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));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],c(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class f2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),h(n.angle.type)&&(n.angle.type="linear"),h(n.radius.type)&&(n.radius.type="band");const s=h2(n.angle,{min:0,max:1});h(n.angle.min)&&(n.angle.min=s.min),h(n.angle.max)&&(n.angle.max=s.max)}}wK.useSeries([X1,$1]);class m2 extends f2{static type=eq.gauge;static view="singleDefault";type=eq.gauge;seriesType=tq.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:tq.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===tq.gauge||t.type===tq.circularProgress));h(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&h(e.radiusField)&&h(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===tq.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),h(e.angle.type)&&(e.angle.type="linear"),h(e.radius.type)&&(e.radius.type="linear")}}wK.useSeries([Z1]);class y2 extends rq{static type=eq.heatmap;static view="singleDefault";type=eq.heatmap;seriesType=tq.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class _2 extends rq{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}wK.useSeries([ZZ]);class v2 extends _2{static type=eq.histogram;static view="singleDefault";type=eq.histogram;seriesType=tq.bar;transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class b2 extends _2{static type=eq.histogram3d;static view="singleDefault";type=eq.histogram3d;seriesType=tq.bar3d}wK.useSeries([uJ]);class x2 extends rq{static type=eq.line;static view="singleDefault";type=eq.line;seriesType=tq.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([jJ]);class S2 extends sq{static type=eq.map;static view="singleDefault";type=eq.map;seriesType=tq.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area}}isValidSeries(t){return t===tq.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class w2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}wK.useSeries([KJ]);class A2 extends w2{static type=eq.pie;static view="singleDefault";type=eq.pie;seriesType=tq.pie}wK.useSeries([ZJ]);class k2 extends w2{static type=eq.pie3d;static view="singleDefault";type=eq.pie3d;seriesType=tq.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}wK.useSeries([fQ]);class M2 extends f2{static type=eq.circularProgress;static view="singleDefault";type=eq.circularProgress;seriesType=tq.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}wK.useSeries([yQ]);class C2 extends rq{static type=eq.linearProgress;static view="singleDefault";type=eq.linearProgress;seriesType=tq.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="band"),h(e.type)&&(e.type="linear");const n=h2(e,{min:0,max:1});h(e.min)&&(e.min=n.min),h(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="linear"),h(e.type)&&(e.type="band");const n=h2(i,{min:0,max:1});h(i.min)&&(i.min=n.min),h(i.max)&&(i.max=n.max)}}}class T2 extends g2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}wK.useSeries([aQ]);class E2 extends T2{static type=eq.radar;static view="singleDefault";type=eq.radar;seriesType=tq.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:L({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}wK.useSeries([SJ]);class P2 extends rq{static type=eq.rangeArea;static view="singleDefault";type=eq.rangeArea;seriesType=tq.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([yJ]);class R2 extends rq{static type=eq.rangeColumn;static view="singleDefault";type=eq.rangeColumn;seriesType=tq.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([_J]);class B2 extends rq{static type=eq.rangeColumn3d;static view="singleDefault";type=eq.rangeColumn3d;seriesType=tq.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}wK.useSeries([rQ]);class I2 extends T2{static type=eq.rose;static view="singleDefault";type=eq.rose;seriesType=tq.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??kN,outerRadius:t.outerRadius??kN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}wK.useSeries([N1]);class D2 extends sq{static type=eq.sankey;static view="singleDefault";type=eq.sankey;seriesType=tq.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([nQ]);class L2 extends rq{static type=eq.scatter;static view="singleDefault";type=eq.scatter;seriesType=tq.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}wK.useSeries([cQ,uQ]);class O2 extends sq{static type=eq.sequence;static view="singleDefault";type=eq.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==tq.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[tq.bar,tq.line,tq.area,tq.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===tq.dot?"band":"linear",visible:t.type!==tq.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===tq.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===tq.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=pK(t.data,this._dataSet,this._spec.data),t.type===tq.link&&(t.dataDot=pK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===tq.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===tq.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}wK.useSeries([k1]);class F2 extends sq{static type=eq.sunburst;static view="singleDefault";type=eq.sunburst;seriesType=tq.sunburst;getDefaultSeriesSpec(t){const e=c(t.startAngle)?t.startAngle:wN,i=c(t.endAngle)?t.endAngle:e+Ut(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=tq.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([Y1]);class z2 extends sq{static type=eq.treemap;static view="singleDefault";type=eq.treemap;seriesType=tq.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([QZ]);class H2 extends Q1{static type=eq.waterfall;static view="singleDefault";type=eq.waterfall;seriesType=tq.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&N(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),aq(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class j2 extends sq{type=eq.wordCloud;seriesType=tq.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([x0]);class N2 extends j2{static type=eq.wordCloud;static view="singleDefault";type=eq.wordCloud;seriesType=tq.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}wK.useSeries([S0]);class V2 extends j2{static type=eq.wordCloud3d;static view="singleDefault";type=eq.wordCloud3d;seriesType=tq.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class W2{plugins;id=el();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function G2(t){const e={...t};return M(t.style)||(e.textStyle=P$(t.style)),M(t.textStyle)||L(e.textStyle,P$(t.textStyle)),t.shape?.style&&P$(e.shape.style),t.background?.style&&P$(e.background.style),e}function U2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class Y2 extends IK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new W2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case un.cartesianBandAxis:return u2(W$(i),"band",e);case un.cartesianLinearAxis:return u2(W$(i),"linear",e);case un.cartesianAxis:case un.cartesianTimeAxis:return u2(W$(i),void 0,e);case un.polarBandAxis:return p2(i.orient,"band",e);case un.polarLinearAxis:return p2(i.orient,"linear",e);case un.polarAxis:return p2(i.orient,void 0,e);case un.cartesianCrosshair:case un.polarCrosshair:return e.component?.crosshair;case un.colorLegend:return e.component?.colorLegend[U2(i)];case un.sizeLegend:return e.component?.sizeLegend[U2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),m(this._originalSpec)?this._spec=this._originalSpec.map((t=>L({},this._theme,t))):this._spec=L({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:WX.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const X2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(h(a)||h(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},$2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{h(i[e])||t.latestData.forEach((t=>{N(i[e]).forEach((i=>{h(t[i])||(h(o[t[i]])&&(o[t[i]]=0),h(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class K2 extends Y2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=W$(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?Gh.horizontal:Gh.vertical)===Gh.horizontal,c(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(c(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):c(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),h(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(c(t)&&(c(t.userId)&&(this._seriesUserId=N(t.userId)),c(t.specIndex)&&(this._seriesIndex=N(t.specIndex))),c(this._spec.seriesId)){const t=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(c(this._spec.seriesIndex)){const t=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(c(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(c(this._spec.regionId)){const t=N(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(zl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};Ll(this._regions,(s=>{const r="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,a="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!r||!a)return;const o=r.getAxisId()===this._relatedAxisComponent.id?r:a.getAxisId()===this._relatedAxisComponent.id?a:this._isHorizontal?r:a,l=o===r?a:r,h=zl(l.getScale(0).type);t.push(s.getRawData());const c=s.getSpec(),d=N(c.xField),u=N(c.yField),p="cartesian"===s.coordinate?d[0]:c.angleField??c.categoryField,g="cartesian"===s.coordinate?u[0]:c.radiusField??c.valueField;if(n[s.id]="link"===s.type?"from_xField":o===r?p:g,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":l===r?p:g;i.push(h?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else h(this._spec.valueField),Ll(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;aK(n,"dataview",Fo),rK(n,"dataFilterComputeDomain",$2);const s=new Vo(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new YK(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&zl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&zl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new ah,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(rK(this._option.dataSet,"dataFilterWithNewDomain",X2),Ll(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>zl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ct(this._start-s,0,1),a=ct(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}j(K2,U1);class q2 extends K2{static type=un.scrollBar;type=un.scrollBar;name=un.scrollBar;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(h(i))return;if(!m(i))return new q2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new q2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new JW({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return h(i)||(n.padding=i),M(t?.style)||(n.railStyle=P$(t.style)),M(e?.style)||(n.sliderStyle=P$(e.style)),n}}class Z2 extends K2{static type=un.dataZoom;type=un.dataZoom;name=un.dataZoom;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;_startHandlerSize;_endHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(h(i))return;if(!m(i))return new Z2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new Z2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const t=this._spec.startHandler.style.visible??!0,e=this._spec.endHandler.style.visible??!0;this._startHandlerSize=t?this._spec.startHandler.style.size:0,this._endHandlerSize=e?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new _h;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e+i};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e+i};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new kU({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:P$(this._spec.background?.style),startHandlerStyle:P$(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:P$(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:P$(this._spec.middleHandler.background?.style)}},endHandlerStyle:P$(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:P$(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:P$(this._spec.endText?.style)},selectedBackgroundStyle:P$(this._spec.selectedBackground.style),dragMaskStyle:P$(this._spec.dragMask?.style),backgroundChartStyle:{line:L(P$(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:L(P$(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class J2 extends Y2{static type=un.customMark;type=un.customMark;layoutType="absolute";layoutZIndex=r$.CustomMark;layoutLevel=a$.CustomMark;static createComponent(t,e){return t.customMark?[new J2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`});if(s&&(h(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),c(t.dataId)||b(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class Q2 extends Y2{layoutType="absolute";static type=un.brush;type=un.brush;name=un.brush;layoutZIndex=r$.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!h(i)&&!1!==i.visible)return[new Q2(i,{...e,specKey:Q2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new SY({zIndex:this.layoutZIndex,brushStyle:P$(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=VX.brushChange;r="brushStart"===n||"brushDown"===n?VX.brushStart:"brushEnd"===n||"brushMaskUp"===n?VX.brushEnd:VX.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{...P$(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&Le(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&De(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){c(this._spec.regionId)&&c(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){c(this._spec.brushLinkSeriesId)&&c(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&N(t).includes(s.userId)||e&&N(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var t3;function e3(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function i3(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function n3(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:i3(t.rect),anchorCandidates:h3(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>e3(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;te3(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function s3(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=Be(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=o3(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=hn(r,n,i);if(!o3(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],r3(a3(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=r3(a3(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=l3(t.rect,a,0),t}));return n3(h)}function r3(t){return t>180?t-360:t}function a3(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function o3(t,e){for(let i=0;i{const{x:r,y:a}=l3({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(t3||(t3={}));class c3 extends Y2{static type=un.mapLabel;type=un.mapLabel;name=un.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=r$.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!c(i.series)?new c3(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new Vo(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new YK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new FU({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=qh(this._spec.background?.padding),d=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const u={},p=this.dataToPosition(t),g=aB({});if(g.name=`${this.name}_marker_itemContainer_${e}`,u.container=g,this._spec.background?.visible){const t=hB(P$({...this._spec.background.style}));t.setAttributes(p),u.labelBackground=t,g.appendChild(t)}if(this._spec.icon?.visible){const t=uB(P$({...this._spec.icon.style}));t.setAttributes(p),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;u.icon=t,g.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=dB(P$({...this._spec.nameLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.nameLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&c(t[this.valueField])){const e=dB(P$({...this._spec.valueLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.valueLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}const f=Object.values(u).find((t=>!!t&&"group"!==t.type)),m={x:f?.getComputedAttribute("x"),y:f?.getComputedAttribute("y")},y={x:m.x,y:m.y,width:0,height:0};y.width=n+r+(i-1)*d,y.height=s+a;const _={rect:y,point:m,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));_.rect=l3(y,o,l),_.anchors=t,_.offset=l}else _.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:_,contentMarks:u}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:P$({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):n3(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class d3{id;name;service;static Name;constructor(t=d3.Name){this.id=el(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function u3(t,e){const i=e.getSpec?.();M(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=j$(e.layoutOrient),r=t[0],a=V(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);u3(n?n.getChildren():[],t.component),u3(s?s.getChildren():[],t.component)}}function g3(t){return 2===t.length&&b(t[0])&&b(t[1])&&t[1]>=t[0]}function f3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!b(a.min),extendable_max:!b(a.max)}}function m3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function y3(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 _3(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 v3(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 b3=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),x3=(t,e,i=0)=>{const n=new Wt(t).expand(i/2),s=new Wt(e).expand(i/2);return n.intersects(s)},S3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function A3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=Sl(-90));const u=b$(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Wt).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},M3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return b3(p,r.options)};class C3 extends d3{Name="AxisSyncPlugin";constructor(){super(C3.Name)}_checkEnableSync(t){if(!zl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(VX.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!zl(i.type)||!zl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!g3(s)||!g3(r))return;const a=f3(t,s),o=f3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!y3(a,o))return}else if(0===p&&0===g){if(!y3(o,a))return}else if(u||y)if(u&&!y){if(!m3(a,o))return}else if(y&&!u){if(!m3(o,a))return}else{if(h===g)return;if(h>g){if(!_3(a,o))return}else if(!_3(o,a))return}else{if(0===h&&0===p){if(!v3(a,o))return}else if(0===g&&0===l&&!v3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){rK(e.getOption().dataSet,"tickAlign",M3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var T3={AxisLabelOverlapPlugin:p3,AxisSyncPlugin:C3};const E3=t=>t,P3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!w3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},R3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?S3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return b3(t.domain());let h;if(c(s))h=t.stepTicks(s);else if(c(n))h=t.forceTicks(n);else if(c(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=l2(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=l2(r),c=b$(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Bl(u),{x:m,y:y}=$t({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Wt).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=I3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}else h=t.domain();return b3(h)},I3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&x3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},D3=(t,e)=>{if(zl(t.type))return((t,e)=>{if(!zl(t.type))return b3(t.domain());const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=c(s)?t.stepTicks(s):c(n)?t.forceTicks(n):t.ticks(i??5),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=k3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&A3(s,i);)s=P3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),V(a)!==V(r)&&a.push(V(r))),r=a}return b3(r)})(t,e);if(jl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(c(s))l=t.stepTicks(s);else if(c(n))l=t.forceTicks(n);else if(c(i))l=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=k3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=R3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}else l=t.domain();return b3(l)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return B3(t,e)}return b3(t.domain())};class L3 extends Y2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),c(this._spec.id)&&t.setUserId(this._spec.id),o(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==C(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=WZ(NZ.axis(),{appear:this._spec.animationAppear??C(this._option.getChart().getSpec(),"animationAppear.axis")??C(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??C(this._option.getChart().getSpec(),"animationDisappear.axis")??C(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??C(this._option.getChart().getSpec(),"animationEnter.axis")??C(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??C(this._option.getChart().getSpec(),"animationExit.axis")??C(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??C(this._option.getChart().getSpec(),"animationUpdate.axis")??C(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return Ll(this._regions,(e=>{m(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;c(t)&&(this._seriesUserId=N(t)),c(i)&&(this._regionUserId=N(i)),c(e)&&(this._seriesIndex=N(e)),c(n)&&(this._regionIndex=N(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(Ll(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!zl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=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));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(Ll(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===rU.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&h(t.title.angle)&&(i="left"===t.orient?-90:90,e=o2[t.orient]),{orient:this.orient,select:t.select,hover:t.hover,line:(n=t.domainLine,(n=C$(n)).startSymbol=C$(n.startSymbol),n.endSymbol=C$(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:l(t.label.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.label.style(e.rawValue,i,e,n,s));return P$(this._preprocessSpec(L({},this._theme.label?.style,r)))}:P$(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:E$(t.label.state),autoRotate:!!t.label.autoRotate,autoHide:!!t.label.autoHide,autoLimit:!!t.label.autoLimit,autoRotateAngle:t.label.autoRotateAngle,autoHideMethod:t.label.autoHideMethod,autoHideSeparation:t.label.autoHideSeparation,limitEllipsis:t.label.limitEllipsis,layoutFunc:t.label.layoutFunc},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:l(t.tick.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.tick.style(e,i,n,s));return P$(this._preprocessSpec(L({},this._theme.tick?.style,r)))}:P$(t.tick.style),state:T$(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:l(t.subTick.style)?(e,i,n,s)=>{const r=t.subTick.style(e,i,n,s);return P$(L({},this._theme.subTick?.style,r))}:P$(t.subTick.style),state:T$(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:l(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return P$(this._preprocessSpec(L({},this._theme.grid?.style,n)))}:P$(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:P$(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Gt(i):null,textStyle:L({},e,P$(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:P$(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:P$(t.title.background?.style)},state:{text:T$(t.title.state),shape:T$(t.title.shape?.state),background:T$(t.title.background?.state)}},panel:{visible:t.background?.visible,style:P$(t.background?.style),state:T$(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const O3=[T3.AxisLabelOverlapPlugin,T3.AxisSyncPlugin];class F3 extends L3{static type=un.cartesianAxis;type=un.cartesianAxis;name=un.cartesianAxis;layoutType="region-relative";layoutZIndex=r$.Axis;layoutLevel=a$.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;_verticalLimitSize;constructor(t,e){super(t,{...e}),this._orient=W$(t,["z"]),V$(this._orient)&&(this.layoutType="absolute"),c(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?j$(t)?"linear":"band":j$(t)?"band":"linear"}(t.orient,i),s=`${F3.type}-${n}`,r=B$.getComponentInKey(s);if(r){let n=t.inverse;return i&&!j$(t.orient)&&(n=!c(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(F3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[F3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===Gh.horizontal;if(!m(i))return c2(i)?F3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>N$(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{c2(t)&&a.push(F3.createAxis(t,{...e,specIndex:i,specKey:F3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):N$(this.orient)?t.setYAxisHelper(this.axisHelper()):V$(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];j$(this.orient)?b(e)&&(s=n?[e,0]:[0,e]):V$(this.orient)?b(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):b(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(O3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();j$(this.orient)?h(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):h(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=j$(this.orient)?t.fieldX:V$(this.orient)?t.fieldZ:t.fieldY,zl(this._scale.type)?e:[e[0]]}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(hV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(j$(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(VX.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Ll(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:j$(this.orient)?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:V$(this.orient)?i.fieldZ:i.fieldY,n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{j$(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):N$(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):V$(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;b(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),b(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=j$(this.orient)?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=j$(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(L({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=L({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&h(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{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=j$(this.orient),s=t=>(n?!j$(t.orient):j$(t.orient))&&zl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(c(t))a=r.find((e=>e.id===t));else if(c(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const z3=Math.sqrt(50),H3=Math.sqrt(10),j3=Math.sqrt(2);class N3{_extend={};setExtraAttrFromSpec(){c(this._spec.nice)&&(this._nice=this._spec.nice),c(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=h2(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];c(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),c(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(W(t)-function(t){if(t&&m(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=z3?10:s>=H3?5:s>=j3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(VX.scaleUpdate,{model:this})}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{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._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}j(G3,W3);class U3 extends V3{static type=un.cartesianTimeAxis;type=un.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=L({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new YK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=Wo.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return m(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&m(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class Y3 extends L3{static type=un.polarAxis;type=un.polarAxis;name=un.polarAxis;layoutType="absolute";layoutZIndex=r$.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=xN;get startAngle(){return this._startAngle}_endAngle=SN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${Y3.type}-${i}`,s=B$.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(Y3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!m(i))return d2(i)?(i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),Y3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!d2(i))return;i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),i.outerRadius=i.radius??t.outerRadius??t.radius??kN;const o=Y3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Sl(this._spec.startAngle??wN),this._endAngle=Sl(this._spec.endAngle??(c(this._spec.startAngle)?this._spec.startAngle+360:AN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(VX.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._spec.tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return zl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=Al({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=jt.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=kN,e=0;const i=this.getChart().getSpec();return Ll(this.getRegions(),(n=>{const s=n;if(function(t){return[tq.rose,tq.radar,tq.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;b(n)&&(t=n),b(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(L({},this._axisStyle,t))}}class X3 extends Y3{static type=un.polarLinearAxis;type=un.polarLinearAxis;_zero=!0;_nice=!0;_scale=new _h;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}j(X3,N3);class $3 extends Y3{static type=un.polarBandAxis;type=un.polarBandAxis;_scale=new ah;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function K3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:p,regionId:g,regionIndex:f,seriesIndex:m,seriesId:y,padding:_,...v}=L({},t),b=v;return i.visible&&(b.title=G2(i)),M(n.focusIconStyle)||P$(n.focusIconStyle),n.shape=C$(n.shape),n.label=C$(n.label),n.value=C$(n.value),n.background=C$(n.background),Xh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),Xh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),Xh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),b.item=n,M(s.textStyle)||P$(s.textStyle),C$(s.handler),b.pager=s,r.visible&&!M(r.style)&&(L(b,r.style),c(r.padding)&&(b.padding=r.padding)),b}j($3,W3);const q3=(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},Z3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return c(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class J3 extends Y2{layoutType="normal";layoutZIndex=r$.Legend;layoutLevel=a$.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Uh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;c(i)&&(this._seriesUserId=N(i)),c(t)&&(this._regionUserId=N(t)),c(n)&&(this._seriesIndex=N(n)),c(e)&&(this._regionUserIndex=N(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new YK(this._option,t),this._initSelectedData(),Ll(this._regions,(t=>{t.event.on(VX.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;h(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(VX.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;b(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(L({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(L({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),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,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class Q3 extends J3{static type=un.discreteLegend;type=un.discreteLegend;name=un.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return i.type&&"discrete"!==i.type?void 0:new Q3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new Q3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){rK(this._option.dataSet,"discreteLegendFilter",Z3),rK(this._option.dataSet,"discreteLegendDataMake",q3);const t=new Vo(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!nl(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=A$(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...K3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return KU}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(GU.legendItemClick,(e=>{const i=C(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(VX.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(GU.legendItemHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(GU.legendItemUnHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:b(r)?r:1,strokeOpacity:b(a)?a:1,opacity:b(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return l(this._spec.data)?this._spec.data(t):t}}const t5=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;b(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},e5=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!M(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function i5(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:d,id:u,visible:p,orient:g,position:f,data:m,defaultSelected:y,field:_,filter:v,regionId:b,regionIndex:x,seriesIndex:S,seriesId:w,padding:A,...k}=L({},t),C=k;return e.visible&&(C.title=G2(e)),C.showHandler=!1!==i.visible,M(i.style)||(C.handlerStyle=P$(i.style)),c(n.width)&&(C.railWidth=n.width),c(n.height)&&(C.railHeight=n.height),M(n.style)||(C.railStyle=P$(n.style)),M(s.style)||(C.trackStyle=P$(s.style)),C.startText=C$(r),C.endText=C$(a),C.handlerText=C$(o),M(l)||(C.sizeBackground=P$(l)),h.visible&&!M(h.style)&&(L(C,h.style),c(h.padding)&&(C.padding=h.padding)),C}function n5(t){return"color"===t||"size"===t}const s5={color:tY,size:iY},r5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],a5=[2,10];class o5 extends J3{static type=un.continuousLegend;type=un.colorLegend;name=un.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return n5(i.type)?new o5(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{n5(t.type)&&n.push(new o5(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?un.colorLegend:un.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){rK(this._option.dataSet,"continuousLegendFilter",e5),rK(this._option.dataSet,"continuousLegendDataMake",t5);const t=new Vo(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=A$(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!nl(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=A$(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),M(n)&&(n="color"===this._legendType?r5:a5);const r={...i5(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return s5[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",gt((e=>{const i=C(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(VX.legendFilter,{model:this,value:i,event:e})}),30))}}}const l5=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),N(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class h5 extends Y2{static type=un.indicator;type=un.indicator;name=un.indicator;layoutType="absolute";layoutZIndex=r$.Indicator;layoutLevel=a$.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==h5.type)return null;const i=N(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map((t=>new h5(t,e)));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){rK(this._option.dataSet,"indicatorFilter",l5);const t=new Vo(this._option.dataSet);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 YK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return N(this._spec.content).forEach((t=>{const e=L({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{...P$(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!c(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{...P$(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rY(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":l(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return Ll(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){super.clear(),this._indicatorComponent=null,this._cacheAttrs=null}}class c5 extends Y2{static type=un.title;type=un.title;layoutType="normal";layoutZIndex=r$.Title;layoutLevel=a$.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Uh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!m(i))return new c5(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new c5(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;b(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),b(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:b(t.width())?t.width():0,height:this._spec.height?this._spec.height:b(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new nY(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class d5{projection;constructor(t){if(this.projection=kJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function u5(t,e){return`${Kj}_${e}_${t}`}class p5 extends Y2{static type=un.geoCoordinate;type=un.geoCoordinate;name=un.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:u5(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(h(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new p5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=L(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(VX.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new d5(this._projectionSpec)}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===tq.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===tq.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(tq.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==tq.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}j(p5,U1);const g5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},f5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class m5 extends Y2{layoutType="absolute";gridZIndex=r$.CrossHair_Grid;labelZIndex=r$.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach(((t,i)=>this._registerEvent(t,m(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:WX.chart},this._handleEvent),this.event.on(e,{level:GX.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ft((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(g5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(m(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(g5[e][t]),s=s.concat(g5[e][i(t)])})),{in:n,out:s}}return{in:g5[e][t],out:g5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=C(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{f5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),m(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function _5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var v5,b5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(v5||(v5={}));class x5 extends m5{static type=un.cartesianCrosshair;type=un.cartesianCrosshair;name=un.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.xField||i.yField?new x5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new x5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,v5.VERTICAL,!0),this.layoutByValue(v5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,v5.HORIZONTAL,!1),this.layoutByValue(v5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return zl(t.getScale().type)&&b(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){j$(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(v5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=v5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,d;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(jl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(zl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=_5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=l2(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(jl(s.type)){const t=s._step;d=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(zl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=_5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(d=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):d=1,a=r}}if(this.yHair.label?.visible){const e=l2(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(v5.HORIZONTAL&&this._layoutHorizontal(n,d??0),v5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EG({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new PG({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new yG(e)),n.add(t)),y5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(b5||(b5={}));class S5 extends m5{static type=un.polarCrosshair;type=un.polarCrosshair;name=un.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.categoryField||i.valueField?new S5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new S5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});zl(s.getScale().type)&&b(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:jt.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(b5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",L(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=l2(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=l2(t.getSpec())),n.angle=i.angle,n.axis=t,L(n,s)}))),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(b5.HORIZONTAL&&this._layoutHorizontal(n),b5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:$t(l,n,i),end:$t(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new EG({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new BG({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Bl(i),e={...$t(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Kt(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=$t(t,s,p),m=$t(t,s,g),y=ve([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=ct(jt.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new IG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new RG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=xl(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}}(i),n={...$t(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new yG(e),n.add(t),i(t)),y5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const w5=t=>P$({...t}),A5=t=>({...t,style:{...P$(t.style)}}),k5=t=>{const e=w5(t?.slider?.trackStyle??{}),i=w5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},P$({...s}));var s;const r=A5(t?.controller?.start??{}),a=A5(t?.controller?.pause??{}),o=A5(t?.controller?.backward??{}),l=A5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},M5=(t,e)=>({...k5(t),data:e,type:"continuous"}),C5=(t,e)=>({...k5(t),data:e,type:"discrete"}),T5=t=>"left"===t||"right"===t,E5=t=>"top"===t||"bottom"===t;class P5 extends Y2{layoutZIndex=r$.Player;layoutLevel=a$.Player;static type=un.player;type=un.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return h(i)||!1===i.visible?null:new P5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),b(t.x)){const e=T5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(b(t.y)){const e=E5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{...C5(this._spec,this._specs),...e}:{...M5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new _Y(t):this._playerComponent=new bY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 v(this._spec.width)?Math.min(t.width,Number(this._spec.width)):T5(this._orient)?this._maxSize():t.width}_computeHeight(t){return v(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):E5(this._orient)?this._maxSize():t.height}_computeDx(t){return T5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return E5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size),(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(VX.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnEnd,(()=>{this.event.emit(VX.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];N(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(VX.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const R5=(t,e)=>Tl(t[0].latestData,e.field),B5=(t,e)=>El(t[0].latestData,e.field);function I5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function D5(t,e){return Pl(t[0].latestData,e.field)}function L5(t,e){return Rl(t[0].latestData,e.field)}function O5(t,e){return function(t,e){return Math.sqrt(Rl(t,e))}(t[0].latestData,e.field)}function F5(t,e){return function(t,e){return Z(t.map((t=>t[e])))}(t[0].latestData,e.field)}function z5(t,e){const i={min:R5,max:B5,sum:I5,average:D5,variance:L5,standardDeviation:O5,median:F5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(c(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(c(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function H5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.x)){v(t.x)&&V5(u,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function j5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.y)){v(t.y)&&V5(u,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function N5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();v(t.x)&&V5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),v(t.y)&&V5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function V5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const W5=["sum","average","min","max","variance","standardDeviation","median"];class G5 extends Y2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||W5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??N(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(N(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Tl(t,e),r=El(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Y5 extends G5{static type=un.markLine;type=un.markLine;name=un.markLine;layoutZIndex=r$.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new Y5(i,{...e,specKey:Y5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new Y5(t,{...e,specIndex:i,specKey:Y5.speckey}))})),n}_createMarkerComponent(){const t=new LU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:P$(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:P$(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:P$(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)||c(t.coordinates)&&c(t.process)&&c(t.process.x),a=c(t.y)||c(t.coordinates)&&c(t.process)&&c(t.process.y),o=c(t.coordinates)&&(!c(t.process)||"process"in t&&"xy"in t.process),l=c(t.positions),h=t?.autoRange??!1;let d=[];r?d=H5(e,i,n,s,h)[0]:a?d=j5(e,i,n,s,h)[0]:o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new Vo(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new Vo(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class X5 extends G5{static type=un.markArea;type=un.markArea;name=un.markArea;layoutZIndex=r$.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new X5(i,{...e,specKey:X5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new X5(t,{...e,specIndex:i,specKey:X5.speckey}))})),n}_createMarkerComponent(){const t=new OU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:P$(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)&&c(t.x1),a=c(t.y)&&c(t.y1),o=c(t.coordinates),l=c(t.positions),h=t?.autoRange??!1;let d=[],u=[];r?(u=H5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):a?(u=j5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=c(t.x)&&c(t.x1),n=c(t.y)&&c(t.y1),s=c(t.coordinates);if(!i&&!n&&!s)return null;let r;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new Vo(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class $5 extends G5{static type=un.markPoint;type=un.markPoint;name=un.markPoint;layoutZIndex=r$.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new $5(i,{...e,specKey:$5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new $5(t,{...e,specIndex:i,specKey:$5.speckey}))})),n}_createMarkerComponent(){const t=new FU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:P$(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:P$(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{...P$(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{...P$(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:P$(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=N5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!c(t.coordinate))return;rK(this._option.dataSet,"markerAggregation",z5);const i=this._processSpecCoo(t),n=new Vo(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const K5=(t,e,i)=>h(t)?t:l(t)?t(e,i):t,q5=(t,e,i)=>{if(h(t))return t;if(m(t)){const n=[];return t.forEach((t=>{if(l(t)){const s=t(e,i);c(s)&&n.push(s)}else n.push(t)})),n}return l(t)?t(e,i):t};const Z5=(t,e)=>(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight),J5="vchart-tooltip-container",Q5=20,t4={key:"其他",value:"..."},e4={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class i4{static dom=`${Kj}_TOOLTIP_HANDLER_DOM`;static canvas=`${Kj}_TOOLTIP_HANDLER_CANVAS`}const n4=(t,e,i)=>{const n=K5(e.key,t,i),s=K5(e.value,t,i),r=!1!==K5(e.visible,t,i)&&(c(n)||c(s)),a=K5(e.isKeyAdaptive,t,i),o=K5(e.shapeType,t,i),l=K5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},s4=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,r4=(t,e)=>{let i;if(c(t))if(v(t))i=t;else if(l(t)){const n=t(e);v(n)&&(i=n)}return i},a4=(t,e)=>{const i=b$(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function o4(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Ej,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var l4;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(l4||(l4={}));class h4{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),l4.success):(this._updateTooltip(!1,e),l4.success)}if(h(n)||h(s))return l4.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(c(t.visible)||c(t.activeType)?s.visible=bq(t).includes("mark"):c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=s4(i,"mark")??{},a=L({},R(e.mark),R(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(c))),[]);if(t.every((t=>!bq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=s4(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{l(t)?o.push(t):o.push(...N(t))})),r={...i[0],content:o};let d={};const u=t.filter((t=>{const e=t.tooltipHelper?.spec;return c(e?.dimension)&&bq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(u.length){let t=[];u.every((({content:t})=>h(t)))?t=void 0:u.forEach((({content:e})=>{h(e)||(l(e)?t?.push(e):t?.push(...N(e)))})),d={...u[0],content:t}}a=L({},R(e.dimension),d)}const o=r.title,d={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(c(a.title))if(l(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...d,...n}}}else a.title={...r.title,...d,...a.title};else a.title={...r.title,...d};const u=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),p=N(r.content);if(c(a.content))if(l(a.content)){const t=a.content;a.content=(e,i)=>{const n=N(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...u(p[0]),...t}})),n}}else{const t=N(a.content);t.forEach(((e,i)=>{t[i]={...u(p[0]),...e}}))}else a.content=p.map((t=>({...t,...u(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return l4.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??l4.success;const a=r[n];if(!a)return l4.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),h(o.title?.key)&&h(o.title?.value)&&!o.content?.length?l4.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??l4.success;const o=i[n];if(!o)return l4.failed;const l=this._getActualTooltipPosition(e,q5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),l4.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=v(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...e4,offsetX:t?.x??e4.offsetX,offsetY:t?.y??e4.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=q5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=q5(t.title,e,i),s=N(q5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=Q5}=t,o=!1!==K5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,c(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=K5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=n4(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...t4});break}if(!(r.content.lengthh(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=n4(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...t4});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(h(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),h(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!c(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,u=this._component.getSpec(),p="canvas"===u.renderMode,g=i?.chart?.getCanvasRect(),f=g?.width??qj,m=g?.height??Zj;let y,_,v,x,S,w,A=!1;if(d(e)){const{left:t,right:i,top:n,bottom:s}=e;y=r4(t,r),_=r4(n,r),v=r4(i,r),x=r4(s,r)}else if(c(e)&&"mark"===t.activeType){A=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case H$.left:y=t-a-l,_=(i+c)/2-o/2;break;case H$.right:y=n+l,_=(i+c)/2-o/2;break;case H$.top:y=(t+n)/2-a/2,_=i-o-h;break;case H$.bottom:y=(t+n)/2-a/2,_=c+h;break;case H$.inside:y=(t+n)/2-a/2,_=(i+c)/2-o/2}}}const k={width:0,height:0},M=(t=0)=>({x:t,y:t});let C=M(),T=M(),E=1,P=1;if(Zo(this._env)&&!u.confine){if(k.width=window.innerWidth,k.height=window.innerHeight,!p){T=n.getBoundingClientRect();const t=this._compiler.getCanvas()??this._chartContainer,e=t.getBoundingClientRect();C={x:e.x-T.x,y:e.y-T.y},E=Z5(t,e),P=Z5(n,T)}}else k.width=f,k.height=m;const{canvasX:R,canvasY:B}=r;S=b(y)?y:b(v)?f-a-v:R+l,w=b(_)?_:b(x)?m-o-x:B+h,S*=E,w*=E,Zo(this._env)&&(S+=C.x,w+=C.y),S/=P,w/=P;const{width:I,height:D}=k;return(S+a)*P+T.x>I&&(A?S=(I-T.x)/P-a:S-=2*l+a),(w+o)*P+T.y>D&&(A?w=(D-T.y)/P-o:w-=2*h+o),S*P+T.x<0&&(S=0-T.x/P),w*P+T.y<0&&(w=0-T.y/P),{x:S,y:w}};_getTooltipBoxSize(t,e){return e&&!h(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:m="",hasShape:y,shapeType:_="",shapeHollow:v,shapeColor:b}=h;if(l.title.visible=f,f){const{text:t,width:e,height:i}=a4(m,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},u=e,g=i,y&&WP[_]){const t={symbolType:_};v?t.stroke=b:t.fill=b,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],h=[],d=[];l.content=t.map(((l,u)=>{const g={height:0,spaceRow:i};let f=0;const{hasShape:m,key:y,shapeColor:_,shapeHollow:v,shapeType:b="",value:x,isKeyAdaptive:S}=l;if(c(y)){const{width:t,height:e,text:i}=a4(y,a);g.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},S?h.push(t):n.push(t),f=Math.max(f,e)}if(c(x)){const{width:t,height:e,text:i}=a4(x,o);g.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},d.push(t),f=Math.max(f,e)}if(m&&WP[b]){e=!0;const t={visible:!0,symbolType:b};v?t.stroke=_:t.fill=_,f=Math.max(r.size,f),g.shape=t}else g.shape={visible:!1};return g.height=f,p+=f,uc(t)?m(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function d4(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=L({},e,t),d={};return d.fontFamily=i,d.fontSize=c4(n),d.color=s,d.textAlign=r,d.lineHeight=c4(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=c4(c),d}function u4(t,e){if(!t)return;const{size:i}=L({},e,t),n={};return n.width=c4(i),n}class p4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===p4.type}type=p4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return p4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=qo?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(p4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const g4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},f4={boxSizing:"border-box"},m4={display:"flex",whiteSpace:"nowrap"},y4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},_4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},v4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},b4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},x4={lineHeight:"normal"};class S4 extends p4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!WP[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=WP[e].pathStr;let o="currentColor";if(!n||f(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(d(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class w4 extends p4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class A4 extends p4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=$(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=$(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},y4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=L({},a?v4:_4,{height:c4(i[n].height),...t.keyColumn.item});f(r)&&""!==r?.trim?.()||v(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=L({},b4,{height:c4(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=L({},x4,{height:c4(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class k4 extends p4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new A4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new A4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new A4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(L({},m4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class M4 extends p4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new S4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new w4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(L({},g4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class C4 extends p4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&c(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new M4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new k4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},f4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class T4 extends h4{type=i4.dom;_tooltipContainer=qo?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(qo&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:d,lineWidth:u=0},padding:p,key:g,value:f,title:m,shape:y,enterable:_,spaceRow:v,transitionDuration:b}=t,x=i,S={panel:{width:c4((e?.panel?.width??0)+2*u),height:c4((e?.panel?.height??0)+2*u),paddingBottom:c4(p.bottom),paddingLeft:c4(p.left),paddingRight:c4(p.right),paddingTop:c4(p.top),borderColor:d,borderWidth:c4(u),borderRadius:c4(h),backgroundColor:x?`${x}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:_?"auto":"none",transitionDuration:b?`${b}ms`:"initial",transitionProperty:b?"transform":"initial",transitionTimingFunction:b?"ease-out":"initial"},title:d4(m),content:{},shapeColumn:{item:u4(y),width:c4(y.size),marginRight:c4(y.spacing??8)},keyColumn:{item:d4(g),width:c4(e?.keyWidth),marginRight:c4(g.spacing??26)},valueColumn:{item:d4(f),width:c4(e?.valueWidth),marginRight:c4(f.spacing??0)},spaceRow:c4(v)};if(c(v)){const t=v/2;[S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((e=>{e.marginTop=c4(t),e.marginBottom=e.marginTop})),S.content.marginTop=c4(-t),S.content.marginBottom=S.content.marginTop}else[S.content,S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return S}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class E4 extends h4{type=i4.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new CY({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?c(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class P4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&c(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??l4.success:l4.failed}class R4 extends P4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!xq(t)&&!h(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...X$(r,a)??[],...Z$(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(c(i))break}return c(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class B4 extends P4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const I4=t=>c(t)&&!m(t),D4=t=>c(t)&&m(t);class L4 extends Y2{static type=un.tooltip;type=un.tooltip;name=un.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!m(i))return new L4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new L4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?E4:T4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new B4(this),dimension:new R4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:GX.chart},this._handleMouseMove),(Jo(e)||Qo(e))&&(this._mountEvent("pointerdown",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;Zo(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||xq(t)||(n&&I4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&D4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):c(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!h(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),r};_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};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=L({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!c(t.visible)||t.visible,activeType:bq(t),renderMode:"html",trigger:c(t.trigger)?t.trigger:"hover",className:c(t.className)?t.className:"vchart-tooltip-element",enterable:!!c(t.enterable)&&t.enterable,transitionDuration:c(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=c(t.triggerOff)?t.triggerOff:this._spec.trigger,c(t.renderMode)?this._spec.renderMode=t.renderMode:Qo(this._option.mode)&&(this._spec.renderMode="canvas"),c(t.mark)&&(this._spec.mark={...R(t.mark),activeType:"mark"}),c(t.dimension)&&(this._spec.dimension={...R(t.dimension),activeType:"dimension"}),c(t.parentElement)?f(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Zo(this._option.mode)&&(this._spec.parentElement=qo?.body),c(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=vq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:WX.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(h(this._cacheInfo)||h(t))return!1;if(D4(t)){if(I4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>D$(t,e[i])))}if(D4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(c(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(c(n)&&c(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function O4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function F4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const z4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??O4(e)};let o=!1;return f(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??F4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class H4 extends Y2{static type=un.label;type=un.label;name=un.label;layoutType="absolute";layoutZIndex=r$.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new H4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(VX.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(hV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(hV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Ll(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:R$.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:R$.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{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}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=z4[s.type]??z4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return L({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class j4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(b(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:l(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&c(t.modelId)){if(c(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&c(t.modelKey)&&"modelIndex"in t&&c(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>N4(t))),a=s.filter((t=>!N4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>N4(t))),h=o.filter((t=>!N4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);b(o.width)||(o.width=a.width),b(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function N4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class V4 extends VK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&j$(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&N$(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var W4;W4={},L(xG.poptip,W4),Wk.load(CG),wK.useChart([J1,x2,Q1,t2,L2,S2,A2,k2,I2,E2,n2,O2,v2,b2,M2,N2,V2,r2,a2,C2,R2,B2,F2,i2,z2,H2,e2,D2,m2,P2,y2]),wK.useComponent([V3,G3,U3,$3,X3,Q3,o5,L4,x5,S5,Z2,q2,h5,p5,Y5,c5,X5,P5,H4,$5,Q2,J2,c3]),B$.registerLayout("grid",j4),B$.registerLayout("layout3d",V4),t.Arc3dMark=qJ,t.ArcMark=XJ,t.AreaChart=J1,t.AreaMark=vJ,t.AreaSeries=bJ,t.Bar3dChart=t2,t.Bar3dSeries=gJ,t.BarChart=Q1,t.BarSeries=ZZ,t.BaseChart=sq,t.BaseMark=KK,t.BaseSeries=Lq,t.BoxPlotChart=e2,t.BoxPlotMark=sJ,t.BoxPlotSeries=oJ,t.Brush=Q2,t.CartesianAxis=F3,t.CartesianBandAxis=G3,t.CartesianChart=rq,t.CartesianCrossHair=x5,t.CartesianLinearAxis=V3,t.CartesianSeries=Oq,t.CartesianTimeAxis=U3,t.CellMark=q1,t.CirclePackingChart=i2,t.CirclePackingSeries=T1,t.CircularProgressChart=M2,t.CircularProgressSeries=fQ,t.CommonChart=n2,t.ComponentMark=ZK,t.ContinuousLegend=o5,t.CustomMark=J2,t.DataZoom=Z2,t.DiscreteLegend=Q3,t.DotSeries=cQ,t.Factory=B$,t.Funnel3dChart=a2,t.Funnel3dSeries=N0,t.FunnelChart=r2,t.FunnelSeries=H0,t.GaugeChart=m2,t.GaugePointerSeries=X1,t.GaugeSeries=$1,t.GeoCoordinate=p5,t.GridLayout=j4,t.GroupMark=qK,t.HeatmapChart=y2,t.HeatmapSeries=Z1,t.Histogram3dChart=b2,t.HistogramChart=v2,t.Indicator=h5,t.Label=H4,t.Layout=VK,t.Layout3d=V4,t.LineChart=x2,t.LineMark=dJ,t.LineSeries=uJ,t.LinearProgressChart=C2,t.LinearProgressSeries=yQ,t.LinkPathMark=j1,t.LinkSeries=uQ,t.MapChart=S2,t.MapLabelComponent=c3,t.MapSeries=jJ,t.MarkArea=X5,t.MarkLine=Y5,t.MarkPoint=$5,t.PathMark=OJ,t.Pie3dChart=k2,t.Pie3dSeries=ZJ,t.PieChart=A2,t.PieSeries=KJ,t.Player=P5,t.PolarAxis=Y3,t.PolarBandAxis=$3,t.PolarChart=g2,t.PolarCrossHair=S5,t.PolarLinearAxis=X3,t.PolarSeries=NJ,t.PolygonMark=z0,t.ProgressArcMark=gQ,t.ProgressLikeChart=f2,t.ProgressLikeSeries=pQ,t.Pyramid3dMark=j0,t.RadarChart=E2,t.RadarSeries=aQ,t.RangeAreaChart=P2,t.RangeAreaSeries=SJ,t.RangeColumn3dChart=B2,t.RangeColumn3dSeries=_J,t.RangeColumnChart=R2,t.RangeColumnSeries=yJ,t.Rect3dMark=pJ,t.RectMark=KZ,t.RoseChart=I2,t.RoseLikeChart=T2,t.RoseLikeSeries=sQ,t.RoseSeries=rQ,t.RuleMark=JZ,t.SankeyChart=D2,t.SankeySeries=N1,t.ScatterChart=L2,t.ScatterSeries=nQ,t.ScrollBar=q2,t.SequenceChart=O2,t.SunburstChart=F2,t.SunburstSeries=k1,t.SymbolMark=aJ,t.TextMark=qZ,t.ThemeManager=v$,t.Title=c5,t.Tooltip=L4,t.TreeMapChart=z2,t.TreeMapSeries=Y1,t.VChart=wK,t.WaterfallChart=H2,t.WaterfallSeries=QZ,t.WordCloud3dChart=V2,t.WordCloud3dSeries=S0,t.WordCloudChart=N2,t.WordCloudSeries=x0,t.default=wK,t.version="1.1.0",Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var s={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}]`,o=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||a(t,"Boolean")},l=t=>"function"==typeof t,h=t=>null==t,c=t=>null!=t,d=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},u=t=>"object"==typeof t&&null!==t,p=function(t){if(!u(t)||!a(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},g=t=>void 0===t,f=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||a(t,"String")},m=t=>Array.isArray?Array.isArray(t):a(t,"Array"),y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},_=t=>a(t,"Date"),v=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||a(t,"Number")},b=t=>v(t)&&Number.isFinite(t),x=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),S=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),w=Object.prototype,A=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)},k=Object.prototype.hasOwnProperty;function M(t){if(h(t))return!0;if(y(t))return!t.length;const e=S(t);if("Map"===e||"Set"===e)return!t.size;if(A(t))return!Object.keys(t).length;for(const e in t)if(k.call(t,e))return!1;return!0}const C=(t,e,i)=>{const n=f(e)?e.split("."):e;for(let e=0;enull!=t&&T.call(t,e);function P(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,o){if(null===i)return null;if(0===o)return i;let l;if("object"!=typeof i)return i;if(m(i)?l=[]:a(i,"RegExp")?(l=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(l.lastIndex=i.lastIndex)):l=_(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(l)}for(const e in i)l[e]=t(i[e],o-1);return l}(t,i)}function R(t){let e;if(!c(t)||"object"!=typeof t)return t;const i=m(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:o(t)||v(t)||f(t)?t:_(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=R(n)}return e}function B(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(c(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];c(n[r])&&"object"==typeof n[r]?I(t,e,r,i):D(t,r,n[r])}}}}function I(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(m(r)){if(n)a=[];else if(m(s))a=s;else if(y(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!z(t[i],e[i]))return!1;return!0}if(!p(t))return!1;const i=F(t),n=F(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!z(t[s],e[s]))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;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function G(t,e){if(!m(t)||!m(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Y(t,e,i){c(e)||(e=t,t=0),c(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function $(t){return Number(t)}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function q(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(h(n)&&(n=t.length);i>>1;X(t[s],e)>0?n=s:i=s+1}return i}const Z=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(X)),K(i,.5)},J=Math.sqrt(50),Q=Math.sqrt(10),et=Math.sqrt(2);function it(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=J?s*=10:r>=Q?s*=5:r>=et&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:nt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function at(t,e,i,n){return t>e&&!rt(t,e,i,n)}function ot(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},ht=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?lt(n,r)+s:"center"===i?lt(n,Math.floor(r/2))+s+lt(n,Math.ceil(r/2)):s+lt(n,r)},ct=function(t,e,i){return ti?i:t},dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,p=!0;const g=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function y(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function _(){const t=Date.now();if(y(t))return v(t);o=m(_,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function v(t){return o=void 0,p&&n?f(t):(n=s=void 0,a)}function x(){const t=Date.now(),i=y(t);for(var r=arguments.length,d=new Array(r),p=0;pt*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const _t=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vt=new RegExp(_t.source,"g");const bt=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function xt(t){if(t instanceof Date)return t;if(f(t)){const e=bt.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return h(t)?new Date(NaN):new Date(Math.round(t))}const St=1e-12,wt=Math.PI,At=wt/2,kt=2*wt,Mt=2*Math.PI,Ct=Math.abs,Tt=Math.atan2,Et=Math.cos,Pt=Math.max,Rt=Math.min,Bt=Math.sin,It=Math.sqrt,Dt=Math.pow;function Lt(t){return t>1?0:t<-1?wt:Math.acos(t)}function Ot(t){return t>=1?At:t<=-1?-At:Math.asin(t)}function Ft(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function zt(t,e){return t[0]*e[1]-t[1]*e[0]}class Ht{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ht(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 v(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return v(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 jt{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Ht((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return m(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Nt(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 Wt extends Vt{}function Gt(t){return t*(Math.PI/180)}function Ut(t){return 180*t/Math.PI}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-kt;)t+=kt;else if(t>0)for(;t>kt;)t-=kt;return t},Xt=Yt;function $t(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Kt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new qt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new qt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new qt(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=Ut(r.rotateDeg),r}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return v(t)?new re(t>>16,t>>8&255,255&t,1):m(t)?new re(t[0],t[1],t[2]):new re(255,255,255)}let se=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(c(te[t]))return function(t){return v(t)?new re(t>>>24,t>>>16&255,t>>>8&255,255&t):m(t)?new re(t[0],t[1],t[2],t[3]):new re(255,255,255,1)}(te[t]);if(c(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new re((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new re(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new re(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new re(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new re(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}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}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=Zt(h(t)?s.h:ct(t,0,360),h(e)?s.s:e>=0&&e<=1?100*e:e,h(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new re(r.r,r.g,r.b,n),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}};class re{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)),c(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ae(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new re(e,c,d,l*(1-t)+h*t)}},rgbToHex:oe,rgbToHsl:Jt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ye;function _e(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}function be(t,e,i){return null===t?e:null===e?t:(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,i&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>=fe||de<=ge||ue>=ye||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ye)})}var xe;function Se(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me]),ce>fe||deye||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function ke(t){return t/180*Math.PI}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?t.angle:ke(t.angle),n=Me(t);return[Ae({x:t.x1,y:t.y1},i,n),Ae({x:t.x2,y:t.y1},i,n),Ae({x:t.x2,y:t.y2},i,n),Ae({x:t.x1,y:t.y2},i,n)]}let Te,Ee,Pe,Re;function Be(t){return Te=1/0,Ee=1/0,Pe=-1/0,Re=-1/0,t.forEach((t=>{Te>t.x&&(Te=t.x),Pet.y&&(Ee=t.y),Ree&&r>n||rs?o:0}function Fe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class He{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(),c(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=c(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(h(this._canvas)&&(c(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),h(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&c(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),h(this._context)&&c(this._canvas)){const t=this._canvas.getContext("2d");c(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!h(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(h(t))return{width:0,height:0};if(h(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 c;try{const h=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});c={width:h.width(),height:h.height()}}catch(e){this._notSupportVRender=!0,c=this.measureWithNaiveCanvas(t)}return c}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}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===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(h(this._numberCharSize)){const t=this._standardMethod(He.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/He.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return h(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(He.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(h(this._letterCharSize)){const t=this._standardMethod(He.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/He.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return c(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){c(this._canvas)&&(this._canvas=null),c(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}He.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",He.NUMBERS_CHAR_SET="0123456789",He.FULL_SIZE_CHAR="字";const je="undefined"!=typeof console;function Ne(t,e,i){const n=[e].concat([].slice.call(i));je&&console[t].apply(console,n)}var Ve;!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"}(Ve||(Ve={}));class We{static getInstance(t,e){return We._instance&&v(t)?We._instance.level(t):We._instance||(We._instance=new We(t,e)),We._instance}static setInstance(t){return We._instance=t}static setInstanceLevel(t){We._instance?We._instance.level(t):We._instance=new We(t)}static clearInstance(){We._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Ve.Info}canLogDebug(){return this._level>=Ve.Debug}canLogError(){return this._level>=Ve.Error}canLogWarn(){return this._level>=Ve.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Ve.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):Ne(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Warn&&Ne(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Info&&Ne(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Debug&&Ne(this._method||"log","DEBUG",e),this}}function Ge(t){if(b(t))return[t,t,t,t];if(m(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(d(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 Ue(t){return t?"getUTCFullYear":"getFullYear"}function Ye(t){return t?"getUTCMonth":"getMonth"}function Xe(t){return t?"getUTCDate":"getDate"}function $e(t){return t?"getUTCHours":"getHours"}function Ke(t){return t?"getUTCMinutes":"getMinutes"}function qe(t){return t?"getUTCSeconds":"getSeconds"}function Ze(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Je(t){return t?"setUTCFullYear":"setFullYear"}We._instance=null;const Qe=1e3,ti=6e4,ei=36e5,ii=24*ei,ni=31*ii,si=365*ii,ri=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),ai=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),oi=(t,e)=>e.getFullYear()-t.getFullYear(),li=t=>t.getFullYear(),hi=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),ci=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),di=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),ui=t=>t.getUTCFullYear(),pi=t=>(t.setDate(1),t.setHours(0,0,0,0),t),gi=(t,e)=>(t.setMonth(t.getMonth()+e),t),fi=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),mi=t=>t.getMonth(),yi=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),_i=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),vi=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),bi=t=>t.getUTCMonth(),xi=t=>(t.setHours(0,0,0,0),t),Si=(t,e)=>(t.setDate(t.getDate()+e),t),wi=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ii,Ai=t=>t.getDate()-1,ki=t=>(t.setUTCHours(0,0,0,0),t),Mi=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Ci=(t,e)=>(+e-+t)/ii,Ti=t=>t.getUTCDate()-1,Ei=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),Pi=(t,e)=>(t.setHours(t.getHours()+e),t),Ri=(t,e)=>(+e-+t)/ei,Bi=t=>t.getHours(),Ii=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),Di=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Li=t=>t.getUTCHours(),Oi=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),Fi=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),zi=(t,e)=>(+e-+t)/6e4,Hi=t=>t.getMinutes(),ji=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),Ni=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Vi=t=>t.getUTCMinutes(),Wi=t=>(t.setTime(+t-t.getMilliseconds()),t),Gi=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ui=(t,e)=>(+e-+t)/1e3,Yi=t=>t.getSeconds(),Xi=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),$i=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ki=t=>t.getUTCSeconds(),qi=t=>t,Zi=(t,e)=>(t.setTime(+t+e),t),Ji=(t,e)=>+e-+t,Qi=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},tn=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Qi(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Qi(h,c)}};function en(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function nn(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var sn=6371008.8,rn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*sn,kilometers:6371.0088,kilometres:6371.0088,meters:sn,metres:sn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:sn/1852,radians:1,yards:6967335.223679999};function an(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function on(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ln(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function hn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Gt(t[0]),r=Gt(t[1]),a=Gt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=rn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Ut(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Ut(l)}}const cn=t=>t;var dn,un;t.RenderModeEnum=void 0,(dn=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",dn["mobile-browser"]="mobile-browser",dn.node="node",dn.worker="worker",dn.miniApp="miniApp",dn["desktop-miniApp"]="desktop-miniApp",dn.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(un||(un={}));for(let t=0;t<256;t++)t.toString(16);const pn=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};function gn(){return new fn}function fn(){this.reset()}fn.prototype={constructor:fn,reset:function(){this.s=this.t=0},add:function(t){yn(mn,t,this.t),yn(this,mn.s,this.s),this.s?this.t+=mn.t:this.s=mn.t},valueOf:function(){return this.s}};var mn=new fn;function yn(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var _n=1e-6,vn=Math.PI,bn=vn/2,xn=vn/4,Sn=2*vn,wn=180/vn,An=vn/180,kn=Math.abs,Mn=Math.atan,Cn=Math.atan2,Tn=Math.cos,En=Math.exp,Pn=Math.log,Rn=Math.pow,Bn=Math.sin,In=Math.sign||function(t){return t>0?1:t<0?-1:0},Dn=Math.sqrt,Ln=Math.tan;function On(t){return t>1?0:t<-1?vn:Math.acos(t)}function Fn(t){return t>1?bn:t<-1?-bn:Math.asin(t)}function zn(){}function Hn(t,e){t&&Nn.hasOwnProperty(t.type)&&Nn[t.type](t,e)}var jn={Feature:function(t,e){Hn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nvn?t+Math.round(-t/Sn)*Sn:t,e]}function ts(t,e,i){return(t%=Sn)?e||i?Jn(is(t),ns(e,i)):is(t):e||i?ns(e,i):Qn}function es(t){return function(e,i){return[(e+=t)>vn?e-Sn:e<-vn?e+Sn:e,i]}}function is(t){var e=es(t);return e.invert=es(-t),e}function ns(t,e){var i=Tn(t),n=Bn(t),s=Tn(e),r=Bn(e);function a(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*i+o*n;return[Cn(l*s-c*r,o*i-h*n),Fn(c*s+l*r)]}return a.invert=function(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*s-l*r;return[Cn(l*s+h*r,o*i+c*n),Fn(c*i-o*n)]},a}function ss(t,e){(e=Yn(e))[0]-=t,Zn(e);var i=On(-e[1]);return((-e[2]<0?-i:i)+Sn-_n)%Sn}function rs(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:zn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function as(t,e){return kn(t[0]-e[0])<_n&&kn(t[1]-e[1])<_n}function os(t,e,i,n){this.x=t,this.z=e,this.o=i,this.e=n,this.v=!1,this.n=this.p=null}function ls(t,e,i,n,s){var r,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,i,n=t[0],a=t[e];if(as(n,a)){if(!n[2]&&!a[2]){for(s.lineStart(),r=0;r=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function hs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function ps(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function gs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=rs(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=y,u.lineStart=_,u.lineEnd=v,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=ps(a);var t=function(t,e){var i=ds(e),n=e[1],s=Bn(n),r=[Bn(i),-Tn(i),0],a=0,o=0;cs.reset(),1===s?n=bn+_n:-1===s&&(n=-bn-_n);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>vn,C=f*x;if(cs.add(Cn(C*A*Bn(k),m*S+C*Tn(k))),a+=M?w+A*Sn:w,M^p>=i^v>=i){var T=$n(Yn(u),Yn(_));Zn(T);var E=$n(r,T);Zn(E);var P=(M^w>=0?-1:1)*Fn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-_n||a<_n&&cs<-_n)^1&o}(r,n);a.length?(d||(s.polygonStart(),d=!0),ls(a,ms,t,i,s)):t&&(d||(s.polygonStart(),d=!0),s.lineStart(),i(null,null,1,s),s.lineEnd()),d&&(s.polygonEnd(),d=!1),a=r=null},sphere:function(){s.polygonStart(),s.lineStart(),i(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function p(e,i){t(e,i)&&s.point(e,i)}function g(t,e){l.point(t,e)}function f(){u.point=g,l.lineStart()}function m(){u.point=p,l.lineEnd()}function y(t,e){o.push([t,e]),c.point(t,e)}function _(){c.lineStart(),o=[]}function v(){y(o[0][0],o[0][1]),c.lineEnd();var t,e,i,n,l=c.clean(),u=h.result(),p=u.length;if(o.pop(),r.push(o),o=null,p)if(1&l){if((e=(i=u[0]).length-1)>0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(fs))}return u}}function fs(t){return t.length>1}function ms(t,e){return((t=t.x)[0]<0?t[1]-bn-_n:bn-t[1])-((e=e.x)[0]<0?e[1]-bn-_n:bn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return us(e(t),i)})}(us);var ys=gs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?vn:-vn,l=kn(r-i);kn(l-vn)<_n?(t.point(i,n=(n+a)/2>0?bn:-bn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=vn&&(kn(i-s)<_n&&(i-=s*_n),kn(r-o)<_n&&(r-=o*_n),n=function(t,e,i,n){var s,r,a=Bn(t-i);return kn(a)>_n?Mn((Bn(e)*(r=Tn(n))*Bn(i)-Bn(n)*(s=Tn(e))*Bn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*bn,n.point(-vn,s),n.point(0,s),n.point(vn,s),n.point(vn,0),n.point(vn,-s),n.point(0,-s),n.point(-vn,-s),n.point(-vn,0),n.point(-vn,s);else if(kn(t[0]-e[0])>_n){var r=t[0]0,s=kn(e)>_n;function r(t,i){return Tn(t)*Tn(i)>e}function a(t,i,n){var s=[1,0,0],r=$n(Yn(t),Yn(i)),a=Xn(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=$n(s,r),u=qn(s,h);Kn(u,qn(r,c));var p=d,g=Xn(u,p),f=Xn(p,p),m=g*g-f*(Xn(u,u)-1);if(!(m<0)){var y=Dn(m),_=qn(p,(-g-y)/f);if(Kn(_,u),_=Un(_),!n)return _;var v,b=t[0],x=i[0],S=t[1],w=i[1];x0^_[1]<(kn(_[0]-b)<_n?S:w):S<=_[1]&&_[1]<=w:A>vn^(b<=_[0]&&_[0]<=x)){var M=qn(p,(-g+y)/f);return Kn(M,u),[_,Un(M)]}}}function o(e,i){var s=n?t:vn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return gs(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=n?f?0:o(d,u):f?o(d+(d<0?vn:-vn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||as(e,p)||as(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(s&&e&&n^f){var y;m&i||!(y=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!f||e&&as(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Tn(e),o=Bn(e),l=n*i;null==s?(s=e+n*Sn,r=e-l/2):(s=ss(a,s),r=ss(a,r),(n>0?sr)&&(s+=n*Sn));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return kn(n[0]-t)<_n?s>0?0:3:kn(n[0]-i)<_n?s>0?2:1:kn(n[1]-e)<_n?s>0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,y,_,v=a,b=rs(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);y=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,s=(l=ps(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&ls(l,o,e,r,a),a.polygonEnd());v=a,l=h=c=null}};function S(t,e){s(t,e)&&v.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),y)d=r,u=a,p=o,y=!1,o&&(v.lineStart(),v.point(r,a));else if(o&&m)v.point(r,a);else{var l=[g=Math.max(bs,Math.min(vs,g)),f=Math.max(bs,Math.min(vs,f))],b=[r=Math.max(bs,Math.min(vs,r)),a=Math.max(bs,Math.min(vs,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(v.lineStart(),v.point(r,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),o||v.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ss(t){return t}var ws,As,ks,Ms,Cs=gn(),Ts=gn(),Es={point:zn,lineStart:zn,lineEnd:zn,polygonStart:function(){Es.lineStart=Ps,Es.lineEnd=Is},polygonEnd:function(){Es.lineStart=Es.lineEnd=Es.point=zn,Cs.add(kn(Ts)),Ts.reset()},result:function(){var t=Cs/2;return Cs.reset(),t}};function Ps(){Es.point=Rs}function Rs(t,e){Es.point=Bs,ws=ks=t,As=Ms=e}function Bs(t,e){Ts.add(Ms*t-ks*e),ks=t,Ms=e}function Is(){Bs(ws,As)}var Ds=Es,Ls=1/0,Os=Ls,Fs=-Ls,zs=Fs,Hs={point:function(t,e){tFs&&(Fs=t);ezs&&(zs=e)},lineStart:zn,lineEnd:zn,polygonStart:zn,polygonEnd:zn,result:function(){var t=[[Ls,Os],[Fs,zs]];return Fs=zs=-(Os=Ls=1/0),t}};var js,Ns,Vs,Ws,Gs=Hs,Us=0,Ys=0,Xs=0,$s=0,Ks=0,qs=0,Zs=0,Js=0,Qs=0,tr={point:er,lineStart:ir,lineEnd:rr,polygonStart:function(){tr.lineStart=ar,tr.lineEnd=or},polygonEnd:function(){tr.point=er,tr.lineStart=ir,tr.lineEnd=rr},result:function(){var t=Qs?[Zs/Qs,Js/Qs]:qs?[$s/qs,Ks/qs]:Xs?[Us/Xs,Ys/Xs]:[NaN,NaN];return Us=Ys=Xs=$s=Ks=qs=Zs=Js=Qs=0,t}};function er(t,e){Us+=t,Ys+=e,++Xs}function ir(){tr.point=nr}function nr(t,e){tr.point=sr,er(Vs=t,Ws=e)}function sr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,er(Vs=t,Ws=e)}function rr(){tr.point=er}function ar(){tr.point=lr}function or(){hr(js,Ns)}function lr(t,e){tr.point=hr,er(js=Vs=t,Ns=Ws=e)}function hr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,Zs+=(s=Ws*t-Vs*e)*(Vs+t),Js+=s*(Ws+e),Qs+=3*s,er(Vs=t,Ws=e)}var cr=tr;function dr(t){this._context=t}dr.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,Sn)}},result:zn};var ur,pr,gr,fr,mr,yr=gn(),_r={point:zn,lineStart:function(){_r.point=vr},lineEnd:function(){ur&&br(pr,gr),_r.point=zn},polygonStart:function(){ur=!0},polygonEnd:function(){ur=null},result:function(){var t=+yr;return yr.reset(),t}};function vr(t,e){_r.point=br,pr=fr=t,gr=mr=e}function br(t,e){fr-=t,mr-=e,yr.add(Dn(fr*fr+mr*mr)),fr=t,mr=e}var xr=_r;function Sr(){this._string=[]}function wr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ar(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Gn(t,i(n))),n.result()}return r.area=function(t){return Gn(t,i(Ds)),Ds.result()},r.measure=function(t){return Gn(t,i(xr)),xr.result()},r.bounds=function(t){return Gn(t,i(Gs)),Gs.result()},r.centroid=function(t){return Gn(t,i(cr)),cr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ss):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Sr):new dr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function kr(t){return function(e){var i=new Mr;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Mr(){}function Cr(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Gn(i,t.stream(Gs)),e(Gs.result()),null!=n&&t.clipExtent(n),t}function Tr(t,e,i){return Cr(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Er(t,e,i){return Tr(t,[[0,0],e],i)}function Pr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Rr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Sr.prototype={_radius:4.5,_circle:wr(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=wr(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}},Mr.prototype={constructor:Mr,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 Br=16,Ir=Tn(30*An);function Dr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,m){var y=h-n,_=c-s,v=y*y+_*_;if(v>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Dn(b*b+x*x+S*S),A=Fn(S/=w),k=kn(kn(S)-1)<_n||kn(r-d)<_n?(r+d)/2:Cn(x,b),M=t(k,A),C=M[0],T=M[1],E=C-n,P=T-s,R=_*E-y*P;(R*R/v>e||kn((y*E+_*P)/v-.5)>.3||a*u+o*p+l*g2?t[2]%360*An:0,E()):[m*wn,y*wn,_*wn]},C.angle=function(t){return arguments.length?(v=t%360*An,E()):v*wn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Dr(o,M=t*t),P()):Dn(M)},C.fitExtent=function(t,e){return Tr(C,t,e)},C.fitSize=function(t,e){return Er(C,t,e)},C.fitWidth=function(t,e){return Pr(C,t,e)},C.fitHeight=function(t,e){return Rr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function jr(t){var e=0,i=vn/3,n=Hr(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*An,i=t[1]*An):[e*wn,i*wn]},s}function Nr(t,e){var i=Bn(t),n=(i+Bn(e))/2;if(kn(n)<_n)return function(t){var e=Tn(t);function i(t,i){return[t*e,Bn(i)/e]}return i.invert=function(t,i){return[t/e,Fn(i*e)]},i}(t);var s=1+i*(2*n-i),r=Dn(s)/n;function a(t,e){var i=Dn(s-2*n*Bn(e))/n;return[i*Bn(t*=n),r-i*Tn(t)]}return a.invert=function(t,e){var i=r-e,a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,Fn((s-(t*t+i*i)*n*n)/(2*n))]},a}function Vr(){return jr(Nr).scale(155.424).center([0,33.6442])}function Wr(){return Vr().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Gr(t){return function(e,i){var n=Tn(e),s=Tn(i),r=t(n*s);return[r*s*Bn(e),r*Bn(i)]}}function Ur(t){return function(e,i){var n=Dn(e*e+i*i),s=t(n),r=Bn(s),a=Tn(s);return[Cn(e*r,n*a),Fn(n&&i*r/n)]}}var Yr=Gr((function(t){return Dn(2/(1+t))}));Yr.invert=Ur((function(t){return 2*Fn(t/2)}));var Xr=Gr((function(t){return(t=On(t))&&t/Bn(t)}));function $r(t,e){return[t,Pn(Ln((bn+e)/2))]}function Kr(){return qr($r).scale(961/Sn)}function qr(t){var e,i,n,s=zr(t),r=s.center,a=s.scale,o=s.translate,l=s.clipExtent,h=null;function c(){var r=vn*a(),o=s(function(t){function e(e){return(e=t(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e}return t=ts(t[0]*An,t[1]*An,t.length>2?t[2]*An:0),e.invert=function(e){return(e=t.invert(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e},e}(s.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),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function Zr(t){return Ln((bn+t)/2)}function Jr(t,e){var i=Tn(t),n=t===e?Bn(t):Pn(i/Tn(e))/Pn(Zr(e)/Zr(t)),s=i*Rn(Zr(t),n)/n;if(!n)return $r;function r(t,e){s>0?e<-bn+_n&&(e=-bn+_n):e>bn-_n&&(e=bn-_n);var i=s/Rn(Zr(e),n);return[i*Bn(n*t),s-i*Tn(n*t)]}return r.invert=function(t,e){var i=s-e,r=In(n)*Dn(t*t+i*i),a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,2*Mn(Rn(s/r,1/n))-bn]},r}function Qr(t,e){return[t,e]}function ta(t,e){var i=Tn(t),n=t===e?Bn(t):(i-Tn(e))/(e-t),s=i/n+t;if(kn(n)<_n)return Qr;function r(t,e){var i=s-e,r=n*t;return[i*Bn(r),s-i*Tn(r)]}return r.invert=function(t,e){var i=s-e,r=Cn(t,kn(i))*In(i);return i*n<0&&(r-=vn*In(t)*In(i)),[r/n,s-In(n)*Dn(t*t+i*i)]},r}Xr.invert=Ur((function(t){return t})),$r.invert=function(t,e){return[t,2*Mn(En(e))-bn]},Qr.invert=Qr;var ea=1.340264,ia=-.081106,na=893e-6,sa=.003796,ra=Dn(3)/2;function aa(t,e){var i=Fn(ra*Bn(e)),n=i*i,s=n*n*n;return[t*Tn(i)/(ra*(ea+3*ia*n+s*(7*na+9*sa*n))),i*(ea+ia*n+s*(na+sa*n))]}function oa(t,e){var i=Tn(e),n=Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function la(t,e){var i=e*e,n=i*i;return[t*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791)),e*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))]}function ha(t,e){return[Tn(e)*Bn(t),Bn(e)]}function ca(t,e){var i=Tn(e),n=1+Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function da(t,e){return[Pn(Ln((bn+e)/2)),-t]}aa.invert=function(t,e){for(var i,n=e,s=n*n,r=s*s*s,a=0;a<12&&(r=(s=(n-=i=(n*(ea+ia*s+r*(na+sa*s))-e)/(ea+3*ia*s+r*(7*na+9*sa*s)))*n)*s*s,!(kn(i)<1e-12));++a);return[ra*t*(ea+3*ia*s+r*(7*na+9*sa*s))/Tn(n),Fn(Bn(n)/ra)]},oa.invert=Ur(Mn),la.invert=function(t,e){var i,n=e,s=25;do{var r=n*n,a=r*r;n-=i=(n*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))-e)/(1.007226+r*(.045255+a*(.259866*r-.311325-.005916*11*a)))}while(kn(i)>_n&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ha.invert=Ur(Fn),ca.invert=Ur((function(t){return 2*Mn(t)})),da.invert=function(t,e){return[-e,2*Mn(En(t))-bn]},Kr().translate([0,0]).center([0,0]).scale(63781);var ua=Object.prototype.hasOwnProperty;function pa(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^ya[2]^ya[3])}function va(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=pa(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return _a(r[t])}function S(t,e){return ga(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=Sa(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ia(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Da(t,e)}))}:Da(t,e)}function Da(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=La(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function La(t,e){var i=Ra(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function Ha(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Ba(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=ja(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=Ya(t.slice(0,n),e),o=Ya(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Xa=Ya;!function(t){var e=Xa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=Ka(Ja,e),{tolerance:n}=i;return $a(t,n)};var to;!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"}(to||(to={}));const eo=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},io=(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.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?"+"+oo(e,6):oo(e,4))+"-"+oo(t.getUTCMonth()+1,2)+"-"+oo(t.getUTCDate(),2)+(r?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"."+oo(r,3)+"Z":s?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"Z":n||i?"T"+oo(i,2)+":"+oo(n,2)+"Z":"")}function ho(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 so;if(h)return h=!1,no;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.DSV;const i=Ka(po,e),{delimiter:n}=i;if(!f(n))throw new TypeError("Invalid delimiter: must be a string!");return ho(n).parse(t)},fo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,co(t)},mo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,uo(t)};function yo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return _o(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 _o(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return bo(t);default:throw new Error("unknown GeoJSON type")}}function _o(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=vo(t.properties),e.geometry=bo(t.geometry),e}function vo(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=vo(n):e[i]=n})),e):e}function bo(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return bo(t)})),e):(e.coordinates=xo(t.coordinates),e)}function xo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return xo(t)}))}function So(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 wo(t){for(var e,i,n=So(t),s=0,r=1;r0}function Ao(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=yo(t));var r=[];switch(t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,n)})),t;case"FeatureCollection":return Ao(t,(function(t){Ao(Co(t,n),(function(t){r.push(t)}))})),on(r)}return Co(t,n)}function Co(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,e)})),t;case"LineString":return To(So(t),e),t;case"Polygon":return Eo(So(t),e),t;case"MultiLineString":return So(t).forEach((function(t){To(t,e)})),t;case"MultiPolygon":return So(t).forEach((function(t){Eo(t,e)})),t;case"Point":case"MultiPoint":return t}}function To(t,e){wo(t)===e&&t.reverse()}function Eo(t,e){wo(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Po(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Do=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.GEO;const i=Ka(Bo,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Io(t))})):e.push(Io(t))})),e})(t);let o=t.features;return a&&(o=Mo(t,{reverse:!d(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Ro.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Ro.bounds(t);t.bbox=e}})),t.features=o,t},Lo={},Oo=(t,e,i)=>{i.type=to.GEO;const n=Ka(Bo,Lo,e),{object:s}=n;if(!f(s))throw new TypeError("Invalid object: must be a string!");const r=Ia(t,t.objects[s]);return Do(r,n,i)},Fo=(t,e,i)=>{const n=!o(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!m(t))throw new TypeError("Invalid data: must be DataView array!");return m(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 zo=0;function Ho(){return zo>1e8&&(zo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+zo++}class jo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new r,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Ho("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){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){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const No="_data-view-diff-rank";class Vo{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new r,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Ho("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",io),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=R(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[No]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[No]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[No][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);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};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};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};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};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};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};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};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};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};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};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};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};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};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};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};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=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));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Go(t,e){const i=new Set(N(t)),n=new Set(N(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Uo}=le,Yo=(t,e)=>(l($o.warnHandler)&&$o.warnHandler.call(null,t,e),e?We.getInstance().warn(`[VChart warn]: ${t}`,e):We.getInstance().warn(`[VChart warn]: ${t}`)),Xo=(t,e,i)=>{const n=new Error(t);return We.getInstance().error(`[VChart error]: ${n}`,e)},$o={silent:!1,warnHandler:!1,errorHandler:!1},Ko="undefined"!=typeof window&&void 0!==window.document,qo=Ko&&globalThis.document;function Zo(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ko}function Jo(t){return"miniApp"===t||"mobile-browser"===t}function Qo(t){return t.includes("miniApp")||"lynx"===t}let tl=0;function el(){return tl>=9999999&&(tl=0),tl++}function il(t){return!h(t)&&(!!v(t)||+t==+t)}function nl(t){return!(!t||0===t.length)&&(!h(t[0])&&!h(t[0].dataId)&&m(t[0].fields))}const sl=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const rl=t=>e=>C(e,t),al=t=>{We.getInstance().error(t)},ol=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||al("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&al("Access path missing closing bracket: "+t),a&&al("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return sl((i&&i.get||rl)(n),[s],e||s)},ll=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m(t)){const n=t.map((t=>ol(t,e,i)));return t=>n.map((e=>e(t)))}return ol(t,e,i)};ll("id");const hl=sl((function(t){return t}),[],"identity"),cl=sl((function(){return 0}),[],"zero");sl((function(){return 1}),[],"one"),sl((function(){return!0}),[],"true"),sl((function(){return!1}),[],"false"),sl((function(){return{}}),[],"emptyObject");const dl=(t,e)=>{if((te||h(e))&&!h(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},ul=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>dl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=N(e)||[],s=[],r=[],a={},o=i.comparator||ul;return N(t).forEach(((t,e)=>{if(h(t))return;s.push("desc"===n[e]?-1:1);const o=l(t)?t:ll(t,null,i);var c;r.push(o),(c=o,(h(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:sl(o(r,s),Object.keys(a))},gl=(t,e)=>{const i=l(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(h(e)||h(i))return h(e)&&h(i);if(!u(e)&&!u(i))return e===i;const s=m(e)?e:e[t],r=m(i)?i:i[t];return s===r||!1!==n&&(m(r)?!(!m(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!d(r)&&!(!d(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>fl(t,r,s)))))},ml=(t,e)=>h(t)?e:Math.min(f(t)?e*parseFloat(t)/100:t,e);function yl(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!h(s)&&(s=+s)>=s&&!h(r)&&(r=+r)>=r&&n(s,r,++a)}))}function _l(t,e,i,n,s){let r=0,a=0;return yl(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function vl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;yl(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:_l(t,e,i,s,h)}}const bl=rt;function xl(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Sl=t=>b(t)?Gt(t):null,wl=t=>b(t)?Ut(t):null;function Al(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function kl(t,e,i,n){const s=Al({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function Ml(t){return 3===t||4===t}function Cl(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)}function Tl(t,e){const i=e?+t[0][e]:+t[0];if(!b(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&n{const n=e?+i[e]:+i;return b(n)&&n>t&&(t=n),t}),i)}function Pl(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;b(s)&&(i+=s,n++)}));return i/n}function Rl(t,e){const i=Pl(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Bl(t){let e="center",i="middle";return e=(t=xl(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}}function Il(t,e){const i=Dl(t),n=Dl(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 Dl(t,e={x:0,y:0}){return jt.distancePP(t,e)}function Ll(t,e,i){let n=!1;if(e&&l(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 Ol(t){return function(e){let i;return i=m(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var Fl;function zl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:return!0;default:return!1}}function Hl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}function jl(t){switch(t){case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}!function(t){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"}(Fl||(Fl={}));class Nl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Vl=Symbol("implicit");class Wl extends Nl{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=Fl.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Vl}clone(){return(new Wl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}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!==Vl)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Yl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),Xl=t=>t<0?-t*t:t*t,$l=t=>-Math.log(-t),Kl=t=>-Math.exp(-t),ql=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Zl=t=>10===t?ql:t===Math.E?Math.exp:e=>Math.pow(t,e),Jl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Ql=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),th=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function eh(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 ih(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function nh(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class ah extends Wl{constructor(t){super(),this.type=Fl.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Y(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&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=[$(t[0]),$(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[$(t[0]),$(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:rh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}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()}clone(){return new ah(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:oh}=le;function lh(t,e){const i=typeof e;let n;if(h(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=se.parseColorString(e)){const e=oh(se.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof re?oh(t,e):e instanceof se?oh(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class hh extends Nl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Gl,this._piecewise=ih,this._interpolate=lh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,$);return this._domain=i,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){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=ut(this._domain[0],this._domain[n-1])),this._piecewise=n>2?nh:ih,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Gl),this.rescale(i)):this._clamp!==Gl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ch=Math.sqrt(50),dh=Math.sqrt(10),uh=Math.sqrt(2);function ph(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=ch?a=10:r>=dh?a=5:r>=uh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function fh(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=gh(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class _h extends hh{constructor(){super(...arguments),this.type=Fl.Linear}clone(){return(new _h).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function vh(t){return e=>-t(-e)}class bh extends hh{constructor(){super(Jl(10),Zl(10)),this.type=Fl.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new bh).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){if(t)return this;super.rescale();const e=Jl(this._base),i=Zl(this._base);return this._domain[0]<0?(this._logs=vh(e),this._pows=vh(i),this.transformer=$l,this.untransformer=Kl):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Gl}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.length0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}nice(){return this.domain(sh(this.domain(),{floor:t=>this._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=R(this._domain);return this._domain&&(e[e.length-1]=t,this.domain(e)),this}niceMax(){const t=this._domain[0];this.nice();const e=R(this._domain);return this._domain&&(e[0]=t,this.domain(e)),this}}class xh extends ah{constructor(t){super(!1),this.type=Fl.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class Sh extends _h{constructor(){super(),this.type=Fl.Pow,this._exponent=1}clone(){return(new Sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=Gl,this.untransformer=Gl):.5===this._exponent?(this.transformer=Yl,this.untransformer=Xl):(this.transformer=Ul(this._exponent),this.untransformer=Ul(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function wh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class Ah{constructor(){this.type=Fl.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return wh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new kh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class Mh extends _h{constructor(){super(Yl,Xl),this.type=Fl.Sqrt}clone(){return(new Mh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Ch extends _h{constructor(){super(Ql(1),th(1)),this.type=Fl.Symlog,this._const=1}clone(){return(new Ch).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=Ql(t),this.untransformer=th(t),this.rescale(e)):this._const}}class Th{constructor(){this.type=Fl.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!h(t)&&b(+t)?this._range[q(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 Th).domain(this._domain).range(this._range).unknown(this._unknown)}}const Eh=[["second",1,Qe],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,ti],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,ei],["hour",3,3*ei],["hour",6,6*ei],["hour",12,12*ei],["day",1,ii],["day",2,2*ii],["day",7,7*ii],["month",1,ni],["month",3,3*ni],["month",6,6*ni],["year",1,365*ii]];function Ph(t){return+xt(t)}function Rh(t,e,i,n){const s=(+e-+t)/i,r=q(Eh.map((t=>t[2])),s);if(r===Eh.length){const s=Math.max(it(+t/si,+e/si,i),1),r=t=>(t[Je(n)](Math.floor(t[Ue(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Je(n)](t[Ue(n)]()+e*s),t);return{floor:r,offset:a,ceil:Qi(r,a)}}if(0===r){const n=Math.max(it(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Qi(s,r)}}const[a,o]=Eh[s/Eh[r-1][2]"year"===t&&e?{floor:hi,offset:ci,count:di,field:ui}:"month"===t&&e?{floor:yi,offset:_i,count:vi,field:bi}:"day"===t&&e?{floor:ki,offset:Mi,count:Ci,field:Ti}:"hour"===t&&e?{floor:Ii,offset:Di,count:Ri,field:Li}:"minute"===t&&e?{floor:ji,offset:Ni,count:zi,field:Vi}:"second"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"year"===t?{floor:ri,offset:ai,count:oi,field:li}:"month"===t?{floor:pi,offset:gi,count:fi,field:mi}:"day"===t?{floor:xi,offset:Si,count:wi,field:Ai}:"hour"===t?{floor:Ei,offset:Pi,count:Ri,field:Bi}:"minute"===t?{floor:Oi,offset:Fi,count:zi,field:Hi}:"second"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:{floor:qi,offset:Zi,count:Ji})(a,n);return tn(o,l)}class Bh extends hh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=Fl.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(xt);const i=Array.from(t,Ph);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=xt(t),s=e[Ue(n)](),r=e[Ye(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Xe(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[$e(n)](),c=(h-1)%12+1,d=e[Ke(n)](),u=e[qe(n)](),p=e[Ze(n)]();return(i||"").replace(/YYYY/g,ht(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,ht(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,ht(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,ht(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,ht(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,ht(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,ht(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,ht(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Bh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(v(t)||h(t))&&(i=Rh(e[0],e[e.length-1],h(t)?10:t,this._isUtc)),i&&this.domain(sh(e,i)),this}utc(){return this._isUtc}}function Ih(t,e){const i=c(e)?t?.[e]??t?.default:t?.default;if(!i||m(i))return i;if(d(i)){const{dataScheme:n}=i;return n?zh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c)}))):n.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c):[]}return[]}function Dh(t,e){return zh(t)?t.find((t=>c(t.isAvailable)?l(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!c(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function Lh(t,e,i){const n=c(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!c(e.a)&&!c(e.l)||!f(s))return s;let r=new Uo(s);if(c(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Jt(t,i,n),o=Zt(s,a,e.l),l=new Uo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return c(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Oh=(t,e,i)=>{if(Fh(t)&&e){const n=Lh(e,t,i);if(n)return n}return t};function Fh(t){return d(t)&&"palette"===t.type&&!!t.key}function zh(t){return!!m(t)&&t.every((t=>c(t.scheme)))}class Hh extends Wl{_range;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(!zh(this._range))return void super.range(this._range);const t=Dh(this._range,this._domain);super.range(t)}}const jh={linear:_h,band:ah,point:xh,ordinal:Wl,threshold:Th,colorOrdinal:Hh};function Nh(t){const e=jh[t];return e?new e:null}function Vh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Wh(t){return c(t?.field)&&c(t?.scale)}var Gh;function Uh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Yh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Xh(t){return!!f(t)&&(!!t.endsWith("%")&&il(t.substring(0,t.length-1)))}function $h(t,e,i){return v(t)?t:Xh(t)?Number(t.substring(0,t.length-1))*e/100:l(t)?t(i):0}function Kh(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>v(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=$h(t[s],e.size,i)}))})),n}function qh(t){let e={};return m(t)?(h(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),h(t[1])||(e.left=e.right=t[1]),h(t[2])||(e.bottom=t[2]),h(t[3])||(e.left=t[3]),e):v(t)||Xh(t)||l(t)?(e.top=e.left=e.bottom=e.right=t,e):(d(t)&&(e={...t}),e)}function Zh(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function Jh(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]=Jh(t[n],e)}return i}return m(t)?t.map((t=>Jh(t,e))):t}function Qh(t){const e=t;let i;if(!c(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof Vo||e.every((t=>i.includes(t)))}(e))return e;const n=m(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:o(e)||v(e)||f(e)?e:_(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=Qh(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(Gh||(Gh={}));var tc=function(t){return t&&t.Math==Math&&t},ec=tc("object"==typeof globalThis&&globalThis)||tc("object"==typeof window&&window)||tc("object"==typeof self&&self)||tc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),ic={},nc=function(t){try{return!!t()}catch(t){return!0}},sc=!nc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),rc=!nc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),ac=rc,oc=Function.prototype.call,lc=ac?oc.bind(oc):function(){return oc.apply(oc,arguments)},hc={},cc={}.propertyIsEnumerable,dc=Object.getOwnPropertyDescriptor,uc=dc&&!cc.call({1:2},1);hc.f=uc?function(t){var e=dc(this,t);return!!e&&e.enumerable}:cc;var pc,gc,fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},mc=rc,yc=Function.prototype,_c=yc.call,vc=mc&&yc.bind.bind(_c,_c),bc=mc?vc:function(t){return function(){return _c.apply(t,arguments)}},xc=bc,Sc=xc({}.toString),wc=xc("".slice),Ac=function(t){return wc(Sc(t),8,-1)},kc=nc,Mc=Ac,Cc=Object,Tc=bc("".split),Ec=kc((function(){return!Cc("z").propertyIsEnumerable(0)}))?function(t){return"String"==Mc(t)?Tc(t,""):Cc(t)}:Cc,Pc=function(t){return null==t},Rc=Pc,Bc=TypeError,Ic=function(t){if(Rc(t))throw Bc("Can't call method on "+t);return t},Dc=Ec,Lc=Ic,Oc=function(t){return Dc(Lc(t))},Fc="object"==typeof document&&document.all,zc={all:Fc,IS_HTMLDDA:void 0===Fc&&void 0!==Fc},Hc=zc.all,jc=zc.IS_HTMLDDA?function(t){return"function"==typeof t||t===Hc}:function(t){return"function"==typeof t},Nc=jc,Vc=zc.all,Wc=zc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Nc(t)||t===Vc}:function(t){return"object"==typeof t?null!==t:Nc(t)},Gc=ec,Uc=jc,Yc=function(t,e){return arguments.length<2?(i=Gc[t],Uc(i)?i:void 0):Gc[t]&&Gc[t][e];var i},Xc=bc({}.isPrototypeOf),$c=ec,Kc="undefined"!=typeof navigator&&String(navigator.userAgent)||"",qc=$c.process,Zc=$c.Deno,Jc=qc&&qc.versions||Zc&&Zc.version,Qc=Jc&&Jc.v8;Qc&&(gc=(pc=Qc.split("."))[0]>0&&pc[0]<4?1:+(pc[0]+pc[1])),!gc&&Kc&&(!(pc=Kc.match(/Edge\/(\d+)/))||pc[1]>=74)&&(pc=Kc.match(/Chrome\/(\d+)/))&&(gc=+pc[1]);var td=gc,ed=nc,id=ec.String,nd=!!Object.getOwnPropertySymbols&&!ed((function(){var t=Symbol();return!id(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&td&&td<41})),sd=nd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rd=Yc,ad=jc,od=Xc,ld=Object,hd=sd?function(t){return"symbol"==typeof t}:function(t){var e=rd("Symbol");return ad(e)&&od(e.prototype,ld(t))},cd=String,dd=function(t){try{return cd(t)}catch(t){return"Object"}},ud=jc,pd=dd,gd=TypeError,fd=function(t){if(ud(t))return t;throw gd(pd(t)+" is not a function")},md=fd,yd=Pc,_d=function(t,e){var i=t[e];return yd(i)?void 0:md(i)},vd=lc,bd=jc,xd=Wc,Sd=TypeError,wd={exports:{}},Ad=ec,kd=Object.defineProperty,Md=function(t,e){try{kd(Ad,t,{value:e,configurable:!0,writable:!0})}catch(i){Ad[t]=e}return e},Cd=Md,Td="__core-js_shared__",Ed=ec[Td]||Cd(Td,{}),Pd=Ed;(wd.exports=function(t,e){return Pd[t]||(Pd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Rd=wd.exports,Bd=Ic,Id=Object,Dd=function(t){return Id(Bd(t))},Ld=Dd,Od=bc({}.hasOwnProperty),Fd=Object.hasOwn||function(t,e){return Od(Ld(t),e)},zd=bc,Hd=0,jd=Math.random(),Nd=zd(1..toString),Vd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Nd(++Hd+jd,36)},Wd=Rd,Gd=Fd,Ud=Vd,Yd=nd,Xd=sd,$d=ec.Symbol,Kd=Wd("wks"),qd=Xd?$d.for||$d:$d&&$d.withoutSetter||Ud,Zd=function(t){return Gd(Kd,t)||(Kd[t]=Yd&&Gd($d,t)?$d[t]:qd("Symbol."+t)),Kd[t]},Jd=lc,Qd=Wc,tu=hd,eu=_d,iu=function(t,e){var i,n;if("string"===e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;if(bd(i=t.valueOf)&&!xd(n=vd(i,t)))return n;if("string"!==e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;throw Sd("Can't convert object to primitive value")},nu=TypeError,su=Zd("toPrimitive"),ru=function(t,e){if(!Qd(t)||tu(t))return t;var i,n=eu(t,su);if(n){if(void 0===e&&(e="default"),i=Jd(n,t,e),!Qd(i)||tu(i))return i;throw nu("Can't convert object to primitive value")}return void 0===e&&(e="number"),iu(t,e)},au=hd,ou=function(t){var e=ru(t,"string");return au(e)?e:e+""},lu=Wc,hu=ec.document,cu=lu(hu)&&lu(hu.createElement),du=function(t){return cu?hu.createElement(t):{}},uu=du,pu=!sc&&!nc((function(){return 7!=Object.defineProperty(uu("div"),"a",{get:function(){return 7}}).a})),gu=sc,fu=lc,mu=hc,yu=fc,_u=Oc,vu=ou,bu=Fd,xu=pu,Su=Object.getOwnPropertyDescriptor;ic.f=gu?Su:function(t,e){if(t=_u(t),e=vu(e),xu)try{return Su(t,e)}catch(t){}if(bu(t,e))return yu(!fu(mu.f,t,e),t[e])};var wu={},Au=sc&&nc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ku=Wc,Mu=String,Cu=TypeError,Tu=function(t){if(ku(t))return t;throw Cu(Mu(t)+" is not an object")},Eu=sc,Pu=pu,Ru=Au,Bu=Tu,Iu=ou,Du=TypeError,Lu=Object.defineProperty,Ou=Object.getOwnPropertyDescriptor,Fu="enumerable",zu="configurable",Hu="writable";wu.f=Eu?Ru?function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Hu in i&&!i[Hu]){var n=Ou(t,e);n&&n[Hu]&&(t[e]=i.value,i={configurable:zu in i?i[zu]:n[zu],enumerable:Fu in i?i[Fu]:n[Fu],writable:!1})}return Lu(t,e,i)}:Lu:function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),Pu)try{return Lu(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Du("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var ju=wu,Nu=fc,Vu=sc?function(t,e,i){return ju.f(t,e,Nu(1,i))}:function(t,e,i){return t[e]=i,t},Wu={exports:{}},Gu=sc,Uu=Fd,Yu=Function.prototype,Xu=Gu&&Object.getOwnPropertyDescriptor,$u=Uu(Yu,"name"),Ku={EXISTS:$u,PROPER:$u&&"something"===function(){}.name,CONFIGURABLE:$u&&(!Gu||Gu&&Xu(Yu,"name").configurable)},qu=jc,Zu=Ed,Ju=bc(Function.toString);qu(Zu.inspectSource)||(Zu.inspectSource=function(t){return Ju(t)});var Qu,tp,ep,ip=Zu.inspectSource,np=jc,sp=ec.WeakMap,rp=np(sp)&&/native code/.test(String(sp)),ap=Vd,op=Rd("keys"),lp=function(t){return op[t]||(op[t]=ap(t))},hp={},cp=rp,dp=ec,up=Wc,pp=Vu,gp=Fd,fp=Ed,mp=lp,yp=hp,_p="Object already initialized",vp=dp.TypeError,bp=dp.WeakMap;if(cp||fp.state){var xp=fp.state||(fp.state=new bp);xp.get=xp.get,xp.has=xp.has,xp.set=xp.set,Qu=function(t,e){if(xp.has(t))throw vp(_p);return e.facade=t,xp.set(t,e),e},tp=function(t){return xp.get(t)||{}},ep=function(t){return xp.has(t)}}else{var Sp=mp("state");yp[Sp]=!0,Qu=function(t,e){if(gp(t,Sp))throw vp(_p);return e.facade=t,pp(t,Sp,e),e},tp=function(t){return gp(t,Sp)?t[Sp]:{}},ep=function(t){return gp(t,Sp)}}var wp={set:Qu,get:tp,has:ep,enforce:function(t){return ep(t)?tp(t):Qu(t,{})},getterFor:function(t){return function(e){var i;if(!up(e)||(i=tp(e)).type!==t)throw vp("Incompatible receiver, "+t+" required");return i}}},Ap=bc,kp=nc,Mp=jc,Cp=Fd,Tp=sc,Ep=Ku.CONFIGURABLE,Pp=ip,Rp=wp.enforce,Bp=wp.get,Ip=String,Dp=Object.defineProperty,Lp=Ap("".slice),Op=Ap("".replace),Fp=Ap([].join),zp=Tp&&!kp((function(){return 8!==Dp((function(){}),"length",{value:8}).length})),Hp=String(String).split("String"),jp=Wu.exports=function(t,e,i){"Symbol("===Lp(Ip(e),0,7)&&(e="["+Op(Ip(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Cp(t,"name")||Ep&&t.name!==e)&&(Tp?Dp(t,"name",{value:e,configurable:!0}):t.name=e),zp&&i&&Cp(i,"arity")&&t.length!==i.arity&&Dp(t,"length",{value:i.arity});try{i&&Cp(i,"constructor")&&i.constructor?Tp&&Dp(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Rp(t);return Cp(n,"source")||(n.source=Fp(Hp,"string"==typeof e?e:"")),t};Function.prototype.toString=jp((function(){return Mp(this)&&Bp(this).source||Pp(this)}),"toString");var Np=Wu.exports,Vp=jc,Wp=wu,Gp=Np,Up=Md,Yp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Vp(i)&&Gp(i,r,n),n.global)s?t[e]=i:Up(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Wp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Xp={},$p=Math.ceil,Kp=Math.floor,qp=Math.trunc||function(t){var e=+t;return(e>0?Kp:$p)(e)},Zp=function(t){var e=+t;return e!=e||0===e?0:qp(e)},Jp=Zp,Qp=Math.max,tg=Math.min,eg=function(t,e){var i=Jp(t);return i<0?Qp(i+e,0):tg(i,e)},ig=Zp,ng=Math.min,sg=function(t){return t>0?ng(ig(t),9007199254740991):0},rg=function(t){return sg(t.length)},ag=Oc,og=eg,lg=rg,hg=function(t){return function(e,i,n){var s,r=ag(e),a=lg(r),o=og(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},cg={includes:hg(!0),indexOf:hg(!1)},dg=Fd,ug=Oc,pg=cg.indexOf,gg=hp,fg=bc([].push),mg=function(t,e){var i,n=ug(t),s=0,r=[];for(i in n)!dg(gg,i)&&dg(n,i)&&fg(r,i);for(;e.length>s;)dg(n,i=e[s++])&&(~pg(r,i)||fg(r,i));return r},yg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_g=mg,vg=yg.concat("length","prototype");Xp.f=Object.getOwnPropertyNames||function(t){return _g(t,vg)};var bg={};bg.f=Object.getOwnPropertySymbols;var xg=Yc,Sg=Xp,wg=bg,Ag=Tu,kg=bc([].concat),Mg=xg("Reflect","ownKeys")||function(t){var e=Sg.f(Ag(t)),i=wg.f;return i?kg(e,i(t)):e},Cg=Fd,Tg=Mg,Eg=ic,Pg=wu,Rg=nc,Bg=jc,Ig=/#|\.prototype\./,Dg=function(t,e){var i=Og[Lg(t)];return i==zg||i!=Fg&&(Bg(e)?Rg(e):!!e)},Lg=Dg.normalize=function(t){return String(t).replace(Ig,".").toLowerCase()},Og=Dg.data={},Fg=Dg.NATIVE="N",zg=Dg.POLYFILL="P",Hg=Dg,jg=ec,Ng=ic.f,Vg=Vu,Wg=Yp,Gg=Md,Ug=function(t,e,i){for(var n=Tg(e),s=Pg.f,r=Eg.f,a=0;ar;r++)if((o=y(t[r]))&&bm(Mm,o))return o;return new km(!1)}n=xm(t,s)}for(l=u?t.next:n.next;!(h=fm(l,n)).done;){try{o=y(h.value)}catch(t){wm(n,"throw",t)}if("object"==typeof o&&o&&bm(Mm,o))return o}return new km(!1)},Tm=Xc,Em=TypeError,Pm=function(t,e){if(Tm(e,t))return t;throw Em("Incorrect invocation")},Rm=Zd("iterator"),Bm=!1;try{var Im=0,Dm={next:function(){return{done:!!Im++}},return:function(){Bm=!0}};Dm[Rm]=function(){return this},Array.from(Dm,(function(){throw 2}))}catch(al){}var Lm=wu.f,Om=Fd,Fm=Zd("toStringTag"),zm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Om(t,Fm)&&Lm(t,Fm,{configurable:!0,value:e})},Hm=bc,jm=fd,Nm=jc,Vm=String,Wm=TypeError,Gm=function(t,e,i){try{return Hm(jm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Um=Tu,Ym=function(t){if("object"==typeof t||Nm(t))return t;throw Wm("Can't set "+Vm(t)+" as a prototype")},Xm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Gm(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Um(i),Ym(n),e?t(i,n):i.__proto__=n,i}}():void 0),$m=jc,Km=Wc,qm=Xm,Zm=Xg,Jm=ec,Qm=bc,ty=Hg,ey=Yp,iy=If,ny=Cm,sy=Pm,ry=jc,ay=Pc,oy=Wc,ly=nc,hy=function(t,e){if(!e&&!Bm)return!1;var i=!1;try{var n={};n[Rm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},cy=zm,dy=function(t,e,i){var n,s;return qm&&$m(n=e.constructor)&&n!==i&&Km(s=n.prototype)&&s!==i.prototype&&qm(t,s),t},uy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=Jm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=Qm(o[t]);ey(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!oy(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ty(t,!ry(a)||!(s||o.forEach&&!ly((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),iy.enable();else if(ty(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=ly((function(){d.has(1)})),g=hy((function(t){new a(t)})),f=!s&&ly((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){sy(t,o);var i=dy(new a,t,l);return ay(e)||ny(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,Zm({global:!0,constructor:!0,forced:l!=a},h),cy(l,t),s||i.setStrong(l,t,n),l},py={},gy=mg,fy=yg,my=Object.keys||function(t){return gy(t,fy)},yy=sc,_y=Au,vy=wu,by=Tu,xy=Oc,Sy=my;py.f=yy&&!_y?Object.defineProperties:function(t,e){by(t);for(var i,n=xy(e),s=Sy(e),r=s.length,a=0;r>a;)vy.f(t,i=s[a++],n[i]);return t};var wy,Ay=Yc("document","documentElement"),ky=Tu,My=py,Cy=yg,Ty=hp,Ey=Ay,Py=du,Ry="prototype",By="script",Iy=lp("IE_PROTO"),Dy=function(){},Ly=function(t){return"<"+By+">"+t+""},Oy=function(t){t.write(Ly("")),t.close();var e=t.parentWindow.Object;return t=null,e},Fy=function(){try{wy=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Fy="undefined"!=typeof document?document.domain&&wy?Oy(wy):(e=Py("iframe"),i="java"+By+":",e.style.display="none",Ey.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Ly("document.F=Object")),t.close(),t.F):Oy(wy);for(var n=Cy.length;n--;)delete Fy[Ry][Cy[n]];return Fy()};Ty[Iy]=!0;var zy,Hy,jy,Ny=Object.create||function(t,e){var i;return null!==t?(Dy[Ry]=ky(t),i=new Dy,Dy[Ry]=null,i[Iy]=t):i=Fy(),void 0===e?i:My.f(i,e)},Vy=Np,Wy=wu,Gy=function(t,e,i){return i.get&&Vy(i.get,e,{getter:!0}),i.set&&Vy(i.set,e,{setter:!0}),Wy.f(t,e,i)},Uy=Yp,Yy=function(t,e,i){for(var n in e)Uy(t,n,e[n],i);return t},Xy=!nc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),$y=Fd,Ky=jc,qy=Dd,Zy=Xy,Jy=lp("IE_PROTO"),Qy=Object,t_=Qy.prototype,e_=Zy?Qy.getPrototypeOf:function(t){var e=qy(t);if($y(e,Jy))return e[Jy];var i=e.constructor;return Ky(i)&&e instanceof i?i.prototype:e instanceof Qy?t_:null},i_=nc,n_=jc,s_=Wc,r_=e_,a_=Yp,o_=Zd("iterator"),l_=!1;[].keys&&("next"in(jy=[].keys())?(Hy=r_(r_(jy)))!==Object.prototype&&(zy=Hy):l_=!0);var h_=!s_(zy)||i_((function(){var t={};return zy[o_].call(t)!==t}));h_&&(zy={}),n_(zy[o_])||a_(zy,o_,(function(){return this}));var c_={IteratorPrototype:zy,BUGGY_SAFARI_ITERATORS:l_},d_=c_.IteratorPrototype,u_=Ny,p_=fc,g_=zm,f_=Nf,m_=function(){return this},y_=Xg,__=lc,v_=jc,b_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=u_(d_,{next:p_(+!n,i)}),g_(t,s,!1),f_[s]=m_,t},x_=e_,S_=Xm,w_=zm,A_=Vu,k_=Yp,M_=Nf,C_=Ku.PROPER,T_=Ku.CONFIGURABLE,E_=c_.IteratorPrototype,P_=c_.BUGGY_SAFARI_ITERATORS,R_=Zd("iterator"),B_="keys",I_="values",D_="entries",L_=function(){return this},O_=Yc,F_=Gy,z_=sc,H_=Zd("species"),j_=Ny,N_=Gy,V_=Yy,W_=jf,G_=Pm,U_=Pc,Y_=Cm,X_=function(t,e,i,n,s,r,a){b_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!P_&&t in p)return p[t];switch(t){case B_:case I_:case D_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[R_]||p["@@iterator"]||s&&p[s],f=!P_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=x_(m.call(new t)))!==Object.prototype&&o.next&&(x_(o)!==E_&&(S_?S_(o,E_):v_(o[R_])||k_(o,R_,L_)),w_(o,d,!0)),C_&&s==I_&&g&&g.name!==I_&&(T_?A_(p,"name",I_):(u=!0,f=function(){return __(g,this)})),s)if(l={values:c(I_),keys:r?f:c(B_),entries:c(D_)},a)for(h in l)(P_||u||!(h in p))&&k_(p,h,l[h]);else y_({target:e,proto:!0,forced:P_||u},l);return p[R_]!==f&&k_(p,R_,f,{name:s}),M_[e]=f,l},$_=function(t,e){return{value:t,done:e}},K_=function(t){var e=O_(t);z_&&e&&!e[H_]&&F_(e,H_,{configurable:!0,get:function(){return this}})},q_=sc,Z_=If.fastKey,J_=wp.set,Q_=wp.getterFor,tv={getConstructor:function(t,e,i,n){var s=t((function(t,s){G_(t,r),J_(t,{type:e,index:j_(null),first:void 0,last:void 0,size:0}),q_||(t.size=0),U_(s)||Y_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Q_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=Z_(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),q_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=Z_(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return V_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,q_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),q_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=W_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),V_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),q_&&N_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=Q_(e),r=Q_(n);X_(t,e,(function(t,e){J_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?$_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,$_(void 0,!0))}),i?"entries":"values",!i,!0),K_(e)}};uy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),tv);var ev=Ac,iv=Array.isArray||function(t){return"Array"==ev(t)},nv=bc,sv=nc,rv=jc,av=Jf,ov=ip,lv=function(){},hv=[],cv=Yc("Reflect","construct"),dv=/^\s*(?:class|function)\b/,uv=nv(dv.exec),pv=!dv.exec(lv),gv=function(t){if(!rv(t))return!1;try{return cv(lv,hv,t),!0}catch(t){return!1}},fv=function(t){if(!rv(t))return!1;switch(av(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pv||!!uv(dv,ov(t))}catch(t){return!0}};fv.sham=!0;var mv=!cv||sv((function(){var t;return gv(gv.call)||!gv(Object)||!gv((function(){t=!0}))||t}))?fv:gv,yv=iv,_v=mv,vv=Wc,bv=Zd("species"),xv=Array,Sv=function(t){var e;return yv(t)&&(e=t.constructor,(_v(e)&&(e===xv||yv(e.prototype))||vv(e)&&null===(e=e[bv]))&&(e=void 0)),void 0===e?xv:e},wv=jf,Av=Ec,kv=Dd,Mv=rg,Cv=function(t,e){return new(Sv(t))(0===e?0:e)},Tv=bc([].push),Ev=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=kv(l),f=Av(g),m=wv(h,c),y=Mv(f),_=0,v=d||Cv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Tv(b,u)}else switch(t){case 4:return!1;case 7:Tv(b,u)}return r?-1:n||s?s:b}},Pv={forEach:Ev(0),map:Ev(1),filter:Ev(2),some:Ev(3),every:Ev(4),find:Ev(5),findIndex:Ev(6),filterReject:Ev(7)},Rv=bc,Bv=Yy,Iv=If.getWeakData,Dv=Pm,Lv=Tu,Ov=Pc,Fv=Wc,zv=Cm,Hv=Fd,jv=wp.set,Nv=wp.getterFor,Vv=Pv.find,Wv=Pv.findIndex,Gv=Rv([].splice),Uv=0,Yv=function(t){return t.frozen||(t.frozen=new Xv)},Xv=function(){this.entries=[]},$v=function(t,e){return Vv(t.entries,(function(t){return t[0]===e}))};Xv.prototype={get:function(t){var e=$v(this,t);if(e)return e[1]},has:function(t){return!!$v(this,t)},set:function(t,e){var i=$v(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Wv(this.entries,(function(e){return e[0]===t}));return~e&&Gv(this.entries,e,1),!!~e}};var Kv,qv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Dv(t,r),jv(t,{type:e,id:Uv++,frozen:void 0}),Ov(s)||zv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Nv(e),o=function(t,e,i){var n=a(t),s=Iv(Lv(e),!0);return!0===s?Yv(n).set(e,i):s[n.id]=i,t};return Bv(r,{delete:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).delete(t):i&&Hv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).has(t):i&&Hv(i,e.id)}}),Bv(r,i?{get:function(t){var e=a(this);if(Fv(t)){var i=Iv(t);return!0===i?Yv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},Zv=yf,Jv=ec,Qv=bc,tb=Yy,eb=If,ib=uy,nb=qv,sb=Wc,rb=wp.enforce,ab=nc,ob=rp,lb=Object,hb=Array.isArray,cb=lb.isExtensible,db=lb.isFrozen,ub=lb.isSealed,pb=lb.freeze,gb=lb.seal,fb={},mb={},yb=!Jv.ActiveXObject&&"ActiveXObject"in Jv,_b=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},vb=ib("WeakMap",_b,nb),bb=vb.prototype,xb=Qv(bb.set);if(ob)if(yb){Kv=nb.getConstructor(_b,"WeakMap",!0),eb.enable();var Sb=Qv(bb.delete),wb=Qv(bb.has),Ab=Qv(bb.get);tb(bb,{delete:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),Sb(this,t)||e.frozen.delete(t)}return Sb(this,t)},has:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)||e.frozen.has(t)}return wb(this,t)},get:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)?Ab(this,t):e.frozen.get(t)}return Ab(this,t)},set:function(t,e){if(sb(t)&&!cb(t)){var i=rb(this);i.frozen||(i.frozen=new Kv),wb(this,t)?xb(this,t,e):i.frozen.set(t,e)}else xb(this,t,e);return this}})}else Zv&&ab((function(){var t=pb([]);return xb(new vb,t,1),!db(t)}))&&tb(bb,{set:function(t,e){var i;return hb(t)&&(db(t)?i=fb:ub(t)&&(i=mb)),xb(this,t,e),i==fb&&pb(t),i==mb&&gb(t),this}});var kb=Yc,Mb=bc,Cb=Rd,Tb=kb("Map"),Eb=kb("WeakMap"),Pb=Mb([].push),Rb=Cb("metadata"),Bb=Rb.store||(Rb.store=new Eb),Ib=function(t,e,i){var n=Bb.get(t);if(!n){if(!i)return;Bb.set(t,n=new Tb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Tb)}return s},Db={store:Bb,getMap:Ib,has:function(t,e,i){var n=Ib(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Ib(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Ib(i,n,!0).set(t,e)},keys:function(t,e){var i=Ib(t,e,!1),n=[];return i&&i.forEach((function(t,e){Pb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Lb=Tu,Ob=Db.toKey,Fb=Db.set;Xg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Ob(arguments[3]);Fb(t,e,Lb(i),n)}});var zb=Tu,Hb=Db.toKey,jb=Db.getMap,Nb=Db.store;Xg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Hb(arguments[2]),n=jb(zb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=Nb.get(e);return s.delete(i),!!s.size||Nb.delete(e)}});var Vb=Tu,Wb=e_,Gb=Db.has,Ub=Db.get,Yb=Db.toKey,Xb=function(t,e,i){if(Gb(t,e,i))return Ub(t,e,i);var n=Wb(e);return null!==n?Xb(t,n,i):void 0};Xg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Yb(arguments[2]);return Xb(t,Vb(e),i)}});var $b=bc,Kb=Map.prototype,qb={Map:Map,set:$b(Kb.set),get:$b(Kb.get),has:$b(Kb.has),remove:$b(Kb.delete),proto:Kb},Zb=lc,Jb=bc,Qb=function(t,e,i){for(var n,s,r=i||t.next;!(n=Zb(r,t)).done;)if(void 0!==(s=e(n.value)))return s},tx=qb.Map,ex=qb.proto,ix=Jb(ex.forEach),nx=Jb(ex.entries),sx=nx(new tx).next,rx=fd,ax=Pc,ox=rg,lx=Dd,hx=function(t,e,i){return i?Qb(nx(t),(function(t){return e(t[1],t[0])}),sx):ix(t,e)},cx=qb.Map,dx=qb.has,ux=qb.set,px=bc([].push),gx=Xg,fx=bc,mx=Db,yx=Tu,_x=e_,vx=function(t){var e,i,n,s=lx(this),r=ox(s),a=[],o=new cx,l=ax(t)?function(t){return t}:rx(t);for(e=0;e= than the number of constructor arguments of its base class."},yS=function(t,e){return"@postConstruct error in class "+t+": "+e},_S=function(t,e){return"@preDestroy error in class "+t+": "+e},vS=function(t,e){return"onDeactivation() error in class "+t+": "+e},bS="Maximum call stack size exceeded",xS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(Zx,t),userGeneratedMetadata:Reflect.getMetadata(Kx,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(qx,t)||[]},t}(),SS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function wS(t){return t instanceof RangeError||t.message===bS}function AS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function kS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=TS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function MS(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||MS(t.parentRequest,e))}function CS(t){t.childRequests.forEach((function(t){if(MS(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=AS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(gS+" "+e)}CS(t)}))}function TS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ES=function(){function t(t){this.id=rS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),PS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Wx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),RS=function(t,e){this.parentContext=t,this.rootRequest=e},BS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),IS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),DS=function(){function t(t,e,i,n){this.id=rS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new IS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new PS(Wx,n):n instanceof PS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:jS(t,i)}return 0}function NS(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Xx],multiInject:e[$x],targetName:e[Gx],unmanaged:e[Ux]}}var VS=function(){function t(t,e,i,n,s){this.id=rS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function WS(t){return t._bindingDictionary}function GS(t,e,i,n,s){var r=YS(i.container,s.serviceIdentifier),a=[];return r.length===SS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=YS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new VS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case SS.NoBindingsAvailable:if(i.isOptional())return e;var s=AS(t),r=dS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=kS(n,s,YS),new Error(r);case SS.OnlyOneBindingAvailable:return e;case SS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=AS(t),r=cS+" "+s;throw r+=kS(n,s,YS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function US(t,e,i,n,s,r){var a,o;if(null===s){a=GS(t,e,n,null,r),o=new VS(i,n,null,a,r);var l=new RS(n,o);n.addPlan(l)}else a=GS(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===iS.Instance&&null!==e.implementationType){var s=function(t,e){return OS(t,TS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=jS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===nS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=KS(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=iw(iw({},s),{constr:t});n=s.isAsync?function(t){return nw(this,void 0,void 0,(function(){var e,i;return sw(this,(function(n){switch(n.label){case 0:return[4,lw(t.constructorInjections)];case 1:return e=n.sent(),[4,lw(t.propertyInjections)];case 2:return i=n.sent(),[2,ow(iw(iw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):ow(r)}else n=new t;return n}function ow(t){var e,i=new((e=t.constr).bind.apply(e,rw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function lw(t){return nw(this,void 0,void 0,(function(){var e,i,n,s;return sw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Ow=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Lw,onDeactivations:new Lw}},t}(),Fw=function(){return Fw=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new iA(e,i)})).inSingletonScope().whenTargetNamed(e)}class sA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class rA extends sA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const aA=Symbol.for("EnvContribution"),oA=Symbol.for("Global");var lA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,n){e(i,n,t)}};let dA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new rA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};dA=lA([Xw(),cA(0,qw(eA)),cA(0,$w(aA)),hA("design:paramtypes",[Object])],dA);const uA=kt-1e-8;class pA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>uA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=kt)<0&&(n+=kt),(s%=kt)<0&&(s+=kt),ss;++o,a-=At)g(a);else for(a=n-n%At+At,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const fA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,mA={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},yA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let _A,vA,bA,xA,SA,wA;var AA,kA,MA,CA,TA,EA,PA,RA,BA;function IA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function DA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Gt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=kt:T>0&&0===r&&(T-=kt);const E=Math.ceil(Math.abs(T/(At+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*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 FA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class XA extends YA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function $A(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class KA{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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function qA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new KA(s,n),t),s}function ZA(t,e,i,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,n)}class JA{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&&ZA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(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):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:ZA(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}tryUpdateLength(){return this.context.tryUpdateLength()}}function QA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("basis",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new JA(s,n),t),s}function tk(t){return t<0?-1:1}function ek(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(tk(r)+tk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function ik(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function nk(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class sk{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._lastDefined2);break;case 3:nk(this,this._t0,ik(this,this._t0),!1!==this._lastDefined2)}(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;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,nk(this,ik(this,e=ek(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:nk(this,this._t0,e=ek(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}}tryUpdateLength(){return this.context.tryUpdateLength()}}class rk extends sk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ak(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("monotoneX",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new sk(s,n),t),s}function ok(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new XA("monotoneY",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new rk(s,n),t),s}let lk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function hk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new YA("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new lk(r,e,s),t),r}class ck{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.context.closePath()}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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function dk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new ck(s,n),t),s}function uk(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}class pk extends gA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new pA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([yA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([yA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([yA.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([yA.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([yA.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([yA.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([yA.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([yA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([yA.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}toString(){if(!this.toStringCbList){const t=[];t[yA.M]=t=>`M${t[1]} ${t[2]}`,t[yA.L]=t=>`L${t[1]} ${t[2]}`,t[yA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[yA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[yA.A]=t=>{const e=[];LA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;twA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),FA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===PA.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===PA.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)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const gk=["l",0,0,0,0,0,0,0];function fk(t,e,i){const n=gk[0]=t[0];if("a"===n||"A"===n)gk[1]=e*t[1],gk[2]=i*t[2],gk[3]=t[3],gk[4]=t[4],gk[5]=t[5],gk[6]=e*t[6],gk[7]=i*t[7];else if("h"===n||"H"===n)gk[1]=e*t[1];else if("v"===n||"V"===n)gk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Pk=Object.assign(Object.assign({},Sk),{points:[],cornerRadius:0}),Rk=Object.assign(Object.assign({},Sk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Bk=Object.assign(Object.assign({},Sk),{width:0,height:0,cornerRadius:0,length:0}),Ik=Object.assign(Object.assign({},Sk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Dk=Object.assign(Object.assign(Object.assign({},Sk),bk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Lk=Object.assign(Object.assign({},Sk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ok=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Sk),{fill:!0}),Fk=Object.assign(Object.assign({},Ok),{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});var zk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Hk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Dk.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(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._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};Hk=zk([Xw()],Hk);var jk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Nk=Symbol.for("TextMeasureContribution");let Vk=class extends Hk{};Vk=jk([Xw()],Vk);const Wk=new Nw;const Gk=new class{},Uk=Symbol.for("CanvasFactory"),Yk=Symbol.for("Context2dFactory");function Xk(t){return Wk.getNamed(Uk,Gk.global.env)(t)}const $k=1e-4,Kk=Math.sqrt(3),qk=1/3;function Zk(t){return t>-dM&&tdM||t<-dM}const Qk=[0,0],tM=[0,0],eM=[0,0];function iM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function nM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function sM(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 rM(t){return(t%=Mt)<0&&(t+=Mt),t}function aM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function oM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Mt);let d=Math.atan2(l,o);return d<0&&(d+=Mt),d>=n&&d<=s||d+Mt>=n&&d+Mt<=s}function cM(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(Zk(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 pM=[-1,-1,-1],gM=[-1,-1];function fM(){const t=gM[0];gM[0]=gM[1],gM[1]=t}function mM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Zk(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,qk):Math.pow(i,qk),n=n<0?-Math.pow(-n,qk):Math.pow(n,qk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Kk*Math.sin(e)))/(3*a),h=(-o+i*(n-Kk*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,pM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&fM(),p=sM(e,n,r,o,gM[0]),u>1&&(g=sM(e,n,r,o,gM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(Zk(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,pM);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=nM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);pM[0]=-l,pM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Mt-1e-4){n=0,s=Mt;const e=r?1:-1;return a>=pM[0]+t&&a<=pM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Mt,s+=Mt);let c=0;for(let e=0;e<2;e++){const i=pM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=s||t+Mt>=n&&t+Mt<=s)&&(t>wt/2&&t<1.5*wt&&(e=-e),c+=e)}}return c}function vM(t){return Math.round(t/wt*1e8)/1e8%2*wt}function bM(t,e){let i=vM(t[0]);i<0&&(i+=Mt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Mt?s=i+Mt:e&&i-s>=Mt?s=i-Mt:!e&&i>s?s=i+(Mt-vM(i-s)):e&&i1&&(i||(h+=aM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;xM[0]=S,xM[1]=w,bM(xM,Boolean(a[6])),S=xM[0],w=xM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case yA.M:u=m,p=y,c=u,d=p;break;case yA.L:if(i){if(cM(c,d,m,y,e,n,s))return!0}else h+=aM(c,d,m,y,n,s)||0;c=m,d=y;break;case yA.C:if(i){if(lM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=mM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case yA.Q:if(i){if(oM(c,d,m,y,_,v,e,n,s))return!0}else h+=yM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case yA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=aM(c,d,o,l,n,s),i){if(hM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=_M(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case yA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(cM(u,p,o,p,e,n,s)||cM(o,p,o,l,e,n,s)||cM(o,l,u,l,e,n,s)||cM(u,l,u,p,e,n,s))return!0}else h+=aM(o,p,o,l,n,s),h+=aM(u,l,u,p,n,s);break;case yA.Z:if(i){if(cM(c,d,u,p,e,n,s))return!0}else h+=aM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kM=function(t,e){return function(i,n){e(i,n,t)}};let MM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Xk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:bk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new He(Object.assign({defaultFontParams:{fontFamily:bk.fontFamily,fontSize:bk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var CM;MM=wM([Xw(),kM(0,qw(eA)),kM(0,$w(Nk)),kM(1,qw(oA)),AM("design:paramtypes",[Object,Object])],MM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(CM||(CM={}));const TM=new qt;let EM=class{constructor(){this.matrix=new qt}init(t){return this.mode=CM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=CM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(TM.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(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}scale(t,e,i){return this.mode===CM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return TM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}translate(t,e){return this.mode===CM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===CM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};EM=wM([Xw(),AM("design:paramtypes",[])],EM);const PM={arc:wk,area:Ak,circle:kk,line:Tk,path:Ek,symbol:Ik,text:Dk,rect:Rk,rect3d:Bk,polygon:Pk,richtext:Lk,richtextIcon:Fk,image:Ok,group:Mk,glyph:Ck},RM=Object.keys(PM);function BM(){return{arc:Object.assign({},PM.arc),area:Object.assign({},PM.area),circle:Object.assign({},PM.circle),line:Object.assign({},PM.line),path:Object.assign({},PM.path),symbol:Object.assign({},PM.symbol),text:Object.assign({},PM.text),rect:Object.assign({},PM.rect),rect3d:Object.assign({},PM.rect3d),polygon:Object.assign({},PM.polygon),richtext:Object.assign({},PM.richtext),richtextIcon:Object.assign({},PM.richtextIcon),image:Object.assign({},PM.image),group:Object.assign({},PM.group),glyph:Object.assign({},PM.glyph)}}function IM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const DM=new Array(60).fill(0).map((()=>BM()));class LM{constructor(){this._defaultTheme=DM.pop()||BM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?IM(this.userTheme,t.userTheme,!1):this.userTheme=P(t.userTheme),IM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);RM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const OM=new LM;function FM(t,e){return t.glyphHost?FM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):OM.getTheme()}return null}(t)||OM.getTheme()}class zM{static GenAutoIncrementId(){return zM.auto_increment_id++}}zM.auto_increment_id=0;var HM=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 jM extends r{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=zM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return HM(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){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof WM))return void console.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(XM(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=XM(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");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),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 WM))return void console.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=XM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=XM(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.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=YM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(XM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(XM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,XM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof WM))return void console.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"):XM(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 GM))return void console.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.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;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.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){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=0&&t<=C(this.rootTarget,"width")&&e>=0&&e<=C(this.rootTarget,"height")?this.rootTarget:null,i}}const KM={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof NM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new UM(t,e))}},qM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class ZM{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(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,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new $M(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new WM,this.rootWheelEvent=new GM,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&f(t)&&!E(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class JM{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const QM=(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"},tC=(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 eC extends r{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=YM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=YM.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||QM(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=tC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=YM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=tC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=QM(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=YM.now()-i>this.config.press.time&&tC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class nC{static Avaliable(){return!0}avaliable(){return nC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class sC{static Avaliable(){return!!Gk.global.getRequestAnimationFrame()}avaliable(){return sC.Avaliable()}tick(t,e){Gk.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var rC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(rC||(rC={}));class aC{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-aC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*aC.bounceIn(2*t):.5*aC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}aC.quadIn=aC.getPowIn(2),aC.quadOut=aC.getPowOut(2),aC.quadInOut=aC.getPowInOut(2),aC.cubicIn=aC.getPowIn(3),aC.cubicOut=aC.getPowOut(3),aC.cubicInOut=aC.getPowInOut(3),aC.quartIn=aC.getPowIn(4),aC.quartOut=aC.getPowOut(4),aC.quartInOut=aC.getPowInOut(4),aC.quintIn=aC.getPowIn(5),aC.quintOut=aC.getPowOut(5),aC.quintInOut=aC.getPowInOut(5),aC.backIn=aC.getBackIn(1.7),aC.backOut=aC.getBackOut(1.7),aC.backInOut=aC.getBackInOut(1.7),aC.elasticIn=aC.getElasticIn(1,.3),aC.elasticOut=aC.getElasticOut(1,.3),aC.elasticInOut=aC.getElasticInOut(1,.3*1.5);const oC=new class{constructor(){this.id=zM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===CA.END?this.removeAnimate(e):e.status===CA.RUNNING||e.status===CA.INITIAL?(this.animateCount++,e.advance(t)):e.status===CA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class lC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class hC extends lC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let cC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oC;this.id=t,this.timeline=e,this.status=CA.INITIAL,this.tailAnimate=new dC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&TA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:MA.ANIMATE_PLAY})}runCb(t){const e=new hC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===CA.RUNNING&&(this.status=CA.PAUSED)}resume(){this.status===CA.PAUSED&&(this.status=CA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new dC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===CA.RUNNING&&(this.status=CA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=CA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};cC.mode=TA.NORMAL,cC.interpolateMap=new Map;class dC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new uC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?aC[i]:i,s=this._addStep(e,null,n);return s.type=EA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?aC[i]:i,r=this._addStep(e,null,s);return r.type=EA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=EA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=EA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new uC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class uC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const pC=200,gC="cubicOut",fC=1e3,mC="quadInOut";var yC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(yC||(yC={}));const _C=[!1,!1,!1,!1],vC=[0,0,0,0],bC=t=>t?m(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(vC[0]=t[0],vC[2]=t[0],vC[1]=t[1],vC[3]=t[1],vC):t:t:0,xC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],SC=[1,2,3,0,1,2,3,0];function wC(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;xC[0].x=i,xC[1].y=i,xC[2].x=-i,xC[3].y=-i;const s=Math.ceil(t/At)%4,r=Math.ceil(e/At)%4;if(n.add(Et(t)*i,Bt(t)*i),n.add(Et(e)*i,Bt(e)*i),s!==r||e-t>wt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ht(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=AC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class RC extends lC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:MA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class BC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=Gk.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class IC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=Gk.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class DC extends lC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Mt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+wt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z}}class LC extends lC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class OC extends lC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?aC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function FC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function zC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{rt(e,n)&&rt(i,s)||t.push(e,i,n,s,n,s)};function GC(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function UC(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 i=t.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),qC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ZC=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return qC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return qC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);ZC(s[0],n,i),ZC(s[1],e-n,i)}};var JC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const QC={};for(const t in JC)E(JC,t)&&(QC[JC[t]]=t);const tT={to:{},get:{}};function eT(t,e,i){return Math.min(Math.max(e,t),i)}function iT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}tT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=tT.get.hsl(t,n),i="hsl";break;case"hwb":e=tT.get.hwb(t,n),i="hwb";break;default:e=tT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},tT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=JC[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=eT(e[n],0,255);return e[3]=eT(e[3],0,1),e},tT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},tT.to.keyword=function(t){return QC[t.slice(0,3)]};const nT=tT;var sT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(sT||(sT={}));class rT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===sT.Color1){let e=rT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=tT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];rT.store1[t]=s,rT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=rT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=tT.get(t),n&&n.value){const e=n.value;rT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],rT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===sT.Color1){if(rT.store1[t])return;rT.store1[t]=i,rT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(rT.store255[t])return;rT.store255[t]=i,rT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function aT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 oT(t,e,i,n,s){if(!t||!e)return t&&aT(t)||e&&aT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=rT.Get(t,sT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=rT.Get(e,sT.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:aT(a)})))});return o?oT(r,l,i,n,s):oT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),aT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}rT.store255={},rT.store1={};const lT=[0,0,0,0],hT=[0,0,0,0];function cT(t,e,i){return rT.Get(t,sT.Color255,lT),rT.Get(e,sT.Color255,hT),`rgba(${Math.round(lT[0]+(hT[0]-lT[0])*i)},${Math.round(lT[1]+(hT[1]-lT[1])*i)},${Math.round(lT[2]+(hT[2]-lT[2])*i)},${lT[3]+(hT[3]-lT[3])*i})`}const dT=(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=oT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},uT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?GC(t):[],s=GC(e);i&&n&&(i.fromTransform&&UC(n,i.fromTransform.clone().getInverse()),UC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},gT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],fT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!gT.includes(s))return;const r=e[s];h(r)||h(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?rT.Get(t[s],sT.Color255):t[s],to:"string"==typeof r?rT.Get(r,sT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class mT extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;uT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&dT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const yT=(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=pT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=fT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new mT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:fC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:mC)),c};class _T extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;uT(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&&dT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const vT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>MC.includes(t))(i)||(e[i]=t[i])})),e},bT=(t,e,i)=>{const n=vT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Gk.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},xT=(t,e,i)=>{const n=[],s=i?null:vT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:vT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=XC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Gk.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=XC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=XC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return $C(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 $C(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Gk.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:KC(i)}];const n=[];return ZC(i,e,n),n})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&v(t.x)&&v(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 ZC(r,e,h),h})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=GC(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Gk.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&bT(t,n,e),n};class wT{static GetImage(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=wT.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},wT.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gk.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gk.global.loadBlob(t):"json"===e&&(i.dataPromise=Gk.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}wT.cache=new Map;const AT=new qt,kT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],MT=["x","y"],CT=["scaleX","scaleY"],TT=["angle"],ET=new Ht;class PT extends jM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Wt,this._updateTag=AA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=FM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;ET.x=i+e,ET.y=n+s}else ET.x=i,ET.y=n;return ET}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new qt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&AA.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&AA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=AA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===kA.GLOBAL){const i=new Ht(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Gk.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!h(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:pC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:gC)}else this.setAttributes(t,!1,{type:MA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();E(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=AA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=AA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&AA.UPDATE_SHAPE_AND_BOUNDS)===AA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=AA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=AA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=mk.x,y:e=mk.y,scaleX:i=mk.scaleX,scaleY:n=mk.scaleY,angle:s=mk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Et(a),f=Bt(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(mk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=AT.setValue(a.a,a.b,a.c,a.d,a.e,a.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:MA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=oT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return FM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gk.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return f(t,!0)?this.pathProxy=(new pk).fromString(t):this.pathProxy=new pk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",x(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(wT.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new UM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}PT.mixin(KM);var RT=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 BT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let IT=0;function DT(){return IT++}const LT=DT(),OT=DT(),FT=DT(),zT=DT(),HT=DT(),jT=DT(),NT=DT(),VT=DT(),WT=DT(),GT=DT(),UT=DT(),YT=DT(),XT=DT(),$T=DT(),KT=DT(),qT=DT(),ZT=Symbol.for("GraphicService"),JT=Symbol.for("GraphicCreator");var QT;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(QT||(QT={}));let tE=class t extends PT{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=jT,this._childUpdateTag=AA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new LM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new LM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===kA.GLOBAL){const i=new Ht(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&AA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=FM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Gk.graphicService.updateGroupAABBBounds(t,FM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=bC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS,this._childUpdateTag&=AA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&AA.UPDATE_BOUNDS||(this._childUpdateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Gk.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Gk.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Gk.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Gk.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&AA.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=Gk.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const eE=Symbol.for("LayerHandlerContribution");class iE extends tE{get offscreen(){return this.layerHandler.offscreen}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=Wk.get(eE),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 LM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Gk.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Gk.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var nE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rE=function(t,e){return function(i,n){e(i,n,t)}};let aE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new iE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};aE=nE([Xw(),rE(0,qw(oA)),sE("design:paramtypes",[Object])],aE);var oE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hE=function(t,e){return function(i,n){e(i,n,t)}};const cE=Symbol.for("Window"),dE=Symbol.for("WindowHandlerContribution");let uE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new rA(["x","y","width","height"])},this._uid=zM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Wk.getNamed(dE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};oE([tA(),lE("design:type",Function),lE("design:paramtypes",[]),lE("design:returntype",void 0)],uE.prototype,"postInit",null),uE=oE([Xw(),hE(0,qw(oA)),lE("design:paramtypes",[Object])],uE);const pE=Symbol.for("TransformUtil"),gE=Symbol.for("GraphicUtil"),fE=Symbol.for("LayerService");var mE=new Vw((t=>{t(dA).toSelf().inSingletonScope(),t(oA).toService(dA),t(uE).to(uE),t(cE).toService(uE),t(MM).toSelf().inSingletonScope(),t(gE).toService(MM),t(EM).toSelf().inSingletonScope(),t(pE).toService(EM),t(aE).toSelf().inSingletonScope(),t(fE).toService(aE)}));function yE(t){return!!t}function _E(t,e){let i;return i=m(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function vE(t,e){return t*e>0}function bE(t,e,i,n){return t*e>0&&i>0&&n>0}function xE(t,e){return t*e>0}function SE(t,e,i,n){return t*e>0&&i>0&&n>0}function wE(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=FM(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,m=vE(d,u),y=xE(d,g),_=yE(h),v=_E(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return FA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function AE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function ME(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(s=Mt-St)e.moveTo(i+s*Et(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>St&&(e.moveTo(i+r*Et(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*Et(f),T=s*Bt(f),E=r*Et(y),P=r*Bt(y);let R,B,I,D;if((A>St||w>St)&&(R=s*Et(m),B=s*Bt(m),I=r*Et(_),D=r*Bt(_),hSt){const t=Rt(v,k),r=Rt(b,k),o=kE(I,D,C,T,s,t,Number(c)),l=kE(R,B,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Et(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+R,n+s*Bt(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>St)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>St){const t=Rt(S,M),s=Rt(x,M),o=kE(E,P,R,B,r,-s,Number(c)),l=kE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Et(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*Et(_),n+r*Bt(_))}return a?a[3]&&e.lineTo(i+s*Et(l),n+s*Et(l)):e.closePath(),d}class CE{static GetCanvas(){try{return CE.canvas||(CE.canvas=Gk.global.createCanvas({})),CE.canvas}catch(t){return null}}static GetCtx(){if(!CE.ctx){const t=CE.GetCanvas();CE.ctx=t.getContext("2d")}return CE.ctx}}class TE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=CE.GetCanvas(),n=CE.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=TE.dataMap.get(i);return n||(n=new TE(t,e),TE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){TE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return TE.dataMap.get(t)}}TE.dataMap=new Map;class EE{static GetSize(t){for(let e=0;e=t)return EE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=EE.GenKey(t,e,i,n,s),l=EE.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=EE.GenKey(t,e,i,n,s);EE.cache[l]?EE.cache[l].push({width:a,height:o,pattern:r}):EE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}EE.cache={},EE.ImageSize=[20,40,80,160,320,640,1280,2560];const PE=Symbol.for("ArcRenderContribution"),RE=Symbol.for("AreaRenderContribution"),BE=Symbol.for("CircleRenderContribution"),IE=Symbol.for("GroupRenderContribution"),DE=Symbol.for("ImageRenderContribution"),LE=Symbol.for("PathRenderContribution"),OE=Symbol.for("PolygonRenderContribution"),FE=Symbol.for("RectRenderContribution"),zE=Symbol.for("SymbolRenderContribution"),HE=Symbol.for("TextRenderContribution"),jE=Symbol.for("InteractiveSubRenderContribution");var NE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WE=function(t,e){return function(i,n){e(i,n,t)}};let GE=class{constructor(t){this.arcRenderContribitions=t,this.numberType=LT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Ct(d-c),p=d>c;let g=!1;if(sSt||M>St)&&(D=s*Et(v),L=s*Bt(v),O=r*Et(x),F=r*Bt(x),uSt){const t=Rt(S,T),r=Rt(w,T),a=kE(O,F,P,R,s,t,Number(p)),o=kE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>St)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>St){const t=Rt(k,E),s=Rt(A,E),a=kE(B,I,D,L,r,-s,Number(p)),o=kE(P,R,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Et(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,l){const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x:_=h.x,y:v=h.y}=t.attribute,b=vE(p,g),x=xE(p,m),S=yE(c),w=_E(u,f);if(!t.valid||!y)return;if(!(S||w||d))return;if(!(b||x||a||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=!1;const{isFullStroke:E,stroke:P}=(t=>{var e;let i=!0;if(o(t,!0)){for(let n=0;n<4;n++)_C[n]=t,i&&(i=!(null!==(e=_C[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)_C[e]=!!t[e],i&&(i=!!_C[e]);else _C[0]=!1,_C[1]=!1,_C[2]=!1,_C[3]=!1;return{isFullStroke:i,stroke:_C}})(u);if(S||E||d){if(e.beginPath(),ME(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,_-i,v-n,h),e.fill())),w&&E&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,_-i,v-n,h),e.stroke()))}if(!E&&w){if(e.beginPath(),ME(t,e,i,n,A,k,P),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if(M&&C){const{startAngle:r,endAngle:o}=t.getParsedAngle();if(Ct(o-r)>=Mt-St){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:o=h.endAngle,fill:c=h.fill}=t.attribute,d=o;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;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),oT(o.color,l.color,h,!1)}(0,0,o,s);a||vE&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};GE=NE([Xw(),WE(0,qw(eA)),WE(0,$w(PE)),VE("design:paramtypes",[Object])],GE);var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XE=function(t,e){return function(i,n){e(i,n,t)}};let $E=class{constructor(t){this.circleRenderContribitions=t,this.numberType=zT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(y,f),w=xE(y,m),A=yE(h),k=_E(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};$E=UE([Xw(),XE(0,qw(eA)),XE(0,$w(BE)),YE("design:paramtypes",[Object])],$E);const KE=["radius","startAngle","endAngle",...kT];class qE extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=zT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=FM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateCircleAABBBounds(i,FM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function JE(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function QE(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class tP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=qT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=FM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=FM(this).text,n=Gk.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=JE(c,s),e=QE(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=JE(c,s),_=QE(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=FM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;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 g=Gk.graphicUtil.textMeasure,f=new tP(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).text[t]}needUpdateTags(t){for(let e=0;e{WP[t.type]=t}));const GP=["symbolType","size",...kT];let UP=class t extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=KT}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return m(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=FM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=WP[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new pk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Pt(r,a);return s.transform(0,0,o,o),this._parsedPath=new VP(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=FM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateSymbolAABBBounds(i,FM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=VT}isValid(){return super.isValid()&&this._isValid()}_isValid(){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=kC(i,n,e))}doUpdateAABBBounds(){const t=FM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateLineAABBBounds(e,FM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const $P=["width","height","cornerRadius",...kT];class KP extends PT{constructor(t){super(t),this.type="rect",this.numberType=YT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=FM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRectAABBBounds(e,FM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).rect[t]}needUpdateTags(t){for(let e=0;e<$P.length;e++){const i=$P[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$P.length;e++)if(t===$P[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=t.width,i=t.height,n=new pk;return n.moveTo(0,0),n.rect(0,0,e,i),n}clone(){return new KP(Object.assign({},this.attribute))}}const qP=[[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 ZP extends KP{constructor(t){super(t),this.type="rect3d",this.numberType=XT}findFace(){const t={polygons:[],vertices:[],edges:[]},e=FM(this).rect3d,{width:i=e.width,height:n=e.width,length:s=Rt(e.width,e.height)}=this.attribute;for(let e=0;e{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){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=Gk.graphicService.updateGlyphAABBBounds(this.attribute,FM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new JP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const QP={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"}},tR=!0,eR=!1,iR=/\w|\(|\)/,nR=/[.?!,;:/,。?!、;:]/,sR=/\S/;function rR(t,e,i,n,s){if(!e||e<=0)return 0;const r=Gk.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=function(t,e){let i=e;for(;iR.test(t[i-1])&&iR.test(t[i])||nR.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function aR(t,e){const i=Gk.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class oR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=QP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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,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=this.lines[i].getWidthWithEllips();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((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=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(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=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class lR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=aR(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=aR(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=rR(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=aR(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||eR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||tR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=rR(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=aR(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const hR=["width","height","image",...kT];class cR extends PT{constructor(t){super(t),this.type="image",this.numberType=NT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=FM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateImageAABBBounds(e,FM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ok[t]}needUpdateTags(t){for(let e=0;e{if(m(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=bC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Ok.width,height:e=Ok.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 uR{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 dR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=QP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof lR){const e=sR.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof dR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof dR?t.width:t.getWidthWithEllips(this.direction)})),e}}class pR{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=QP[this.direction]}store(t){if(t instanceof dR){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 uR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof dR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=rR(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new lR(i,t.newLine,t.character),new lR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const gR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...kT];class fR extends PT{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=$T}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=FM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRichTextAABBBounds(e,FM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new pR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const mR=["path","customPath",...kT];class yR extends PT{constructor(t){super(t),this.type="path",this.numberType=WT}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=FM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pk?e.path:(h(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pk?this.cache:t.path)}doUpdateAABBBounds(){const t=FM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePathAABBBounds(e,FM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;f(t.path,!0)?this.cache=(new pk).fromString(t.path):t.customPath&&(this.cache=new pk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).path[t]}needUpdateTags(t){for(let e=0;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 vR(Object.assign({},this.attribute))}}const bR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kT];class xR extends PT{constructor(t){super(t),this.type="arc",this.numberType=LT}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=FM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(v(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=FM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Xt(e),i=e+r,n&&Ct(r)St&&o>St)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=FM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=It(n*n+s*s)}=this.attribute,o=Ct(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>St&&a>St){const i=e>t?1:-1;let r=Ot(Number(a)/s*Bt(u)),o=Ot(Number(a)/n*Bt(u));return(p-=2*r)>St?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>St?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateArcAABBBounds(i,FM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Mt-St)o.moveTo(0+s*Et(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>St&&(o.moveTo(0+n*Et(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Et(e),r=s*Bt(e),l=n*Et(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new xR(Object.assign({},this.attribute))}}class SR extends xR{constructor(t){super(t),this.type="arc3d",this.numberType=OT}doUpdateAABBBounds(){const t=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateArc3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const wR=["points","cornerRadius",...kT];class AR extends PT{constructor(t){super(t),this.type="polygon",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePolygonAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=kC(i,n,e))}getDefaultAttribute(t){return FM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new AR(Object.assign({},this.attribute))}}class kR extends AR{constructor(t){super(t),this.type="pyramid3d",this.numberType=UT}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePyramid3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}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}}var MR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CR=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};CR=MR([Xw()],CR);var TR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ER=Symbol.for("RectBoundsContribution");let PR=class extends CR{};PR=TR([Xw()],PR);var RR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const BR=Symbol.for("SymbolBoundsContribution");let IR=class extends CR{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;BT(i,n+r+o/2,!0,a)}return i}};IR=RR([Xw()],IR);var DR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const LR=Symbol.for("CircleBoundsContribution");let OR=class extends CR{};OR=DR([Xw()],OR);var FR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const zR=Symbol.for("ArcBoundsContribution");let HR=class extends CR{};HR=FR([Xw()],HR);var jR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const NR=Symbol.for("PathBoundsContribution");let VR=class extends CR{};VR=jR([Xw()],VR);class WR{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return WR.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$R=function(t,e){return function(i,n){e(i,n,t)}};function KR(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=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]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function qR(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 ZR(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function JR(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),KR(t,t,[s+o,r+l,a+h]),KR(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),KR(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=UR.allocate(),n=[0,0];if(y){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]}KR(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),KR(i,i,[-n[0],-n[1],0]),ZR(t,t,i)}}let QR=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new rA(["graphic"]),onSetStage:new rA(["graphic","stage"]),onRemove:new rA(["graphic"]),onAddIncremental:new rA(["graphic","group","stage"]),onClearIncremental:new rA(["graphic","group","stage"]),beforeUpdateAABBBounds:new rA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new rA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Wt,this.tempAABBBounds2=new Wt}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)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new pA(t);return FA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){BT(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),Nt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Mt-St?i.set(-a,-a,a,a):wC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=St?i.set(0,0,0,0):Math.abs(a-o)>Mt-St?i.set(-s,-s,s,s):(wC(o,a,s,i),wC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(m(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){BT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){BT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Nt(e,e,s.transMatrix)}};QR=YR([Xw(),$R(0,qw(JT)),$R(1,qw(eA)),$R(1,$w(ER)),$R(2,qw(eA)),$R(2,$w(BR)),$R(3,qw(eA)),$R(3,$w(LR)),$R(4,qw(eA)),$R(4,$w(zR)),$R(5,qw(eA)),$R(5,$w(NR)),XR("design:paramtypes",[Object,Object,Object,Object,Object,Object])],QR);class tB extends tE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const eB=["heightLimit","lineClamp"];class iB extends iP{_isValid(){const{text:t}=this.attribute;return m(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=FM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;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),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=Gk.graphicUtil.textMeasure,f=new tP(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=UR.allocate(),s=UR.allocate();JR(s,t,e),ZR(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),UR.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,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()}};function xB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),SB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=PA.ROW:"y"===n?c=PA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let AB=class extends bB{constructor(){super(...arguments),this.numberType=VT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const y=null!==(f=this.z)&&void 0!==f?f:0;xB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:y}),u.cache&&!m(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:_=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,_-c,v-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,_-c,v-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=vE(d,u),y=xE(d,p),_=yE(h),v=_E(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(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),s=uk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=uk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],Rt(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function kB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),MB(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),MB(t,l,1,n),o=!1):o=!0}t.closePath()}function MB(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]=VA(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)}}AB=wB([Xw()],AB);var CB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EB=function(t,e){return function(i,n){e(i,n,t)}};function PB(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}let RB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=FT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=FM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=vE(y,m),A=yE(f),k=_E(b,x),M=xE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=PB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=PB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=PB(i,n),a=PB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],Rt(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=FM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?PA.ROW:PA.COLUMN,Number.isFinite(c)||(o=PA.COLUMN),Number.isFinite(d)||(o=PA.ROW);const u=i*(o===PA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===BA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,y-h,_-c,o),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===BA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;m(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),xB(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,y-h,_-c,o),t.stroke()}return!1}};RB=CB([Xw(),EB(0,qw(eA)),EB(0,$w(RE)),TB("design:paramtypes",[Object])],RB);var BB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DB=function(t,e){return function(i,n){e(i,n,t)}};let LB=class extends bB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=FM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=vE(f,p),w=xE(f,g),A=yE(d),k=_E(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)FA(t.pathShape.commandList,e,i,n,1,1,x);else{FA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};LB=BB([Xw(),DB(0,qw(eA)),DB(0,$w(LE)),IB("design:paramtypes",[Object])],LB);const OB=wt/2;function FB(t,e,i,n,s,r){let a;if(v(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!G(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-OB,0,!1)}if(t.lineTo(_[0],_[1]),!G(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,OB,!1)}if(t.lineTo(b[0],b[1]),!G(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],OB,wt,!1)}if(t.lineTo(g[0],g[1]),!G(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],wt,wt+OB,!1)}return t.closePath(),t}var zB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jB=function(t,e){return function(i,n){e(i,n,t)}};let NB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:y=l.fillOpacity,lineWidth:_=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=bE(f,y,u,p),A=SE(f,v,u,p),k=yE(h),M=_E(d,_);if(!t.valid||!b)return;if(!(k||M||c))return;if(!(w||A||a||o||c))return;0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),FB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};NB=zB([Xw(),jB(0,qw(eA)),jB(0,$w(FE)),HB("design:paramtypes",[Object])],NB);var VB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class extends bB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=vE(f,p),A=xE(f,g),k=yE(d),M=_E(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};UB=VB([Xw(),GB(0,qw(eA)),GB(0,$w(zE)),WB("design:paramtypes",[Object])],UB);var YB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$B=function(t,e){return function(i,n){e(i,n,t)}};let KB=class extends bB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=qT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=vE(f,p),C=xE(f,g),T=yE(d),E=_E(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const P=!b,R=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===BA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,R,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,R);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,R,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,R);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,R))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,R),this.drawUnderLine(_,v,t,i,n+r,R,h,e)))}P&&this.restoreTransformUseContext2d(t,h,R,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=JE(l,g),m=QE(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=JE(h,a),f=QE("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};KB=YB([Xw(),$B(0,qw(eA)),$B(0,$w(HE)),XB("design:paramtypes",[Object])],KB);var qB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZB=class{};function JB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nI=function(t,e){return function(i,n){e(i,n,t)}};let sI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:y=l.lineWidth,opacity:_=l.opacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(_,p),w=xE(_,f),A=yE(c),k=_E(d,y);t.valid&&v&&(A||k||g)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||m(u)&&u.every((t=>0===t))?JB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)JB(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=tI(l,y,_,c,d),S=tI(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=QB(w,A),M=tI(l,QB(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};sI=eI([Xw(),nI(0,qw(eA)),nI(0,$w(OE)),iI("design:paramtypes",[Object])],sI);var rI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oI=function(t,e){return function(i,n){e(i,n,t)}};const lI=["","repeat-x","repeat-y","repeat"];let hI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=NT}drawShape(t,e,i,n,s,r,a){const o=FM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=vE(d,u),_=yE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,lI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=FM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};hI=rI([Xw(),oI(0,qw(eA)),oI(0,$w(DE)),aI("design:paramtypes",[Object])],hI);const cI=Symbol.for("IncrementalDrawContribution"),dI=Symbol.for("ArcRender"),uI=Symbol.for("Arc3dRender"),pI=Symbol.for("AreaRender"),gI=Symbol.for("CircleRender"),fI=Symbol.for("GraphicRender"),mI=Symbol.for("GroupRender"),yI=Symbol.for("LineRender"),_I=Symbol.for("PathRender"),vI=Symbol.for("PolygonRender"),bI=Symbol.for("RectRender"),xI=Symbol.for("Rect3DRender"),SI=Symbol.for("SymbolRender"),wI=Symbol.for("TextRender"),AI=Symbol.for("RichTextRender"),kI=Symbol.for("Pyramid3dRender"),MI=Symbol.for("GlyphRender"),CI=Symbol.for("ImageRender"),TI=Symbol.for("RenderSelector"),EI=Symbol.for("DrawContribution");function PI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function RI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(m(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const BI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(t)},t));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};return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(e)},e))}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(){this.pools=[]}};var II=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LI=function(t,e){return function(i,n){e(i,n,t)}};let OI=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};OI=II([Xw()],OI);let FI=class{constructor(t){this.subRenderContribitions=t,this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};FI=II([Xw(),LI(0,qw(eA)),LI(0,$w(jE)),DI("design:paramtypes",[Object])],FI);let zI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=BI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return BI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Mt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};zI=II([Xw()],zI);var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),ME(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),ME(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};jI=HI([Xw()],jI);let NI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};NI=HI([Xw()],NI);let VI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};VI=HI([Xw()],VI);var WI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let GI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};GI=WI([Xw()],GI);let UI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};UI=WI([Xw()],UI);let YI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};YI=WI([Xw()],YI);var XI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $I=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};$I=XI([Xw()],$I);var KI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};qI=KI([Xw()],qI);var ZI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),FB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),FB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};JI=ZI([Xw()],JI);let QI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};QI=ZI([Xw()],QI);let tD=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};tD=ZI([Xw()],tD);let eD=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};eD=ZI([Xw()],eD);let iD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};iD=ZI([Xw()],iD);var nD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};sD=nD([Xw()],sD);class rD extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}}class aD extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}}var oD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hD=function(t,e){return function(i,n){e(i,n,t)}};const cD=Symbol.for("RenderService");let dD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}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)}};dD=oD([Xw(),hD(0,qw(EI)),lD("design:paramtypes",[Object])],dD);var uD=new Vw((t=>{t(dD).toSelf(),t(cD).toService(dD)})),pD=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 gD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return pD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function mD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var yD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const _D=Symbol.for("PickItemInterceptor");let vD=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===OT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};vD=yD([Xw()],vD);var bD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SD=function(t,e){return function(i,n){e(i,n,t)}};const wD=Symbol.for("PickerService");let AD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new qt(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=UR.allocate();if(qR(i,e),a){if(i){const t=UR.allocate();r.modelMatrix=ZR(t,a,i),UR.free(i)}}else qR(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Ht(e.x,e.y),a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Ht(e.x,e.y);l.transformPoint(r,r);const a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&UR.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),GR.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};AD=bD([Xw(),SD(0,qw(oA)),SD(1,qw(eA)),SD(1,$w(_D)),xD("design:paramtypes",[Object,Object])],AD);var kD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CD=function(t,e){return function(i,n){e(i,n,t)}};const TD=Symbol.for("GlobalPickerService");let ED=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new qt(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 Ht(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function PD(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function RD(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}ED=kD([Xw(),CD(0,qw(oA)),MD("design:paramtypes",[Object])],ED);class BD{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=UR.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=UR.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const LD=[0,0,0],OD=new qt(1,0,0,1,0,0);let FD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},yk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},vk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new qt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.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&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Mt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),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&&EE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gk.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Gk.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:bk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:bk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[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={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=RI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}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={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=ZE(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=ZE(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(OD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};FD.env="browser",FD=ID([Xw(),DD("design:paramtypes",[Object,Number])],FD);var zD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const jD={WIDTH:500,HEIGHT:500,DPR:1};let ND=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=jD.WIDTH,height:n=jD.HEIGHT,dpr:s=jD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=Gk.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new FD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}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.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};ND.env="browser",ND=zD([Xw(),HD("design:paramtypes",[Object])],ND);const VD=Symbol.for("CanvasArcPicker"),WD=Symbol.for("CanvasArc3dPicker"),GD=Symbol.for("CanvasAreaPicker"),UD=Symbol.for("CanvasCirclePicker"),YD=Symbol.for("CanvasImagePicker"),XD=Symbol.for("CanvasLinePicker"),$D=Symbol.for("CanvasPathPicker"),KD=Symbol.for("CanvasRectPicker"),qD=Symbol.for("CanvasRect3dPicker"),ZD=Symbol.for("CanvasSymbolPicker"),JD=Symbol.for("CanvasTextPicker"),QD=Symbol.for("CanvasPolygonPicker"),tL=Symbol.for("CanvasPyramid3dPicker"),eL=Symbol.for("CanvasRichTextPicker"),iL=Symbol.for("CanvasGlyphPicker"),nL=Symbol.for("CanvasPickerContribution"),sL=Symbol.for("MathArcPicker"),rL=Symbol.for("MathAreaPicker"),aL=Symbol.for("MathCirclePicker"),oL=Symbol.for("MathLinePicker"),lL=Symbol.for("MathPathPicker"),hL=Symbol.for("MathRectPicker"),cL=Symbol.for("MathSymbolPicker"),dL=Symbol.for("MathTextPicker"),uL=Symbol.for("MathPolygonPicker"),pL=Symbol.for("MathGlyphPicker"),gL=Symbol.for("MathPickerContribution");var fL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yL=function(t,e){return function(i,n){e(i,n,t)}};let _L=class extends AD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new ND(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xL=new qt(1,0,0,1,0,0),SL={x:0,y:0};let wL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0),this.path=new pk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},SL),function(t,e,i){return SM(t,0,!1,e,i)}(this.path.commandList,SL.x,SL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},SL);const i=PI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return SM(t,e,!0,i,n)}(this.path.commandList,i,SL.x,SL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(xL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};wL=vL([Xw(),bL("design:paramtypes",[Object,Number])],wL);var AL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ML=function(t,e){return function(i,n){e(i,n,t)}};let CL=class extends AD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new wL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};AL([tA(),kL("design:type",Function),kL("design:paramtypes",[]),kL("design:returntype",void 0)],CL.prototype,"init",null),CL=AL([Xw(),ML(0,qw(eA)),ML(0,$w(gL)),ML(1,qw(oA)),ML(2,qw(eA)),ML(2,$w(_D)),kL("design:paramtypes",[Object,Object,Object])],CL);var TL=new Vw((t=>{t(_L).toSelf().inSingletonScope(),t(CL).toSelf().inSingletonScope(),t(wD).toService(_L),t(ED).toSelf().inSingletonScope(),t(TD).toService(ED),t(vD).toSelf().inSingletonScope(),t(_D).toService(vD),nA(t,_D)})),EL=new Vw((t=>{t(QR).toSelf().inSingletonScope(),t(ZT).toService(QR),t(PR).toSelf().inSingletonScope(),t(ER).toService(PR),nA(t,ER),t(IR).toSelf().inSingletonScope(),t(BR).toService(IR),nA(t,BR),t(OR).toSelf().inSingletonScope(),t(LR).toService(OR),nA(t,LR),t(HR).toSelf().inSingletonScope(),t(zR).toService(HR),nA(t,zR),t(VR).toSelf().inSingletonScope(),t(NR).toService(VR),nA(t,NR),t(JT).toConstantValue(mB)}));const PL=Symbol.for("AutoEnablePlugins"),RL=Symbol.for("PluginService");var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DL=function(t,e){return function(i,n){e(i,n,t)}};let LL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Wk.isBound(PL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};LL=BL([Xw(),DL(0,qw(eA)),DL(0,$w(PL)),IL("design:paramtypes",[Object])],LL);var OL=new Vw((t=>{t(LL).toSelf(),t(RL).toService(LL),nA(t,PL)})),FL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};zL=FL([Xw()],zL);var HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function NL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let VL=class extends zL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(b(o)?o:1),y:(s-r.top)/(b(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return NL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return NL(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:zM.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(){}};function WL(){Wk.rebind(wD).toService(CL)}VL=HL([Xw(),jL("design:paramtypes",[])],VL);var GL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YL=class extends zL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};YL=GL([Xw(),UL("design:paramtypes",[])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KL=class extends zL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Wk.rebind(wD).toService(CL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=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){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}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(){}};KL=XL([Xw(),$L("design:paramtypes",[])],KL);var qL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JL=!1;try{JL=!!lynx.createCanvasNG}catch(t){}let QL=class extends zL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=JL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,JL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(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(){}};QL=qL([Xw(),ZL("design:paramtypes",[])],QL);var tO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eO=class extends zL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};eO=tO([Xw()],eO);var iO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let rO=class extends zL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return sO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{WL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};rO=iO([Xw(),nO("design:paramtypes",[])],rO);var aO=new Vw((t=>{t(VL).toSelf().inSingletonScope(),t(aA).toService(VL),t(YL).toSelf().inSingletonScope(),t(aA).toService(YL),t(KL).toSelf().inSingletonScope(),t(aA).toService(KL),t(QL).toSelf().inSingletonScope(),t(aA).toService(QL),t(rO).toSelf().inSingletonScope(),t(aA).toService(rO),t(eO).toSelf().inSingletonScope(),t(aA).toService(eO),nA(t,aA)})),oO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hO=class{constructor(){this._uid=zM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};hO=oO([Xw(),lO("design:paramtypes",[])],hO);var cO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uO=function(t,e){return function(i,n){e(i,n,t)}};let pO=class extends hO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}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 this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ND(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new ND({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};pO.env="browser",pO=cO([Xw(),uO(0,qw(oA)),dO("design:paramtypes",[Object])],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}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;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};fO.env="feishu",fO=gO([Xw()],fO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _O={WIDTH:500,HEIGHT:500,DPR:1};let vO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=_O.WIDTH,height:n=_O.HEIGHT,dpr:s=_O.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new fO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};vO.env="feishu",vO=mO([Xw(),yO("design:paramtypes",[Object])],vO);var bO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SO=function(t,e){return function(i,n){e(i,n,t)}};let wO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 vO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};wO.env="feishu",wO=bO([Xw(),SO(0,qw(oA)),xO("design:paramtypes",[Object])],wO);var AO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kO=class extends FD{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(RI(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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(PI(this,l,this.dpr)),r.setStrokeStyle(RI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=ZE(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=ZE(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}};kO.env="taro",kO=AO([Xw()],kO);var MO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const TO={WIDTH:500,HEIGHT:500,DPR:1};let EO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=TO.WIDTH,height:n=TO.HEIGHT,dpr:s=TO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new kO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};EO.env="taro",EO=MO([Xw(),CO("design:paramtypes",[Object])],EO);var PO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BO=function(t,e){return function(i,n){e(i,n,t)}};let IO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 EO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};IO.env="taro",IO=PO([Xw(),BO(0,qw(oA)),RO("design:paramtypes",[Object])],IO);var DO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let LO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};LO.env="lynx",LO=DO([Xw()],LO);var OO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zO={WIDTH:500,HEIGHT:500,DPR:1};let HO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=zO.WIDTH,height:n=zO.HEIGHT,dpr:s=zO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new LO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};HO.env="lynx",HO=OO([Xw(),FO("design:paramtypes",[Object])],HO);var jO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VO=function(t,e){return function(i,n){e(i,n,t)}};let WO=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",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:zM.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)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 HO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};WO.env="lynx",WO=jO([Xw(),VO(0,qw(oA)),NO("design:paramtypes",[Object])],WO);var GO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YO=class extends FD{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 qt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};YO.env="node",YO=GO([Xw(),UO("design:paramtypes",[Object,Number])],YO);var XO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$O=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const KO={WIDTH:500,HEIGHT:500,DPR:1};let qO=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=KO.WIDTH,height:n=KO.HEIGHT,canvasControled:s=!0,dpr:r=KO.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new YO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&l(this._nativeCanvas.release)&&this._nativeCanvas.release()}};qO.env="node",qO=XO([Xw(),$O("design:paramtypes",[Object])],qO);var ZO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QO=function(t,e){return function(i,n){e(i,n,t)}};let tF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new qO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new qO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};tF.env="node",tF=ZO([Xw(),QO(0,qw(oA)),JO("design:paramtypes",[Object])],tF);var eF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iF=class extends FD{draw(){}createPattern(t,e){return null}};iF.env="wx",iF=eF([Xw()],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rF={WIDTH:500,HEIGHT:500,DPR:1};let aF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=rF.WIDTH,height:n=rF.HEIGHT,dpr:s=rF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new iF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};aF.env="wx",aF=nF([Xw(),sF("design:paramtypes",[Object])],aF);var oF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hF=function(t,e){return function(i,n){e(i,n,t)}};class cF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let dF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new cF}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:zM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new aF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new aF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};dF.env="wx",dF=oF([Xw(),hF(0,qw(oA)),lF("design:paramtypes",[Object])],dF);var uF=new Vw((t=>{t(pO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(pO))).whenTargetNamed(pO.env),t(wO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(wO))).whenTargetNamed(wO.env),t(IO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(IO))).whenTargetNamed(IO.env),t(WO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(WO))).whenTargetNamed(WO.env),t(dF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(dF))).whenTargetNamed(dF.env),t(tF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(tF))).whenTargetNamed(tF.env)})),pF=new Vw((t=>{t(Vk).toSelf().inSingletonScope(),t(Nk).toService(Vk),nA(t,Nk)})),gF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mF=function(t,e){return function(i,n){e(i,n,t)}};let yF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Xk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,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()}};yF=gF([Xw(),mF(0,qw(oA)),fF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bF=function(t,e){return function(i,n){e(i,n,t)}};let xF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=Xk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};xF=_F([Xw(),bF(0,qw(oA)),vF("design:paramtypes",[Object])],xF);var SF=new Vw((t=>{t(yF).toSelf(),t(xF).toSelf(),t(eE).toService(yF)}));var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const AF=Symbol.for("DrawItemInterceptor"),kF=new Wt;let MF=class{constructor(){this.order=1}afterDrawItem(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){kF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(kF),!0}};MF=wF([Xw()],MF);let CF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=UR.allocate();qR(l,o);const h=r.modelMatrix;if(h){if(l){const t=UR.allocate();r.modelMatrix=ZR(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===OT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&UR.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};CF=wF([Xw()],CF);var TF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},EF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PF=function(t,e){return function(i,n){e(i,n,t)}};let RF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=be(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=mD(e,i,Sk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Se(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):gD(t,Sk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_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||Wk.get(cI);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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IF=class{selector(t){return null}};IF=BF([Xw()],IF);var DF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let FF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:y=l.fillOpacity,strokeOpacity:_=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=bE(u,y,p,g),A=SE(u,_,p,g),k=yE(h),M=_E(d,x);if(!t.valid||!S)return;if(!f){if(!(k||M||c))return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===v||m(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),FB(e,i,n,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=FM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=UR.allocate(),i=UR.allocate();JR(i,t,a),ZR(e,o||e,i),s.modelMatrix=e,UR.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&UR.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};FF=DF([Xw(),OF(0,qw(eA)),OF(0,$w(IE)),LF("design:paramtypes",[Object])],FF);var zF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HF=class extends AB{constructor(){super(...arguments),this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=FM(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,y=vE(u,p),_=xE(u,g),v=yE(c),b=_E(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};HF=zF([Xw()],HF);var jF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NF=class extends RB{constructor(){super(...arguments),this.numberType=FT}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=FM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=vE(u,d),f=yE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};NF=jF([Xw()],NF);var VF,WF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UF=function(t,e){return function(i,n){e(i,n,t)}},YF=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"}(VF||(VF={}));let XF=class extends RF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=VF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new rA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return YF(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,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.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 YF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return YF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>YF(this,void 0,void 0,(function*(){if(2!==t.count)yield fD(t,Sk.zIndex,((i,n)=>{if(this.status===VF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return YF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return YF(this,void 0,void 0,(function*(){this.rendering&&(this.status=VF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=VF.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 YF(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:()=>YF(this,void 0,void 0,(function*(){yield fD(t,Sk.zIndex,(t=>YF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};WF([qw(oA),GF("design:type",Object)],XF.prototype,"global",void 0),XF=WF([Xw(),UF(0,Zw(fI)),UF(1,qw(TI)),UF(2,qw(HF)),UF(3,qw(NF)),UF(4,qw(fE)),UF(5,qw(eA)),UF(5,$w(AF)),GF("design:paramtypes",[Array,Object,Object,Object,Object,Object])],XF);var $F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KF=class extends bB{constructor(){super(...arguments),this.type="rect3d",this.numberType=XT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=bE(g,f,u,p),x=SE(g,y,u,p),S=yE(c),w=_E(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}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){const l=nT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};KF=$F([Xw()],KF);var qF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZF=class{constructor(){this.numberType=$T}drawShape(t,e,i,n,s){const r=FM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&vE(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=FM(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:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),FB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).richtext;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);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};ZF=qF([Xw()],ZF);var JF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let QF=class{constructor(){this.numberType=HT}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=FM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};QF=JF([Xw()],QF);var tz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ez=class extends bB{constructor(){super(...arguments),this.numberType=OT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=vE(p,g),v=xE(p,m),b=yE(c),x=_E(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=nT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(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 d=!1;if(r=Mt-St)e.moveTo(i+r*Et(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>St&&(e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*Et(p),_=r*Bt(p),v=a*Et(f),b=a*Bt(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>St)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Mt,!0,E.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),d=h>l;let u=!1;if(a<=St)e.moveTo(i,n,s);else if(c>=Mt-St)e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Et(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Et(c),f=a*Bt(c),m=a*Et(p),y=a*Bt(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};ez=tz([Xw()],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let nz=class extends bB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=UT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=vE(u,p),x=xE(u,f),S=yE(c),w=_E(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=nT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={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+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};nz=iz([Xw()],nz);var sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};rz=sz([Xw()],rz);let az=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};az=sz([Xw()],az);var oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};lz=oz([Xw()],lz);let hz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};hz=oz([Xw()],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};dz=cz([Xw()],dz);let uz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:CC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:CC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:CC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:CC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};uz=cz([Xw()],uz);var pz=new Vw((t=>{t(RF).toSelf(),t(EI).toService(RF),t(XF).toSelf(),t(cI).toService(XF),t(IF).toSelf(),t(TI).toService(IF),t($E).toSelf().inSingletonScope(),t(gI).to($E),t(fI).to($E),t(GI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(YI).toSelf().inSingletonScope(),t(BE).toService(GI),t(BE).toService(UI),t(BE).toService(YI),nA(t,BE),t(NB).toSelf().inSingletonScope(),t(bI).to(NB),t(fI).to(NB),t(KF).toSelf().inSingletonScope(),t(xI).toService(KF),t(fI).toService(xI),t(JI).toSelf().inSingletonScope(),t(QI).toSelf().inSingletonScope(),t(tD).toSelf().inSingletonScope(),t(eD).toSelf().inSingletonScope(),t(iD).toSelf().inSingletonScope(),t(FE).toService(JI),t(FE).toService(QI),t(FE).toService(tD),t(FE).toService(eD),t(FE).toService(iD),nA(t,FE),t(KB).toSelf().inSingletonScope(),t(wI).to(KB),t(fI).to(KB),nA(t,HE),t(LB).toSelf().inSingletonScope(),t(_I).to(LB),t(fI).to(LB),t(lz).toSelf().inSingletonScope(),t(hz).toSelf().inSingletonScope(),t(LE).toService(lz),t(LE).toService(hz),nA(t,LE),t(UB).toSelf().inSingletonScope(),t(SI).to(UB),t(fI).to(UB),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(aD).toSelf().inSingletonScope(),t(zE).toService(sD),t(zE).toService(rD),t(zE).toService(aD),nA(t,zE),t(GE).toSelf().inSingletonScope(),t(dI).to(GE),t(fI).to(GE),t(ez).toSelf().inSingletonScope(),t(uI).toService(ez),t(fI).toService(uI),t(jI).toSelf().inSingletonScope(),t(NI).toSelf().inSingletonScope(),t(VI).toSelf().inSingletonScope(),t(PE).toService(jI),t(PE).toService(NI),t(PE).toService(VI),nA(t,PE),t(AB).toSelf().inSingletonScope(),t(yI).to(AB),t(fI).to(AB),t(HF).toSelf().inSingletonScope(),t(NF).toSelf().inSingletonScope(),t(RB).toSelf().inSingletonScope(),t(pI).to(RB),t(fI).to(RB),t(dz).toSelf().inSingletonScope(),t(uz).toSelf().inSingletonScope(),t(RE).toService(dz),t(RE).toService(uz),nA(t,RE),t(FF).toSelf().inSingletonScope(),t(mI).to(FF),t(fI).to(FF),t($I).toSelf().inSingletonScope(),t(IE).toService($I),nA(t,IE),t(sI).toSelf().inSingletonScope(),t(vI).to(sI),t(fI).to(sI),t(rz).toSelf().inSingletonScope(),t(az).toSelf().inSingletonScope(),t(OE).toService(rz),t(OE).toService(az),nA(t,OE),t(QF).toSelf().inSingletonScope(),t(MI).toService(QF),t(fI).toService(MI),t(hI).toSelf().inSingletonScope(),t(CI).toService(hI),t(fI).toService(CI),t(qI).toSelf().inSingletonScope(),t(DE).toService(qI),nA(t,DE),t(ZF).toSelf().inSingletonScope(),t(AI).toService(ZF),t(fI).toService(AI),t(nz).toSelf().inSingletonScope(),t(kI).toService(nz),t(fI).toService(kI),t(FI).toSelf().inSingletonScope(),t(HE).toService(FI),t(PE).toService(FI),t(LE).toService(FI),t(zE).toService(FI),t(FE).toService(FI),t(DE).toService(FI),t(BE).toService(FI),t(RE).toService(FI),t(OE).toService(FI),nA(t,jE),nA(t,fI),t(MF).toSelf().inSingletonScope(),t(AF).toService(MF),t(CF).toSelf().inSingletonScope(),t(AF).toService(CF),nA(t,AF)}));var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mz=function(t,e){return function(i,n){e(i,n,t)}};let yz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};yz=gz([Xw(),mz(0,qw(gI)),fz("design:paramtypes",[Object])],yz);var _z=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bz=function(t,e){return function(i,n){e(i,n,t)}};const xz=new Wt;let Sz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=PI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;xz.setValue(i.x1,i.y1,i.x2,i.y2),xz.expand(-r/2),h=!xz.containsPoint(e)}}return n.highPerformanceRestore(),h}};Sz=_z([Xw(),bz(0,qw(bI)),vz("design:paramtypes",[Object])],Sz);var wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Az=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kz=function(t,e){return function(i,n){e(i,n,t)}};let Mz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Mz=wz([Xw(),kz(0,qw(dI)),Az("design:paramtypes",[Object])],Mz);var Cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ez=function(t,e){return function(i,n){e(i,n,t)}};let Pz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Pz=Cz([Xw(),Ez(0,qw(pI)),Tz("design:paramtypes",[Object])],Pz);var Rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Bz=class{constructor(){this.type="image",this.numberType=NT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Bz=Rz([Xw()],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dz=class extends bB{};Dz=Iz([Xw()],Dz);var Lz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fz=function(t,e){return function(i,n){e(i,n,t)}};let zz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};zz=Lz([Xw(),Fz(0,qw(yI)),Oz("design:paramtypes",[Object])],zz);var Hz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nz=function(t,e){return function(i,n){e(i,n,t)}};let Vz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Vz=Hz([Xw(),Nz(0,qw(_I)),jz("design:paramtypes",[Object])],Vz);var Wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Yz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=KT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=FM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Yz=Wz([Xw(),Uz(0,qw(SI)),Gz("design:paramtypes",[Object])],Yz);var Xz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kz=function(t,e){return function(i,n){e(i,n,t)}};let qz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=qT}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=FM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=QE(a,u,s),y=JE(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&UR.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};qz=Xz([Xw(),Kz(0,qw(wI)),$z("design:paramtypes",[Object])],qz);var Zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qz=function(t,e){return function(i,n){e(i,n,t)}};let tH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};tH=Zz([Xw(),Qz(0,qw(vI)),Jz("design:paramtypes",[Object])],tH);var eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let sH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=$T}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};sH=eH([Xw(),nH(0,qw(AI)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};lH=rH([Xw(),oH(0,qw(MI)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let uH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=XT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};uH=hH([Xw(),dH(0,qw(xI)),cH("design:paramtypes",[Object])],uH);var pH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let mH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mH=pH([Xw(),fH(0,qw(kI)),gH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let bH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=OT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};bH=yH([Xw(),vH(0,qw(uI)),_H("design:paramtypes",[Object])],bH);var xH=new Vw(((t,e,i,n)=>{t(yz).toSelf().inSingletonScope(),t(UD).toService(yz),t(nL).toService(UD),t(Sz).toSelf().inSingletonScope(),t(KD).toService(Sz),t(nL).toService(KD),t(uH).toSelf().inSingletonScope(),t(qD).toService(uH),t(nL).toService(qD),t(Mz).toSelf().inSingletonScope(),t(VD).toService(Mz),t(nL).toService(VD),t(Pz).toSelf().inSingletonScope(),t(GD).toService(Pz),t(nL).toService(GD),t(Bz).toSelf().inSingletonScope(),t(YD).toService(Bz),t(nL).toService(YD),t(zz).toSelf().inSingletonScope(),t(XD).toService(zz),t(nL).toService(XD),t(Vz).toSelf().inSingletonScope(),t($D).toService(Vz),t(nL).toService($D),t(Yz).toSelf().inSingletonScope(),t(ZD).toService(Yz),t(nL).toService(ZD),t(qz).toSelf().inSingletonScope(),t(JD).toService(qz),t(nL).toService(JD),t(tH).toSelf().inSingletonScope(),t(QD).toService(tH),t(nL).toService(QD),t(mH).toSelf().inSingletonScope(),t(tL).toService(mH),t(nL).toService(tL),t(bH).toSelf().inSingletonScope(),t(WD).toService(bH),t(nL).toService(WD),t(sH).toSelf().inSingletonScope(),t(eL).toService(sH),t(nL).toService(eL),t(lH).toSelf().inSingletonScope(),t(iL).toService(lH),t(nL).toService(iL),nA(t,nL)})),SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([Xw(),AH(0,qw(_I)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([Xw(),TH(0,qw(gI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BH=function(t,e){return function(i,n){e(i,n,t)}};const IH=new Wt;let DH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;IH.setValue(i.x1,i.y1,i.x2,i.y2),IH.expand(-r/2),h=!IH.containsPoint(e)}}return n.highPerformanceRestore(),h}};DH=PH([Xw(),BH(0,qw(bI)),RH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FH=function(t,e){return function(i,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};zH=LH([Xw(),FH(0,qw(dI)),OH("design:paramtypes",[Object])],zH);var HH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NH=function(t,e){return function(i,n){e(i,n,t)}};let VH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};VH=HH([Xw(),NH(0,qw(pI)),jH("design:paramtypes",[Object])],VH);var WH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let YH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};YH=WH([Xw(),UH(0,qw(yI)),GH("design:paramtypes",[Object])],YH);var XH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KH=function(t,e){return function(i,n){e(i,n,t)}};let qH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=KT}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=FM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qH=XH([Xw(),KH(0,qw(SI)),$H("design:paramtypes",[Object])],qH);var ZH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JH=class{constructor(){this.type="text",this.numberType=qT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};JH=ZH([Xw()],JH);var QH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ej=function(t,e){return function(i,n){e(i,n,t)}};let ij=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ij=QH([Xw(),ej(0,qw(vI)),tj("design:paramtypes",[Object])],ij);var nj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rj=function(t,e){return function(i,n){e(i,n,t)}};let aj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};aj=nj([Xw(),rj(0,qw(MI)),sj("design:paramtypes",[Object])],aj);var oj=new Vw((t=>{t(EH).toSelf().inSingletonScope(),t(aL).toService(EH),t(gL).toService(aL),t(DH).toSelf().inSingletonScope(),t(hL).toService(DH),t(gL).toService(hL),t(zH).toSelf().inSingletonScope(),t(sL).toService(zH),t(gL).toService(sL),t(VH).toSelf().inSingletonScope(),t(rL).toService(VH),t(gL).toService(rL),t(YH).toSelf().inSingletonScope(),t(oL).toService(YH),t(gL).toService(oL),t(kH).toSelf().inSingletonScope(),t(lL).toService(kH),t(gL).toService(lL),t(qH).toSelf().inSingletonScope(),t(cL).toService(qH),t(gL).toService(cL),t(JH).toSelf().inSingletonScope(),t(dL).toService(JH),t(gL).toService(dL),t(ij).toSelf().inSingletonScope(),t(uL).toService(ij),t(gL).toService(uL),t(aj).toSelf().inSingletonScope(),t(pL).toService(aj),t(aj).toService(pL),nA(t,gL)}));var lj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new ND(t))).whenTargetNamed(ND.env),t(Yk).toDynamicValue((()=>(t,e)=>new FD(t,e))).whenTargetNamed(FD.env)})),hj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new EO(t))).whenTargetNamed(EO.env),t(Yk).toDynamicValue((()=>(t,e)=>new kO(t,e))).whenTargetNamed(kO.env)})),cj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new vO(t))).whenTargetNamed(vO.env),t(Yk).toDynamicValue((()=>(t,e)=>new fO(t,e))).whenTargetNamed(fO.env)})),dj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new HO(t))).whenTargetNamed(HO.env),t(Yk).toDynamicValue((()=>(t,e)=>new LO(t,e))).whenTargetNamed(LO.env)})),uj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new aF(t))).whenTargetNamed(aF.env),t(Yk).toDynamicValue((()=>(t,e)=>new iF(t,e))).whenTargetNamed(iF.env)})),pj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new qO(t))).whenTargetNamed(qO.env),t(Yk).toDynamicValue((()=>(t,e)=>new YO(t,e))).whenTargetNamed(YO.env)}));Wk.load(mE),Wk.load(EL),Wk.load(uD),Wk.load(TL),Wk.load(OL),function(t){t.load(aO),t.load(uF),t.load(pF),t.load(SF)}(Wk),function(t){t.load(pz)}(Wk),function(t){t.load(xH),t.load(oj)}(Wk),function(t){t.load(lj),t.load(cj),t.load(hj),t.load(dj),t.load(uj),t.load(pj)}(Wk);const gj=Wk.get(oA);Gk.global=gj;const fj=Wk.get(gE);Gk.graphicUtil=fj;const mj=Wk.get(pE);Gk.transformUtil=mj;const yj=Wk.get(ZT);Gk.graphicService=yj,Wk.get(TD);const _j=Wk.get(fE);Gk.layerService=_j;class vj{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Gk.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Gk.graphicService.hooks.onAttributeUpdate.taps=Gk.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onSetStage.taps=Gk.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class bj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class xj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.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))})),Gk.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){Gk.graphicService.hooks.onAddIncremental.taps=Gk.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onClearIncremental.taps=Gk.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gk.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({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Sj=new Wt;class wj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Gk.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&&(Sj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Sj,t.parent&&t.parent.globalTransMatrix)))})),Gk.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))})),Gk.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Gk.graphicService.hooks.beforeUpdateAABBBounds.taps=Gk.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.afterUpdateAABBBounds.taps=Gk.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onRemove.taps=Gk.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Aj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===rC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=rC.INITIAL,Gk.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Gk.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:sC},{mode:"timeout",cons:nC},{mode:"manual",cons:iC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==rC.INITIAL&&(this.status=rC.PAUSE,!0)}resume(){return this.status!==rC.INITIAL&&(this.status=rC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===rC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===rC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=rC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=rC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Aj.addTimeline(oC),Aj.setFPS(60);class kj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=nT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=It(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=Rt(Pt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=f(e)?nT.get(e).value:e;const r=this.colorRgb;return nT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const Mj="white";class Cj extends tE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:Mj}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new LM,this.hooks={beforeRender:new rA(["stage"]),afterRender:new rA(["stage"])},this.global=Wk.get(oA),this.window=Wk.get(cE),this.renderService=Wk.get(cD),this.pickerService=Wk.get(wD),this.pluginService=Wk.get(RL),this.layerService=Wk.get(fE),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Wt,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Mj,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new ZM({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Aj,this.supportInteractiveLayer=!1!==t.interactiveLayer}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new kj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new BD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new bj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new vj))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new xj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new wj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive")}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Ht(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Wk.get(cE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Tj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Tj||(Tj={}));const Ej="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Pj=Ej,Rj=14,Bj=18,Ij=4,Dj={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Rj}}},Lj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Oj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Rj,offset:12,position:"outside"}}},Fj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},zj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},Hj="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",jj={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:Hj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Hj,fill:"#ddd"}}},Nj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Vj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Wj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},Gj={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj}}},Uj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Yj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Xj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Rj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Rj}}},$j={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Rj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Rj,textBaseline:"middle",textAlign:"center"}}},Kj="__VCHART",qj=500,Zj=500,Jj=`${Kj}_LABEL_LIMIT`,Qj=`${Kj}_LABEL_ALIGN`,tN=`${Kj}_LABEL_TEXT`,eN=`${Kj}_LABEL_VISIBLE`,iN=`${Kj}_LABEL_X`,nN=`${Kj}_LABEL_Y`,sN=`${Kj}_ARC_RATIO`,rN=`${Kj}_ARC_START_ANGLE`,aN=`${Kj}_ARC_END_ANGLE`,oN=`${Kj}_ARC_K`,lN=`${Kj}_ARC_LABEL_HOVER_AX`,hN=`${Kj}_ARC_LABEL_HOVER_AY`,cN=`${Kj}_ARC_LABEL_POINT_AX`,dN=`${Kj}_ARC_LABEL_POINT_AY`,uN=`${Kj}_ARC_LABEL_POINT_BX`,pN=`${Kj}_ARC_LABEL_POINT_BY`,gN=`${Kj}_ARC_LABEL_POINT_CX`,fN=`${Kj}_ARC_LABEL_POINT_CY`,mN=`${Kj}_ARC_LABEL_SELECTED_AX`,yN=`${Kj}_ARC_LABEL_SELECTED_AY`,_N=`${Kj}_ARC_MIDDLE_ANGLE`,vN=`${Kj}_ARC_QUADRANT`,bN=`${Kj}_ARC_RADIAN`,xN=-Math.PI/2,SN=3*Math.PI/2,wN=-90,AN=270,kN=.6,MN={},CN=[],TN=(t,e,i)=>{MN[t]=Object.assign(e,{type:t}),i||CN.push(t)},EN=()=>{CN.slice().forEach((t=>{(t=>{delete MN[t];const e=CN.indexOf(t);e>=0&&CN.splice(e,1)})(t)}))};function PN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:f(t)?t:h(s=t)?null:s.fname})):null}function RN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function BN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const IN=":vGrammar_identifier:";function DN(t,e){return N(t).reduce(((t,i)=>{const n=f(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function LN(t,e){if(h(t))return[];if(!l(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(f(i))return N(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!l(t)&&!!(null==t?void 0:t.callback)}(t))return DN(t.dependency,e);var i;return[]}function ON(t){return l(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function FN(t,e,i,n){if(h(t))return t;if(l(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return f(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function zN(t,e){return HN(t)?t.output():e[t]}const HN=t=>t&&!h(t.grammarType),jN=t=>l(t)?t:e=>e[t],NN=t=>f(t)&&se.parseColorString(t)?t:null;function VN(t){return!!(null==t?void 0:t.scale)}function WN(t){return!!(null==t?void 0:t.field)}function GN(t,e){if(!t)return[];let i=[];return t.scale&&(i=HN(t.scale)?[t.scale]:N(e.getScaleById(t.scale))),i.concat(LN(t,e))}class UN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return f(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=N(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const YN={},XN=t=>YN[t],$N=(t,e,i,n,s)=>(YN[t]=new UN(e,i,n,s),YN[t]);function KN(t){return null===t?0:t}function qN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const ZN=["fillOpacity","x","y","dx","dy"],JN=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=KN(i.x),["x"]):"y"===e?(t.y=KN(i.y),["y"]):"dx"===e?(t.dx=KN(i.dx),["dx"]):"dy"===e?(t.dy=KN(i.dy),["dy"]):[]};var QN,tV,eV,iV,nV,sV,rV,aV,oV,lV,hV,cV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(QN||(QN={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(tV||(tV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(eV||(eV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(iV||(iV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(nV||(nV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(sV||(sV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(rV||(rV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(aV||(aV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(oV||(oV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(lV||(lV={})),function(t){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_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"}(hV||(hV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(cV||(cV={}));const dV={[tV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),b(e.length)||!b(e.z1)&&b(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):b(e.z1)||!b(e.length)&&b(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[tV.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[tV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return b(e)&&b(i)&&b(n)&&b(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[tV.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const uV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=f(t)?dV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(ZN.includes(r)?JN(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{ZN.includes(t)?JN(s,t,e):s[t]=e[t]}));return s},pV=(t,e,i)=>!(!h(t)||!h(e))||!h(t)&&!h(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(f(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function gV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case tV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case tV.group:case tV.rect:case tV.image:return["width","height","y1"].includes(e);case tV.path:case tV.shape:return["path","customPath"].includes(e);case tV.line:return"defined"===e;case tV.area:return["x1","y1","defined"].includes(e);case tV.rule:return["x1","y1"].includes(e);case tV.symbol:return"size"===e;case tV.polygon:return"points"===e;case tV.text:return"text"===e}return!1}function fV(t,e,i,n,s){i&&(ON(i)?e.forEach((e=>{const s=FN(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],c=s&&!gV(t.mark.markType,r)?[e[0]]:e;if(VN(l)){const t=zN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!h(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=f(null==l?void 0:l.field),d=s?ll(l.field):null;let u=s?null:h(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=v(u)||v(i)?u+e+i:u}))}else if(WN(l)){const t=ll(l.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=FN(l,n,e.datum,t)}))})))}function mV(t,e,i,n){if(!t)return null;if(ON(t))return FN(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const c=t[r];if(VN(c)){const t=zN(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!h(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=f(null==c?void 0:c.field),p=u?ll(c.field):null,g=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):h(null==c?void 0:c.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,c.value);s[r]=v(g)||v(d)?g+i+d:g}else if(WN(c)){const t=ll(c.field);s[r]=t(e)}else s[r]=FN(c,n,e,i)})),s}function yV(t){if(t)return t.type===Fl.Band?t.bandwidth():t.type===Fl.Point?t.step():void 0}const _V={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=l(i)?i:pl(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!h(s)){if(h(t))return;t[s]=e}return e})),e;const r=n(e,i);return h(s)||h(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=We.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=ll(a),c=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),d=h(t.default)?null:t.default,u=s.map((t=>ll(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),h(n)&&(n=o);const t=o.map((t=>ll(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],l=o.length;return(h(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=h(r)?d:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=PN(i,t.as||[]),s=i.map((t=>f(t)?ll(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Y(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],x=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),w=b(S*_)?S/_:null,A=b(_*_)?_/x:null;return d&&(y[d]=x),p&&(y[p]=S),r&&(y[r]=w),a&&(y[a]=0===i?1:A),o&&(y[o]=!0===g?w:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:S/v[1]),c&&(y[c]=0===i?1:x/v[1]),u&&(y[u]=_),y}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=RN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=BN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return BN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;h(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=h(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=h(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{h(n[IN])&&(n[IN]=0);let s=n[IN];const r=t.as;return e.forEach((t=>{t&&h(t[r])&&(s+=1,t[r]=s)})),n[IN]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=yV(a.y),l="y"===t.dodgeChannel||h(t.dodgeChannel)&&o>0?"y":"x",c="y"===l?o:yV(a.x);if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!h(t.dodgeBy)){const e=rl(N(t.dodgeBy));o=t=>e(t.getDatum())}const d=[];e.forEach((t=>{const e=o(t);d.includes(e)||d.push(e)}));const u=d.length;if(u<1)return e;const p=ml(a,c);let g=p>=c?c:c-p;const f=ml(i,g);let m=(g-Math.max(u-1,0)*f)/u;m>t.maxWidth?(g-=(m-t.maxWidth)*u,m=t.maxWidth):m{y[t]=-g/2+e*(m+f)}));const _=r.markType;"rect"===_||"interval"===_?e.forEach((t=>{const e=o(t),i=y[e],n=t.getItemAttribute();if("x"===l){const e={x:(h(n.width)&&!h(n.x1)?Math.min(n.x,n.x1):n.x)+(h(n.width)?h(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};h(n.width)?e.x1=e.x+m:e.width=m,t.setItemAttributes(e)}else if("y"===l){const e={y:(h(n.height)&&!h(n.y1)?Math.min(n.y,n.y1):n.y)+(h(n.height)?h(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};h(n.height)?e.y1=e.y+m:e.height=m,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=y[e];if("x"===l){const e=t.getItemAttribute("x")+c/2;t.setItemAttributes({x:e+i+m/2})}else if("y"===l){const e=t.getItemAttribute("y")+c/2;t.setItemAttributes({y:e+i+m/2})}}))}return e},markPhase:"afterEncodeItems"}},vV="__vgrammar_scene_item__",bV=[tV.line,tV.area],xV=[tV.arc3d,tV.rect3d,tV.pyramid3d],SV="key",wV=[{}],AV=["key"],kV="VGRAMMAR_IMMEDIATE_ANIMATION",MV=0,CV=1e3,TV=0,EV=!1,PV=!1,RV="quintInOut",BV={stopWhenStateChange:!1,immediatelyApply:!0},IV={},DV=t=>IV[t],LV=(t,e)=>{IV[t]={creator:e}};class OV extends tE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new pk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Ik.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new pk;let a,o;r.clear();const l=v(s)?s:Pt(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(hV.BEFORE_CREATE_VRENDER_MARK),e===tV.largeRects)return new OV(i);if(e===tV.largeSymbols)return new FV(i);const n=zV[e]?zV[e](i):DV(e)?DV(e).creator(i):null;return t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}function jV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(hV.BEFORE_CREATE_VRENDER_MARK);const n=new JP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=zV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}const NV=t=>{t&&(t[vV]=null,t.release(),t.parent&&t.parent.removeChild(t))};class VV{constructor(t){this.data=null,this.states=[],this.diffState=QN.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if(l(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));fV(this,o,a,this.mark.parameters());const h=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?uV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),h(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===QN.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(hV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=jN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(hV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=N(FN(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===QN.unChange&&(this.diffState=QN.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||this.useStates(this.states),this.mark.markType===tV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new pk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===QN.enter?(r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.update?(n&&r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.exit&&a&&fV(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=o(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=N(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&f(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=N(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=o(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)fl(n,i,t)&&E(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let c=null==l?void 0:l.nextAttrs;if(t&&t.length&&h(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||qN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[tV.line,tV.area,tV.largeRects,tV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===tV.line||e===tV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>qN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=KN(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=KN(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=KN(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=KN(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===tV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>pV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=uV(tV.line,t.attrs,i);return n.points=e.slice(t.startIndex,h(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?Object.assign(c,{segments:e,points:null}):Object.assign(c,{points:t,segments:null})}else p?Object.assign(c,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(c,{points:s,segments:null})}else e===tV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=KN(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=KN(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=KN(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=KN(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===tV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=KN(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=KN(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!M(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!h(e=C(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return C(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!E(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!E(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(NV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(NV(this.graphicItem),this.graphicItem[vV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?h(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):h(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?m(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const WV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(b(e.center.x)&&(s.x=e.center.x),b(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},GV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),UV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const YV=["visible","path","text","lineWidth","textBaseline","textAlign"],XV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:c+u/2,width:h(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:d+p/2,height:h(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:c+u/2,x1:c+u/2,y:d+p/2,y1:d+p/2,width:h(o)?void 0:0,height:h(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:h(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:h(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:h(n)?void 0:0,height:h(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:h(n)?void 0:0}}:{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:h(n)?void 0:0}}:{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:WV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:GV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:GV(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:UV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:UV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return YV.forEach((t=>{delete n[t],delete s[t]})),N(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{fl(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},$V=Object.assign({},XV),KV=t=>$V[t],qV=(t,e)=>{$V[t]=e},ZV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.from.min=l,m.to.min=d),b(u)&&(m.from.max=l,m.to.max=u),b(p)&&(m.from.q1=l,m.to.q1=p),b(g)&&(m.from.q3=l,m.to.q3=g),b(f)&&(m.from.median=l,m.to.median=f),m},JV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.to.min=l,m.from.min=d),b(u)&&(m.to.max=l,m.from.max=u),b(p)&&(m.to.q1=l,m.from.q1=p),b(g)&&(m.to.q3=l,m.from.q3=g),b(f)&&(m.to.median=l,m.from.median=g),m},QV=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(b(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return b(f)?f:b(_)&&b(v)?(_+v)/2:b(m)&&b(y)?(m+y)/2:b(y)?y:b(m)?m:NaN},tW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),b(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(b(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),b(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const eW=(t,e,i)=>{var n,s,r,a;if(b(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return b(o)?o:b(c)&&b(d)?(c+d)/2:b(l)&&b(h)?(l+h)/2:b(h)?h:b(l)?l:NaN},iW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),b(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(b(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),b(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const nW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},sW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},rW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sW:nW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function hW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(SV,i?t.slice().sort(i):t.slice()),{keys:AV,data:n};const s=jN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class cW{constructor(t,e,i){this.prevData=hW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const dW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const uW=(t,e,i,n,s)=>l(i)?i(t.getDatum(),t,s):i;class pW extends lC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class gW extends lC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{h(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}cC.mode|=TA.SET_ATTR_IMMEDIATELY;let fW=0;const mW=t=>!h(t)&&t.prototype instanceof lC;class yW{constructor(t,e,i){this.id=fW++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),b(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=l(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!KV(e.type))return null;const r=KV(e.type)(t,s,i);return dW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return m(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):d(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!h(null===(r=s[i])||void 0===r?void 0:r.from),l=!h(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?uW(t,0,s[i].from,0,n):void 0,e.to[i]=l?uW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),dW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),c=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=mW(o);return h(o)||mW(o)?u?new o(a.from,a.to,r,t.easing,c):a.to?new gW(a.from,a.to,r,t.easing):void 0:new pW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:c})})).filter((t=>!h(t)));1===e.length?t.play(e[0]):t.play(new OC(r,e))}}}function _W(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(vW(i,t[i]))})),e}function vW(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return N(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,c,d,u;if(h(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:MV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:PV,loop:null!==(n=l.loop)&&void 0!==n?n:EV,controlOptions:L({},BV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:CV,delay:null!==(a=l.delay)&&void 0!==a?a:TV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:RV,customParameters:l.customParameters,options:l.options}]}]}}const p=N(t.timeSlices).filter((t=>t.effects&&N(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:MV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:PV,loop:null!==(d=t.loop)&&void 0!==d?d:EV,controlOptions:L({},BV,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:TV,effects:N(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:RV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function bW(t,e,i){return l(t)?t.call(null,e.getDatum(),e,i):t}class xW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!h(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class SW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=_W(null!=e?e:{})}updateConfig(t){this.configs=_W(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==QN.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=vW(kV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return h(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=N(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===QN.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(h(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},i),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new yW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===QN.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(hV.ANIMATION_START,d),this.mark.emit(hV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=FN(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=bW(t.startTime,e,s),o=bW(t.totalTime,e,s),l=bW(t.oneByOne,e,s),h=bW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=bW(t.delay,e,s),l=null!==(i=bW(t.duration,e,s))&&void 0!==i?i:o/n,h=N(t.effects).map((t=>Object.assign({},t,{customParameters:bW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=v(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:v(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===QN.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===QN.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===kV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===QN.exit&&0===a[QN.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(hV.ANIMATION_END,h),this.mark.emit(hV.ELEMENT_ANIMATION_END,h,i)}}const wW=(t,e)=>HN(t)?t.output():t&&d(t)?l(t.callback)?i=>t.callback(i,e):l(t.value)?t.value(e):t:t,AW=(t,e)=>t?d(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=wW(s,e),i}),{}):t.map((t=>wW(t,e))):t;var kW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let MW=-1;class CW extends r{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=N(this.spec.dependency).map((t=>f(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=N(t).map((t=>f(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((i=>{var n;h(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return h(this.spec[e])||this.detach(LN(this.spec[e],this.view)),this.spec[e]=t,this.attach(LN(t,this.view)),this.commit(),this}}const TW=(t,e,i)=>{var n,s;if("callback"===t&&l(e))return{references:[],value:{callback:e,dependency:[]}};if(!h(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!h(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!h(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=LN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},EW=(t,e)=>{const i=(n=t.type,MN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(DN(a,e))));const o=((t,e,i)=>{if(h(e))return{value:e};if(m(e)){const n=e.map((e=>TW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return TW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},PW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=EW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class RW extends VV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if(l(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return fV(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?uV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=o(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===QN.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!h(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===QN.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=uV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{E(this.items[0].nextAttrs,e)||E(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=dV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{E(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===tV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return bV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&E(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),E(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),E(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)fl(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[vV]=null})),this.glyphGraphicItems=null),super.release()}}const BW=t=>t.markType===tV.glyph?new RW(t):new VV(t);function IW(t){return h(t.offsetX)?h(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function DW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return b(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),b(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&b(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&b(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const LW="window",OW="view",FW={trap:!1},zW="default",HW="width",jW="height",NW="viewWidth",VW="viewHeight",WW="padding",GW="viewBox",UW="autoFit";function YW(t,e,i,n,s){if(s===LW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{DW(t,IW(t),!1)}))}));const e=IW(t);DW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var XW=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 $W extends CW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new SW(this,{}),this.differ=new cW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=f(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=f(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!h(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===QN.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===lV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:wV,e);let n=i;(null==i?void 0:i.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(hV.AFTER_MARK_ENCODE)}return this.emit(hV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(hV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>h(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return XW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,h(t)||(f(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return f(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];ON(i)?this.detach(GN(i,this.view)):f(e)?this.detach(GN(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(GN(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return f(e)?(this.spec.encode[t][e]=i,this.attach(GN(i,this.view))):ON(e)?(this.spec.encode[t]=e,this.attach(GN(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(GN(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=PW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{h(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{h(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return bV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!h(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===QN.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];ON(s)||Object.keys(s).forEach((t=>{VN(s[t])&&(e[t]=zN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV];if((null==n?void 0:n.mark)===this){const i=YW(this.view,t,n,e,OW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new SW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=zN(this.spec.group,e);this.group=t,t&&(this.emit(hV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(hV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==tV.group){if(!this.graphicItem){const t=HV(this,tV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||xV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==tV.group?(h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=jN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>SV),a=jN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>SV),o=this.spec.sort,l=this.spec.groupSort,c=this.isCollectionMark(),d=new Set(this.elements.filter((t=>t.diffState===QN.enter))),u=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(h(e))s=this.elementMap.get(n),s&&(s.diffState=QN.exit);else if(h(i)){s=this.elementMap.has(n)?this.elementMap.get(n):BW(this),s.diffState===QN.exit&&(s.diffState=QN.enter,this.animate.getElementAnimators(s,QN.exit).forEach((t=>t.stop("start")))),s.diffState=QN.enter;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),u.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=QN.update;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),u.push(s)}d.delete(s)}));const p=null!=t?t:wV;this.differ.setCurrentData(hW(p,c?a:t=>`${a(t)}-${r(t)}`,c?l:void 0)),this.differ.doDiff(),d.forEach((t=>{this.elementMap.delete(c?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=u,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:HV(this,this.markType,t);if(this.emit(hV.BEFORE_ADD_VRENDER_MARK),this.markType===tV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(hV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==tV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=hW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=jN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>SV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=BW(this);e.diffState=QN.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=BW(this);i.diffState=QN.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(ON(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===tV.glyph&&XN(i)){const t=XN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>gV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{gV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(gV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(hV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(hV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(hV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||AV).forEach((t=>{const e=HV(this,tV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(hV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==QN.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return dV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=QN.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&NV(this.graphicItem),this.detachAll(),super.release()}}class KW extends $W{constructor(t,e,i){super(t,tV.component,i),this._componentDatum={[SV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:DV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,SV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[SV]+=1}evaluateJoin(t){return this.spec.key=SV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=f(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=f(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const qW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class ZW extends tE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){p(this.attribute[t])?L(this.attribute[t],e):this.attribute[t]=e,qW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>qW.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){h(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ct(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ct(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onSliderPointerMove),gj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onSliderPointerMove),gj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=dt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ge(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]=Ge(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new UM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function QW(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&QW(t,e)}))}JW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const tG=t=>!h(t)&&!1!==t.visible,eG=["#ffffff","#000000"];function iG(t,e,i,n,s){const r=aG(t),a=aG(e);return nG(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...eG);for(const s of r)if(t!==s&&nG(s,e,i,n))return s}(r,a,i,n,s)}function nG(t,e,i,n){return n?sG(t,e)>n:"largeText"===i?sG(t,e)>3:sG(t,e)>4.5}function sG(t,e){const i=rG(t),n=rG(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function rG(t){const e=ae(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 aG(t){if(null==t?void 0:t.includes("#"))return t;const e=new se(t),{r:i,g:n,b:s}=e.color;return"#"+oe(i,n,s)}function oG(t,e){return[t[0]*e,t[1]*e]}function lG(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const hG=-.5*Math.PI,cG=1.5*Math.PI,dG="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var uG;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uG||(uG={}));const pG={[uG.selectedReverse]:{},[uG.selected]:{},[uG.hover]:{},[uG.hoverReverse]:{}},gG=(t,e,i)=>new He(Object.assign({defaultFontParams:{fontFamily:dG,fontSize:11},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function fG(t,e){var i,n;if(!t)return{width:0,height:0};const s=_B({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var mG=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);sl&&(y=l,k.setAttribute("maxLineWidth",l-g[1]-g[2])));let D=0,L=0;"center"===B?(D-=y/2,m&&m.setAttribute("x",(m.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===B||"end"===B?(D-=y,m&&m.setAttribute("x",(m.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==B&&"start"!==B||f.setAttribute("x",g[3]),"middle"===I?(L-=_/2,m&&m.setAttribute("y",0)):"bottom"===I?(L-=_,m&&m.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===I&&(f.setAttribute("y",g[0]),m&&m.setAttribute("y",E/2));const{visible:O}=s,F=mG(s,["visible"]);if(u&&o(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:O&&!!e,x:D,y:L,width:y,height:_}),"rect");M(null==p?void 0:p.panel)||(t.states=p.panel)}}}yG.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var _G=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);sf?H=f:Hde&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>ge&&deme&&pece&&feue&&ye=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wG=class{render(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;this.poptipComponent||(this.poptipComponent=new vG(t.attribute.poptip));let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};g=n,L(e,xG.poptip,g),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const s=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:s.e,y:s.f})),h.stage.tryInitInteractiveLayer();const r=h.stage.getLayer("_builtin_interactive");r&&r.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wG=SG([Xw()],wG);var AG=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kG=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kG=AG([Xw()],kG);let MG=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MG=AG([Xw()],MG);const CG=new Vw((t=>{t(wG).toSelf().inSingletonScope(),t(jE).toService(wG),t(kG).toSelf().inSingletonScope(),t(PL).toService(kG),t(MG).toSelf().inSingletonScope(),t(PL).toService(MG)}));class TG extends ZW{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EG extends TG{constructor(t){super(L({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PG extends TG{constructor(t){super(L({},PG.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})}}PG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RG extends TG{constructor(t){super(L({},RG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}RG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class BG extends TG{constructor(t){super(L({},BG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=hG,endAngle:n=cG}=this.attribute,s=n-i,r=Ut(Kt(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}BG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class IG extends TG{constructor(t){super(L({},IG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=$t(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}IG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const DG=new Uint32Array(33),LG=new Uint32Array(33);LG[0]=0,DG[0]=~LG[0];for(let t=1;t<=32;++t)LG[t]=LG[t-1]<<1|1,DG[t]=~LG[t];function OG(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.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:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&DG[31&n]&LG[1+(31&s)])return!0}else{if(i[r]&DG[31&n])return!0;if(i[a]&LG[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,DG[31&i]&LG[1+(31&s)]);else for(n(r,DG[31&i]),n(a,LG[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,LG[31&i]|DG[1+(31&n)]);else for(s(r,LG[31&i]),s(a,DG[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FG(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function zG(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=FG(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function HG(t,e){return!(!t||!e)&&e.encloses(t)}function jG(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return jG(t,e,s,h,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return jG(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}if("moveX"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return jG(t,e,s,r,null===(c=n.overlap)||void 0===c?void 0:c.clampForce)}return!1}const VG=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],WG=["top","inside-top","inside"];const GG={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UG(t,e){var i,n;return null!==(n=null===(i=GG[e])||void 0===i?void 0:i.call(GG,t))&&void 0!==n?n:{from:{},to:{}}}const YG="same-time",XG=300,$G="linear";class KG extends ZW{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||M(e.states)||(e.addState(uG.hover,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this,(t=>{M(t.states)||(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void QW(this,(t=>{M(t.states)||(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));M(e.states)||(e.addState(uG.selected,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!M(e)&&(t.states=e)}_createLabelText(t){const e=dB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if(l(s)&&(s=s({})),!s||0===s.length)return[];let r=[];l(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],h=this.getBaseMarkGroup(),c=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==h?void 0:h.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==h?void 0:h.AABBBounds.height())&&void 0!==s?s:0};if(0===c.width||0===c.height)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:p=!0,clampForce:g=!0}=e,f=this._bmpTool||OG(c.width,c.height),m=this._bitmap||f.bitmap(),y=u.some((t=>"bound"===t.type));d&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&m.setRange(FG(f,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:YG,h=null!==(n=a.duration)&&void 0!==n?n:XG,c=null!==(s=a.easing)&&void 0!==s?s:$G,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=UG(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&b(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new TC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(UG(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==MA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===MA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=iG(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=iG(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=iG(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class qG extends KG{constructor(t){super(L({},qG.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZG extends KG{constructor(t){super(L({},ZG.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}ZG.tag="rect-label",ZG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const JG={rect:ZG,symbol:qG};class QG extends ZW{constructor(t){super(L({},QG.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!b(n*i))return;this._componentMap||(this._componentMap=new Map);const s=OG(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function tU(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 eU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=jt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function iU(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=tU(t,!!s),o=tU(r,!!s);const h=jt.distancePP(n,l),c=jt.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=eU(e,t,!1,!!s),o=eU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=tU(t,!!s),o=tU(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}QG.defaultAttributes={pickable:!1};class nU extends ZW{constructor(t){super(L({},nU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!M(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let h="";if("line"===t||"polygon"===t)h=tU(o,!!n);else if("circle"===t){const{center:t}=this.attribute;h=eU(t,o,!1,!!n)}const c=lB(Object.assign({path:h,z:r},l(i)?L({},nU.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;o.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=tU(o,!!n),g=Ct(o[0].x-o[1].x),f=Ct(o[0].y-o[1].y),m=lB(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*wt/2:0,beta:gf?[o[0].x,0]:[0,o[0].y]},l(i)?L({},nU.defaultAttributes.style,i(t,e)):i));m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${s}`),this.add(m)})),e.length>1&&s)){const t=m(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=oB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),M(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=uB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),M(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var rU,aU;sU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(rU||(rU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(aU||(aU={}));const oU={[aU.selectedReverse]:{},[aU.selected]:{},[aU.hover]:{},[aU.hoverReverse]:{}},lU={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var hU=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.name&&!M(e.states)&&(e.addState(uG.hover,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(uG.selected))return this._lastSelect=null,void QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));e.name&&!M(e.states)&&(e.addState(uG.selected,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);L(this.attribute,t);const i=aB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=aB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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,grid:r,items:a,panel:o}=this.attribute,l=aB({x:0,y:0,zIndex:1});if(l.name=rU.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=aB({x:0,y:0,pickable:!1});t.name=rU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=hB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=rU.background,e.id=this._getNodeId("background"),M(o.state)||(e.states=L({},pG,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){const e=this.getTickLineItems(),i=aB({x:0,y:0,pickable:!1});i.name=rU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=oB(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=rU.tick,r.id=this._getNodeId(t.id),M(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=null;else{const t=this.data[n],e=L({},pG,this.attribute.tick.state);Object.keys(e).forEach((i=>{l(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(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=oB(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=rU.subTick,r.id=this._getNodeId(`${s}`),M(n.state))r.states=null;else{const i=L({},pG,n.state);Object.keys(i).forEach((n=>{l(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&&l(n)&&(e=n(e,i));const s=this._transformItems(e),r=aB({x:0,y:0,pickable:!1});r.name=`${rU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,o=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=dB(u);if(p.name=rU.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),M(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=null;else{const n=L({},pG,this.attribute.label.state);Object.keys(n).forEach((r=>{l(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),o=Math.max(o,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),o=Math.abs(o*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new yG(Object.assign({},e));i.name=rU.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return rt(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&l(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=wt/2*(l.x>e.x?1:-1):h=wt/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===_[1]?m+=(this.axisLabelLayerSize[n-1].height+C(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+C(this.attribute,"label.space",4))*n);const v=this.getVerticalCoord(t.point,m,p),b=this.getVerticalVector(m,p,v),x=g?g(t.label,t,e,i,n):t.label;let{style:S}=f;return S=l(S)?L({},lU.label.style,S(t,e,i,n)):S,S=L({textAlign:this.getTextAlign(b),textBaseline:this.getTextBaseline(b,p)},S),l(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},v),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new nU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${rU.grid}-sub`:`${rU.grid}`,n.id=this._getNodeId(t),e.add(n)}}const dU={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&&uU(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function uU(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function pU(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function fU(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ce(t,i),r=Ce(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Me(t),l=Me(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:ke(t.angle);let f=i?t.angle+At:ke(90-t.angle);const m=i?e.angle:ke(e.angle);let y=i?e.angle+At:ke(90-e.angle);f>Mt&&(f-=Mt),y>Mt&&(y-=Mt);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(we(s,i)+we(s,n))/2>we(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function mU(t,e){"bottom"!==t&&"top"!==t||function(t,e){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"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var yU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return oG([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:m}=l,y=yU(l,["position","space","textStyle","autoRotate","shape","background","state"]);let _=.5;"start"===c?_=0:"end"===c&&(_=1);const{verticalFactor:v=1}=this.attribute,b=-1*v,x=this.getTickCoord(_),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+C(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,T=this.getVerticalCoord(x,k,!1),E=this.getVerticalVector(k,!1);let P,R,{angle:B}=y;if(P="start"===c?"start":"end"===c?"end":"center",h(B)&&p){B=lG(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else P=this.getTextAlign(E),R=this.getTextBaseline(E,!1);const I=Object.assign(Object.assign(Object.assign({},T),y),{textStyle:Object.assign({textAlign:P,textBaseline:R},u),state:M(m)?null:{text:m.text,shape:m.shape,panel:m.background}});return I.angle=B,g&&g.visible&&(I.shape=Object.assign({visible:!0},g.style),g.space&&(I.space=g.space)),f&&f.visible&&(I.panel=Object.assign({visible:!0},f.style)),I}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=hG,endAngle:r=cG}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(M(t))return;const{verticalLimitSize:o,label:c,title:d,line:u,tick:p,orient:g}=this.attribute,f=null!==(s=c.space)&&void 0!==s?s:4;let m=o,y=0,_=0;const v=(null==u?void 0:u.visible)?null!==(r=u.style.lineWidth)&&void 0!==r?r:1:0,x=(null==p?void 0:p.visible)?null!==(a=p.length)&&void 0!==a?a:4:0;(null==d?void 0:d.visible)&&(y=fG(d.text,d.textStyle).height,_=d.space),m&&(m=(m-f-_-y-v-x)/n);const{layoutFunc:S,autoRotate:w,autoRotateAngle:A,autoLimit:k,limitEllipsis:C,autoHide:T,autoHideMethod:E,autoHideSeparation:P}=c;l(S)?S(t,e,i,this):(w&&function(t,e){if(M(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Gt(e)})),mU(i,t),!fU(t))break}}(t,{labelRotateAngle:A,orient:g}),k&&b(m)&&m>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!M(t)&&b(i)&&t.forEach((t=>{const e=0===t.attribute.angle||h(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:m,ellipsis:C,orient:g}),T&&function(t,e){if(M(t))return;const i=t.filter(gU);if(M(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=l(s)?s:dU[s]||dU.parity;if(n.length>=3&&pU(n,r)){do{n=a(n,r)}while(n.length>=3&&pU(n,r));n.length<3&&!V(i).attribute.opacity&&(n.length>1&&V(n).setAttribute("opacity",0),V(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:g,method:E,separation:P}))}}_U.defaultAttributes=lU;var vU,bU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=rB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=rU.line,c.id=this._getNodeId("line"),M(null==a?void 0:a.state)||(c.states=L({},oU,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=hG,endAngle:i=cG}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=hG,endAngle:i=cG,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return $t(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return oG(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:m,state:y}=u,_=bU(u,["space","textStyle","shape","background","state"]);let v=l,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=C(this.attribute.label,"style.fontSize",12)+C(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;h(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",v={x:l.x,y:l.y-S}):"end"===A&&(w="top",v={x:l.x,y:l.y+S});const k=Object.assign(Object.assign(Object.assign({},v),_),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:M(y)?null:{text:y.text,shape:y.shape,panel:y.background}}),{angle:T}=_;return k.angle=T,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}xU.defaultAttributes=lU;class SU extends lC{constructor(){super(...arguments),this.mode=TA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return QW(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},QW(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=b(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=_t.lastIndex=vt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=_t.exec(t))&&(n=vt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=vt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=vU.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=vU.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=vU.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===vU.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===vU.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=vU.endHandler):this.state.start=this.state.start+o:this._activeTag===vU.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===gj.env&&(gj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),gj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===vU.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ct(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ct(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=AU(t,["formatMethod"]),{formatMethod:s}=e,r=AU(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const m=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,y=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(m+y)/2,f={x:f.x+m/2,y:f.y}):(g-=(m+y)/2,f={x:f.x,y:f.y+m})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+P*I,y:B.y,width:(R-P)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+P*D,width:I,height:(R-P)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+P*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(P+R)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+P*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(P+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i}=this.attribute,{start:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new yG(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;c(t)&&c(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...N(a))}setUpdateStateCallback(t){l(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){l(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){l(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){l(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){l(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){l(t)&&(this._statePointToData=t)}};var MU,CU,TU;kU.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(MU||(MU={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(CU||(CU={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(TU||(TU={}));class EU extends ZW{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=aB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const PU={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:MU.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]}},RU={start:{textAlign:"right",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:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},BU={label:{position:CU.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}},IU={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"}},DU={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"}};let LU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},RU[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new sU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new yG(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};LU.defaultAttributes=PU;let OU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},IU[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=gB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new yG(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};OU.defaultAttributes=BU;let FU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=TU.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},DU[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=uB(Object.assign(Object.assign({},e),n)):"text"===i?o=new yG(Object.assign({},e)):"richText"===i?o=fB(Object.assign(Object.assign({},e),s)):"image"===i?o=pB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new sU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=oB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};FU.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const zU={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class HU extends ZW{getCurrent(){return this._current}constructor(t){super(L({},HU.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new UM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new UM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.hasState(WU.selected)?this._setLegendItemState(t,WU.selectedHover):this._setLegendItemState(t,WU.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(GU.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(GU.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=a.delegate;if(a.name===UU.focus){const e=t.hasState(WU.focus);t.toggleState(WU.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover,WU.focus]),this._setLegendItemState(t,WU.selected)})):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover,WU.focus]),this._setLegendItemState(e,WU.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(WU.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(WU.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(GU.legendItemClick,t);n?(this._removeLegendItemState(t,[WU.selected,WU.selectedHover]),this._setLegendItemState(t,WU.unSelected)):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]))}else this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}this._dispatchEvent(GU.legendItemClick,t)}}}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,WU.selected),this._removeLegendItemState(e,[WU.unSelected,WU.unSelectedHover])):(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||M(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=aB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=jU,spaceRow:f=NU,maxWidth:m,width:y,height:_}=t;c(m)?c(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:c(y)&&(this._itemWidthByUser=y),c(_)&&(this._itemHeightByUser=_);let v=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!M(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,c(l)&&(o>=l?(v=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,c(h)&&h0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;v&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:l=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:m={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),m=this._handleStyle(m,t,e,i,n);const y=Ge(l);let _;!1===m.visible?(_=aB({x:0,y:0,cursor:(null==m?void 0:m.style).cursor}),this._appendDataToShape(_,UU.item,t,_)):(_=aB(Object.assign({x:0,y:0},null==m?void 0:m.style)),this._appendDataToShape(_,UU.item,t,_,null==m?void 0:m.state)),_.addState(e?WU.selected:WU.unSelected);const v=aB({x:0,y:0,pickable:!1});_.add(v);let b=0;const x=C(p,"style.size",10),S=C(p,"space",8),w=uB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&h(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&h(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,UU.itemShape,t,_,null==p?void 0:p.state),w.addState(e?WU.selected:WU.unSelected),v.add(w);let k=0;if(d){const e=C(u,"size",10);A=uB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:y})),this._appendDataToShape(A,UU.focus,t,_),k=e}const M=dB(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,UU.itemLabel,t,_,null==g?void 0:g.state),M.addState(e?WU.selected:WU.unSelected),v.add(M);const T=C(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+T,c(a)){const n=C(f,"space",d?8:0),s=dB(Object.assign(Object.assign({x:b+T,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));this._appendDataToShape(s,UU.itemValue,t,_,null==f?void 0:f.state),s.addState(e?WU.selected:WU.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-M.AABBBounds.width()-T-k-n),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-y[1]-y[3]-k-n})),b=s.AABBBounds.x2+n,v.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-k);A&&(A.setAttribute("x",b),v.add(A));const E=v.AABBBounds,P=E.width(),R=E.height(),B=this._itemWidthByUser||P+y[1]+y[3],I=this._itemHeightByUser||R+y[0]+y[2];return _.attribute.width=B,_.attribute.height=I,v.translateTo(-E.x1+y[3],-E.y1+y[0]),_}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=jU,spaceRow:h=NU}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=VU}=o,f=XU(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new HU(Object.assign({layout:1===r?"horizontal":"vertical",total:99},L({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new HU(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=aB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(WU.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=L({},$U,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new UM(t,{item:e,data:e.data,selected:e.hasState(WU.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=L({},t);return t.style&&l(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&l(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var qU;function ZU(t){return m(t)?t:[t,t]}function JU(t){return t?"ew-resize":"ns-resize"}KU.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:jU,spaceRow:NU,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:VU,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"}(qU||(qU={}));let QU=class t extends ZW{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(L({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onHandlerPointerMove),gj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ct(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===gj.env)gj.removeEventListener("pointermove",this._onHandlerPointerMove),gj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onTrackPointerMove),gj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ct(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ct(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onTrackPointerMove),gj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,d;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,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(c(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=N(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;h(u)&&(u=[o,l]),this._currentValue={startValue:ZU(u)[0],endValue:ZU(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=aB({x:0,y:0});g.name=qU.innerView,this.add(g),this._innerView=g;let f,m=0;if(r&&r.visible){f=dB(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=qU.startText,g.add(f);const e=c(r.space)?r.space:0;m+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const y=aB({x:p?m:0,y:p?0:m});g.add(y);const _=aB({x:0,y:0});let v;if(_.name=qU.railContainer,this._railContainer=_,y.add(_),this._renderRail(_),m+=p?n:s,a&&a.visible){const t=c(a.space)?a.space:0;v=dB(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),v.name=qU.endText,g.add(v)}this._renderTrack(_),d&&(this._renderHandlers(y),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=hB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=qU.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:c}=this.attribute;let{value:d}=this.attribute;h(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?l:o,[f,m]=ZU(d),y=(f-i)/(n-i)*g,_=this._renderHandler(Object.assign({x:p?y:l/2,y:p?o/2:y,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(_.name=qU.startHandler,this._startHandler=_,t.add(_),this._currentValue.startPos=y,u){const e=this._renderHandlerText(f);e.name=qU.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(m-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(a.name=qU.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(m);e.name=qU.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:c}=this.attribute;h(c)&&(c=[i,n]);const u=this._isHorizontal,p=u?r:s;let[g,f]=ZU(c);e||(g=i);const m=aB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=qU.trackContainer;const y=d(e)&&!0===e.draggableTrack;let _;_=!1===l?"default":!1===e||!1===y?"pointer":JU(u);const v=(f-g)/(n-i)*p,b=hB(Object.assign({x:u?(g-i)/(n-i)*p:0,y:u?0:(g-i)/(n-i)*p,width:u?v:r,height:u?s:v,cursor:_},a));b.name=qU.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return uB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":JU(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),dB(f)}_bindEvents(){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),d(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===qU.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===qU.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===qU.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===qU.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new UM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};QU.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},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}}};class tY extends YU{constructor(t){super(L({},tY.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,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:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function eY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}tY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class iY extends YU{constructor(t){super(L({},iY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,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:y,sizeBackground:_}=this.attribute,v=aB({x:0,y:0});this._innerView.add(v);const b=new QU({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:eY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=lB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}iY.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)"}};let nY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,P,R,B,I,D,L,O,F,z,H,j,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:mt,minHeight:yt,maxHeight:_t,align:vt,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ge(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&c(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else c(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(h=null==ct?void 0:ct.maxLineWidth)&&void 0!==h?h:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&c(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(m=ut.y)&&void 0!==m?m:At,width:null!==(_=null!==(y=ut.width)&&void 0!==y?y:pt)&&void 0!==_?_:0,height:null!==(b=null!==(v=ut.height)&&void 0!==v?v:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else c(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(c(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),c(gt)&&(Et=gt),c(ft)&&Ttmt&&(Tt=mt)),c(yt)&&Et_t&&(Et=_t)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],c(vt)||c(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:vt,e=null!==(O=null==ct?void 0:ct.width)&&void 0!==O?O:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","left")):"center"===t?(null===(H=this._mainTitle)||void 0===H||H.setAttribute("x",e/2),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(c(vt)||c(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:vt,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};nY.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 sY={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"}}};let rY=class extends ZW{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(c(i))if(!1!==i.visible){const t=L({},C(sY,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:c(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&b(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&b(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(c(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=N(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=L({},C(sY,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:c(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&b(a)&&this._setAutoFit(a,d,e),e.autoLimit&&b(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;h+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=fG(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",c(i.style.lineHeight)?i.style.lineHeight:s)}}};class aY extends UP{constructor(t){super(t)}}var oY,lY;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oY||(oY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lY||(lY={}));class hY extends ZW{constructor(t){super(L({},hY.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style: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"},hY.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style: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"},hY.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{h(this._playController)&&(this._playController=new aY(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{h(this._backwardController)&&(this._backwardController=new aY(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{h(this._forwardController)&&(this._forwardController=new aY(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new UM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(oY.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(oY.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(oY.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(oY.OnBackward);this.dispatchEvent(t)},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()}}hY.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hY.defaultAttributes={visible:!0,[lY.Start]:{},[lY.Pause]:{},[lY.Backward]:{},[lY.Forward]:{}};const cY={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dY=[200,10];var uY,pY;!function(t){t.Default="default",t.Reverse="reverse"}(uY||(uY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(pY||(pY={}));const gY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},fY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},mY=t=>"top"===t||"bottom"===t;class yY extends ZW{constructor(t){super(L({},yY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;b(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Pt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:b(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(mY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:dY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:dY[1];s.layout="vertical",s.railWidth=e,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 QU(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return mY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},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 hY(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=mY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=v(i)?i:Pt(i[0],i[1]);return t+e.space+n}),0),l=(mY(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,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new UM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}yY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},cY),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cY),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cY),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cY),{key:"backward",position:"start"})}};class _Y extends yY{constructor(t){super(L({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:uY.Default,this._dataIndex=h(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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(pY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=gj.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(pY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(pY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=gj.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(),gj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var vY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class bY extends yY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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,n=i/this._maxIndex;this._elapsed=n*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(pY.OnChange))},this.play=()=>vY(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(pY.OnPlay),this._rafId=gj.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=gj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},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(pY.OnBackward)},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(pY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const xY={debounce:gt,throttle:ft};let SY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",xY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=gB(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return L(t,...i,{shape:s.every(h)?void 0:L({},...s),key:r.every(h)?void 0:L({},...r),value:a.every(h)?void 0:L({},...a)})},AY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},kY={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:dG,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Wt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},MY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let CY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=Ge(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",L({symbolType:"circle"},d.shape,{visible:tG(d)&&tG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:tG(d)&&tG(d.value)},AY(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:tG(d)&&tG(d.value)},d.value),"text");const u=tG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-h[3]-h[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const m=tG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+m);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!tG(l))return;const h=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let u=0;if(tG(l.shape)&&d.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),tG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},AY(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(tG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},AY(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";c(l.value.textAlign)?e=l.value.textAlign:tG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>MY.includes(t)))?(this._mergeAttributes(e,n),h(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&tG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=tG(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=gG(u),v=gG(p);let b=0;if(tG(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(tG(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&WP[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return wY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};CY.defaultAttributes=kY;const TY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class EY extends KW{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=f(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}LV(nV.lineAxis,((t,e)=>new _U(t,e))),LV(nV.circleAxis,(t=>new xU(t)));class PY extends EY{constructor(t,e,i){super(t,eV.axis,e),this.spec.componentType=eV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=L({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=DV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=mV(s,e,i,n);const c=FN(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=FN(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=FN(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case nV.lineAxis:return((t,e,i)=>{var n,s;const r=TY.axis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p);case nV.circleAxis:return((t,e,i)=>{var n,s;const r=TY.circleAxis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(h(e)){const i=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?nV.circleAxis:nV.lineAxis,this._axisComponentType}}LV(sV.discreteLegend,(t=>new KU(t))),LV(sV.colorLegend,(t=>new tY(t))),LV(sV.sizeLegend,(t=>new iY(t)));class RY extends EY{constructor(t,e){super(t,eV.legend,e),this.spec.componentType=eV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==sV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":GU.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=f(t)?this.view.getDataById(t):t,l=f(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,iV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=DV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=mV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case sV.discreteLegend:return((t,e)=>{const i=TY.discreteLegend;return t?L({},i,{items:Array.from(new Set(N(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=NN(n),r=s?Object.assign(Object.assign({},TY.discreteLegend.items[0].shape),{fill:s,stroke:s}):TY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):L({},i,null!=e?e:{})})(o,a);case sV.colorLegend:return((t,e)=>{const i=TY.colorLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{colors:t.range().slice(),min:n[0],max:V(n)},null!=e?e:{})})(o,a);case sV.sizeLegend:return((t,e)=>{const i=TY.sizeLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&zl(i)){const t=e.getScale().range();NN(null==t?void 0:t[0])?this._legendComponentType=sV.colorLegend:this._legendComponentType=sV.sizeLegend}else this._legendComponentType=sV.discreteLegend}return this._legendComponentType}}LV(rV.lineCrosshair,(t=>new EG(t))),LV(rV.rectCrosshair,(t=>new PG(t))),LV(rV.sectorCrosshair,(t=>new BG(t))),LV(rV.circleCrosshair,(t=>new RG(t))),LV(rV.polygonCrosshair,(t=>new IG(t)));const BY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(jl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Yt(Kt(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else zl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Kt(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class IY extends EY{constructor(t,e){super(t,eV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case rV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return L({},l,BY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case rV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=BY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=L({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case rV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(jl(e.type)){const i=Yt(Kt(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else zl(e.type)&&(f=Kt(u,t));return L({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=TY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(jl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else zl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return L({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(jl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else zl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return L({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=DV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?rV.sectorCrosshair:rV.rectCrosshair:"radius"===n?rV.circleCrosshair:"radius-polygon"===n?rV.polygonCrosshair:rV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}LV(eV.slider,(t=>new QU(t)));class DY extends KW{constructor(t,e){super(t,eV.slider,e),this.spec.componentType=eV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=f(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=f(t)?this.view.getDataById(t):t,a=f(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,iV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>L({},TY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(h(this.spec.min)?0:FN(this.spec.min,i,t,e),h(this.spec.max)?1:FN(this.spec.max,i,t,e),mV(n,t,e,i))}),e}),{});this._encoders=e}}LV(eV.label,(t=>new QG(t)));let LY=class extends KW{constructor(t,e){super(t,eV.label,e),this.spec.componentType=eV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=FN(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=TY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case tV.line:r=TY.lineLabel;break;case tV.rect:r=TY.rectLabel;break;case tV.symbol:r=TY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[vV],n=mV(i,e.getDatum(),e,s),o=L({},r.data[0],n);a.push(o)}}));const o=FN(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return L({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!h(t)));return L({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};LV(eV.datazoom,(t=>new kU(t)));class OY extends KW{constructor(t,e){super(t,eV.datazoom,e),this.spec.componentType=eV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!h(this.spec.preview)){const t=this.spec.preview.data,e=f(t)?this.view.getDataById(t):t;this.detach(e),this.detach(GN(this.spec.preview.x,this.view)),this.detach(GN(this.spec.preview.y,this.view)),this.detach(GN(this.spec.preview.x1,this.view)),this.detach(GN(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=f(t)?this.view.getDataById(t):t;this.attach(r),this.attach(GN(e,this.view)),this.attach(GN(i,this.view)),this.attach(GN(n,this.view)),this.attach(GN(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t,c=f(e)?(t,i)=>{if(h(i.start)||h(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,iV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},TY.datazoom,t),n=DV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=f(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=mV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=TY.datazoom;return t?L({},l,{previewData:t,previewXCallback:e?t=>mV({x:e},t,r,a).x:null,previewYCallback:i?t=>mV({y:i},t,r,a).y:null,previewX1Callback:n?t=>mV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>mV({y1:s},t,r,a).y1:null},null!=o?o:{}):L({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=f(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}LV(oV.continuousPlayer,(t=>new bY(t))),LV(oV.discretePlayer,(t=>new _Y(t)));let FY=class extends KW{constructor(t,e){super(t,eV.player,e),this.spec.componentType=eV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=m(t)?null:f(t)?this.view.getDataById(t):t;this.detach(e)}const r=m(e)?null:f(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=f(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(pY.OnChange,this._filterCallback),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t;return this._filterData(o,l,iV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(pY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=L({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:DV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=mV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=m(o)?null:f(o)?this.view.getDataById(o):o,h=m(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>L({},TY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>L({},TY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};LV(eV.tooltip,(t=>new CY(t)));let zY=class extends KW{constructor(t,e){super(t,eV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ft(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Wt).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>L({},TY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!h(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return N(t).reduce(((t,e)=>(t=t.concat(LN(e.visible,this.view)),WN(e.key)||(t=t.concat(LN(e.key,this.view))),WN(e.value)||(t=t.concat(LN(e.value,this.view))),WN(e.symbol)||(t=t.concat(LN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=FN(t.visible,n,e,i);return o=!!h(o)||!!o,s=WN(t.key)?ll(t.key.field)(e):FN(t.key,n,e,i),s=h(s)?void 0:u(s)?s:{text:s},r=WN(t.value)?ll(t.value.field)(e):FN(t.value,n,e,i),r=h(r)?void 0:u(r)?r:{text:r},a=WN(t.symbol)?ll(t.symbol.field)(e):FN(t.symbol,n,e,i),a=h(a)?void 0:u(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?N(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var HY=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 jY extends CW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],h(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=LN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];N(t.source).forEach((t=>{const i=HN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return HY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return h(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return h(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=N(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=PW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(N(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=N(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function NY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function VY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,NY(t,e,s,n)}class WY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}return this.nodes.push(t),NY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,VY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class GY{constructor(t){this.list=[],this.ids={},this.idFunc=t||hl}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var UY=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 YY{constructor(){this.grammars=[],this.logger=We.getInstance(),this._curRank=0,this._committed=new GY((t=>t.uid)),this._heap=new WY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return UY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>h(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new GY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return UY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const XY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===tV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class $Y{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(hV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return RT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gk.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(hV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Cj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(hV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(hV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(hV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new JM(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=d(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new eC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class KY extends CW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?FN(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(m(t)&&m(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function rX(t,e,i){FN(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=FN(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),h(null==n?void 0:n.clamp)||(l(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function aX(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i),rX(t,e,i)}function oX(t,e,i){t.round&&e.round(FN(t.round,i,e),!0),t.padding&&e.padding(FN(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(FN(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(FN(t.paddingOuter,i,e),!0),t.align&&e.align(FN(t.align,i,e),!0)}function lX(t,e,i,n){const s=t.field,r=zN(t.data,i),a=f(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),zl(e.type)?(n&&a.filter((t=>v(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function hX(t,e,i){if(ZY(t.domain)?e.domain(lX(t.domain,e,i,!0),!0):e.domain(FN(t.domain,i,e),!0),ZY(t.range))e.range(lX(t.range,e,i),!0);else if(JY(t.range)){const n=zN(t.range.coordinate,i);!function(t){switch(t){case Fl.Quantile:case Fl.Quantize:case Fl.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(FN(t.range,i,e),!0);switch(t.type){case"linear":aX(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){oX(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){aX(t,e,i);const n=FN(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i);const n=FN(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){aX(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){aX(t,e,i);const n=FN(t.constant,i,e);b(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class cX extends CW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=qY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=qY(this.spec.type)),hX(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return h(this.spec.domain)||this.detach(tX(this.spec.domain,this.view)),this.spec.domain=t,this.attach(tX(t,this.view)),this.commit(),this}range(t){return h(this.spec.range)||this.detach(tX(this.spec.range,this.view)),this.spec.range=t,this.attach(tX(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!h(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!h(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return h(e)?null:this.parameters()[e]}configure(t){return this.detach(eX(this.spec.type,t,this.view)),h(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(eX(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let dX=-1;const uX=[HW,jW,WW,NW,VW,GW,UW],pX=t=>{var e,i,n,s;return v(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},gX=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:RV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:TV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:CV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:PV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},fX=(t,e)=>(null==e?void 0:e.debounce)?gt(t,e.debounce):(null==e?void 0:e.throttle)?ft(t,e.throttle):t,mX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:OW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):zV[t]?(i.markType=t,i.source=e):i.source=t===LW?LW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},yX={},_X=()=>yX;let vX=class extends $W{constructor(t,e){super(t,tV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return dV.rect}evaluateJoin(t){return super.evaluateJoin(wV)}};function bX(t,e){if(b(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return b(t)?t*e:0}return 0}function xX(t,e){return Math.min(t<0?t+e:t-1,e)}function SX(t,e,i){let n=xX(t,i),s=xX(e,i);if(b(t)||b(e)?b(t)?b(e)||(n=xX(Math.max(0,s-1),i)):s=xX(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const wX=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>bX(t,i))),u=l.map((t=>bX(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=SX(e,i,r),{start:h,end:c}=SX(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},AX=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=ml(r.maxChildWidth,s.width()),o=ml(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=pX(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==tV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(l(r))r.call(null,t,s,a,e);else if(l(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=AX(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(NW,o),i.updateSignal(VW,l),i.updateSignal(WW,h)}else AX(t,s,a,e);else"grid"===r.display&&wX(t,s,a);kX(s,e,i)}))};class MX extends $W{constructor(t,e,i){super(t,tV.glyph,i),this.glyphType=e,this.glyphMeta=XN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=jV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let CX=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return h(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return h(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return m(t)?(i.x=t[0],i.y=t[1]):v(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new qt,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class TX extends CX{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=h(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=h(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=m(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class EX extends CX{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Yt(s);const r=rt(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function PX(t){switch(t){case"cartesian":default:return new TX;case"polar":return new EX}}class RX extends CW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=PX(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=PX(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,c;!h(t.start)&&e.start(null!==(n=FN(t.start,i))&&void 0!==n?n:[0,0]),!h(t.end)&&e.end(null!==(s=FN(t.end,i))&&void 0!==s?s:[0,0]),!h(t.origin)&&e.origin(null!==(r=FN(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!h(t.translate)){const e=FN(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!h(t.rotate)){const e=FN(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!h(t.scale)){const e=FN(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}h(t.transpose)||FN(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const BX=Symbol.for("key");class IX{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i[0]}):h(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=hW(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=hW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!h(e.morphElementKey)){const i=jN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i}):h(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:BX})),r=hW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:BX}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==BX){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=FN(i.animation.delay,s,o,l),d=FN(i.animation.duration,s,o,l),u=FN(i.animation.oneByOne,s,o,l),p=FN(i.animation.splitPath,s,o,l),g=b(u)&&u>0?t=>v(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(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);yT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>pT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>fT(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:MA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new mT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:fC,null!==(l=i.easing)&&void 0!==l?l:mC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:MA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new _T({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:fC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:mC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):yT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class DX{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=f(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),h(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),h(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),h(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),h(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class LX{constructor(t){this._animations=[],this._onAnimationStart=t=>{0===this._animations.length&&this._view.emit(hV.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._animations=this._animations.filter((e=>e.config!==t.animationConfig||e.mark!==t.mark)),0===this._animations.length&&this._view.emit(hV.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(hV.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(hV.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e)})),this}pause(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e)})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e)})),this}enable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})),this}disable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i||i.call(e)})),this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.enableAnimationState)||void 0===n||n.call(i,t)})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.disableAnimationState)||void 0===n||n.call(i,t)})),this}isAnimating(){return 0!==this._animations.length}animate(){return this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){this._view.removeEventListener(hV.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(hV.ALL_ANIMATION_END,this._onAnimationEnd)}}class OX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=mV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===Fl.Band){if(!h(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===Fl.Band){if(!h(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:dV.rect}addGraphicItem(t,e){const i=HV(this,this.coord&&"polar"===this.coord.output().type?tV.arc:tV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class FX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=mV(e,t,i,s);if(h(r.size)){const t=n.x?yV(n.x):void 0,e=n.y?yV(n.y):void 0;h(t)&&h(e)?r.size=10:h(t)?r.size=e:h(e)&&(r.size=t),r.size=[t,e]}return h(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(v(i.padding)&&i.padding>0)t.size=m(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(m(i.padding)&&2===i.padding.length){const e=m(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(dV.symbol)}release(){super.release(),this._encoders=null}}var zX=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 HX extends r{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV],s=YW(0,t,n,e,OW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){f(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new KY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new jY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new cX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new RX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=f(e)?this.getMarkById(e):e;let s;switch(t){case tV.group:s=new vX(this,n);break;case tV.glyph:s=new MX(this,null==i?void 0:i.glyphType,n);break;case tV.component:s=((t,e,i,n)=>{switch(e){case eV.axis:return new PY(t,i,n);case eV.legend:return new RY(t,i);case eV.crosshair:return new IY(t,i);case eV.slider:return new DY(t,i);case eV.label:return new LY(t,i);case eV.datazoom:return new OY(t,i);case eV.player:return new FY(t,i);case eV.tooltip:return new zY(t,i)}return new KW(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case tV.interval:s=new OX(this,t,n);break;case tV.cell:s=new FX(this,t,n);break;default:s=new $W(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(tV.group,t)}glyph(t,e){return this.mark(tV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(tV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(tV.component,t,{componentType:eV.axis,mode:e})}legend(t){return this.mark(tV.component,t,{componentType:eV.legend})}crosshair(t){return this.mark(tV.component,t,{componentType:eV.crosshair})}slider(t){return this.mark(tV.component,t,{componentType:eV.slider})}label(t){return this.mark(tV.component,t,{componentType:eV.label})}datazoom(t){return this.mark(tV.component,t,{componentType:eV.datazoom})}player(t){return this.mark(tV.component,t,{componentType:eV.player})}tooltip(t){return this.mark(tV.component,t,{componentType:eV.tooltip})}customized(t,e){const i=(t=>yX[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=f(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&uX.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(hV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++dX;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(HW,t.width),this.updateSignal(jW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=_X();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(hV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=lV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:HW,value:null!==(i=t[HW])&&void 0!==i?i:0},{id:jW,value:null!==(n=t[jW])&&void 0!==n?n:0},{id:WW,value:pX(null!==(s=t[WW])&&void 0!==s?s:e[WW])},{id:NW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[HW]-i.left-i.right},dependency:[HW,WW]}},{id:VW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[jW]-i.top-i.bottom},dependency:[jW,WW]}},{id:GW,update:{callback:(t,e)=>{const i=pX(e[WW]);return(t||new Vt).setValue(i.left,i.top,i.left+e[NW],i.top+e[VW])},dependency:[NW,VW,WW]}},{id:UW,value:null!==(r=t[UW])&&void 0!==r?r:e[UW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===tV.glyph?{glyphType:t.glyphType}:t.type===tV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(HW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(NW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(VW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(WW);if(arguments.length){const i=pX(t);return this.updateSignal(e,i),i}return pX(e.output())}autoFit(t){const e=this.getSignalById(UW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(GW);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=lV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===tV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||kX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(hV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(hV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(hV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{XY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(hV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(hV.BEFORE_MARK_RENDER_END),XY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(hV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return zX(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return zX(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(hV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(hV.AFTER_DO_RENDER)}evaluate(t){var e,i;return zX(this,void 0,void 0,(function*(){const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!uX.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return XY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=en(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return zX(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(HW,t)),e!==this.height()&&(n=!0,this.updateSignal(jW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,c=mX(e);if(!c)return;const{source:u,type:p}=c,g=h((v=c).markId)?t=>t&&t.mark.id()===v.markId:h(v.markName)?t=>t&&t.mark.name()===v.markName:h(v.type)?t=>t&&t.mark.markType===v.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:f(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),y=DN(l,this),_=fX(((t,e)=>{const n=u===OW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===LW&&(t=YW(0,t,e,p,LW));let s=!1;if((!i||i(t))&&(!g||g(e))&&m.length){const e=y.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var v;if(u===OW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||d(n)&&!n[i])}(this._eventConfig,OW,p))return this.addEventListener(p,_,FW),()=>{this.removeEventListener(p,_)}}else if(u===LW)return gj.addEventListener(p,_),this._eventListeners.push({type:p,source:gj,handler:_}),()=>{gj.removeEventListener(p,_);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===gj&&t.handler===_));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);f(e)?i.type=e:d(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:zW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?f(r)?r:r.user:zW,o=r&&a===r.user&&(s===r.element||h(s)&&h(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==zW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!h(document)&&document.body:this.container;return e?h(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new $Y(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new DX((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new DX((t=>t.id())),this._options.logger&&We.setInstance(this._options.logger),this.logger=We.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new YY,this.animate=new LX(this),this._morph=new IX,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{m(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[OW,LW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&gj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=lV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==tV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=gj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&gj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),EN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const jX=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{TN(e,t[e],!0)}))}))};jX(_V);const NX=["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 VX,WX,GX;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(VX||(VX={})),function(t){t.chart="chart",t.window="window"}(WX||(WX={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(GX||(GX={}));const UX=`${Kj}_waterfall_default_seriesField`,YX=`${Kj}_DEFAULT_DATA_INDEX`,XX=`${Kj}_DEFAULT_DATA_KEY`,$X=`${Kj}_DEFAULT_DATA_SERIES_FIELD`,KX=`${Kj}_DEFAULT_SERIES_STYLE_NAME`;var qX;!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.Built_In=99]="Built_In"}(qX||(qX={}));const ZX=`${Kj}_STACK_START`,JX=`${Kj}_STACK_END`,QX=`${Kj}_STACK_START_PERCENT`,t$=`${Kj}_STACK_END_PERCENT`,e$=`${Kj}_STACK_START_OffsetSilhouette`,i$=`${Kj}_STACK_END_OffsetSilhouette`,n$=`${Kj}_SEGMENT_START`,s$=`${Kj}_SEGMENT_END`;var r$,a$;!function(t){t[t.Axis_Grid=100]="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"}(r$||(r$={})),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"}(a$||(a$={}));const o$=["linear","radial","conical"],l$={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}},h$={innerRadius:0,outerRadius:1,startAngle:wN,endAngle:AN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var c$,d$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(c$||(c$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(d$||(d$={}));const u$={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,tickSize:Ij,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Ij/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Rj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Rj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},p$={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},g$={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},f$={name:"light",padding:12,fontFamily:Pj,colorScheme:{default:{dataScheme:[{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"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Yj,line:Nj,area:Dj,bar:Lj,bar3d:Oj,pie:Wj,pie3d:Gj,map:Vj,radar:Uj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:Fj,funnel3d:zj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:Xj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:jj,treemap:$j,sunburst:h$,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Rj},minLabel:{position:d$.end},maxLabel:{position:d$.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Rj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...g$,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...g$,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...g$},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...g$}},axis:u$,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10},maxHeight:"30%"},axisY:{label:{space:20},title:{space:20,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Rj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Rj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!0,background:{size:6,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:4,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:p$,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Bj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Rj,lineHeight:Bj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:12,fontWeight:"bold",fill:"#4E5969"},contentStyle:{fontSize:12,fill:"#4E5969"},panel:{visible:!0,fill:"#fff",stroke:"#ffffff",lineWidth:0,cornerRadius:3,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:"rgba(0, 0, 0, 0.1)",size:0,space:12}}}},m$=new Map([[f$.name,f$]]),y$=f$.name;class _${static instances=new Map;static registerInstance(t){_$.instances.set(t.id,t)}static unregisterInstance(t){_$.instances.delete(t.id)}static getInstance(t){return _$.instances.get(t)}static instanceExist(t){return _$.instances.has(t)}static forEach(t,e=[],i){const n=N(e);return _$.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class v${static themes=new Map;static _currentThemeName=y$;static registerTheme(t,e){t&&v$.themes.set(t,L({},v$.getDefaultTheme(),e))}static getTheme(t){return v$.themes.get(t)||v$.getDefaultTheme()}static removeTheme(t){return v$.themes.delete(t)}static themeExist(t){return v$.themes.has(t)}static getDefaultTheme(){return v$.themes.get(y$)}static setCurrentTheme(t){v$.themeExist(t)&&(v$._currentThemeName=t,_$.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return v$.getTheme(v$._currentThemeName)}static getCurrentThemeName(){return v$._currentThemeName}}v$.registerTheme(y$,m$.get(y$)),m$.forEach(((t,e)=>{e!==y$&&v$.registerTheme(e,t)}));const b$=(t,e,i)=>new He({defaultFontParams:{fontFamily:Ej,fontSize:14},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),x$=fB({});function S$(t,e){for(let i=0;it.key===e))}function A$(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const k$=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sP$(t.style(e,i,n,s)):M(t.style)||(e.style=P$(t.style)),!M(t.state)){const i={};Object.keys(t.state).forEach((e=>{l(t.state[e])?i[e]=(i,n,s,r)=>P$(t.state[e](i,n,s,r)):M(t.state[e])||(i[e]=P$(t.state[e]))})),e.state=i}return e}function T$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e,n,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function E$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e.rawValue,n,e,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function P$(t){return M(t)||t.angle&&(t.angle=Gt(t.angle)),t}var R$;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.image="image",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(R$||(R$={}));class B${static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Qa,fields:io,filter:pn,fold:eo};static dataParser={csv:fo,dsv:go,tsv:mo};static _layout={};static registerChart(t,e){B$._charts[t]=e}static registerSeries(t,e){B$._series[t]=e}static registerComponent(t,e){B$._components[t]=e}static registerMark(t,e){B$._marks[t]=e}static registerRegion(t,e){B$._regions[t]=e}static registerTransform(t,e){B$.transforms[t]=e}static registerLayout(t,e){B$._layout[t]=e}static createChart(t,e,i){if(!B$._charts[t])return null;return new(0,B$._charts[t])(e,i)}static createRegion(t,e,i){if(!B$._regions[t])return null;return new(0,B$._regions[t])(e,i)}static createSeries(t,e,i){if(!B$._series[t])return null;return new(0,B$._series[t])(e,i)}static createMark(t,e,i){if(!B$._marks[t])return null;const n=new(0,B$._marks[t])(e,i);return n.type===R$.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(B$._components)}static getComponentInKey(t){return B$._components[t]}static getLayout(t){return B$._layout[t]}static getSeries(t){return B$._series[t]}}const I$=(t,e,i)=>{const n=t.getRegionsInIds(N(e.layoutBindRegionID));return 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})}))},D$=(t,e)=>t===e||!h(t)&&!h(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),L$=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},O$="monotone",F$="linearClosed";var z$;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(z$||(z$={}));var H$;function j$(t){return"bottom"===t||"top"===t}function N$(t){return"left"===t||"right"===t}function V$(t){return"z"===t}function W$(t,e){return Uh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(H$||(H$={}));const G$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&I$(t,n,i)));return n.length?n:null},U$=t=>t.fieldX[0],Y$=t=>t.fieldY[0],X$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=$$(t,n,"x",U$);e&&o.push(e)})),a&&a.forEach((t=>{const e=$$(t,s,"y",Y$);e&&o.push(e)})),o.length?o:null},$$=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return K$(t,a,n)},K$=(t,e,i)=>{const n=t.getScale();if(!n||!jl(n.type))return null;if(h(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=L$(e,t,"cartesian",i??(j$(t.orient)?U$:Y$));return{index:s,value:e,axis:t,data:r}},q$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&I$(t,n,i)));return n.length?n:null},Z$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&jl(e.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=Il({x:1,y:0},d);u=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(u,r);const p=Dl(d),g=a[0]?.getScale(),f=g?.range();if((u-r?.[0])*(u-r?.[1])>0||(p-f?.[0])*(p-f?.[1])>0)return;const m=Math.abs(r[0]-r[1])/i.length/2,y=e.invert(u+m);if(h(y))return;let _=e.domain().findIndex((t=>t?.toString()===y.toString()));_<0&&(_=void 0);const v=L$(y,t,"polar",l);o.push({index:_,value:y,axis:t,data:v})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&jl(e.type)){const a=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let d=Il({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const u=Dl(c),p=r[0]?.getScale(),g=p?.range();if((d-g?.[0])*(d-g?.[1])>0||(u-i?.[0])*(u-i?.[1])>0)return;const f=e.invert(u);if(h(f))return;let m=e.domain().findIndex((t=>t?.toString()===f.toString()));m<0&&(m=void 0);const y=L$(f,t,"polar",l);o.push({index:m,value:f,axis:t,data:y})}})),o.length?o:null};class J${_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=X$(this._chart,{x:t,y:e})??[],n=Z$(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!jl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=K$(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var Q$;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Q$||(Q$={}));const tK={[Q$.dimensionHover]:class extends J${_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:WX.chart},callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:WX.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!D$(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[Q$.dimensionClick]:class extends J${constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:WX.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let eK=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(tK[t]){const e=new tK[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(tK[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class iK{_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(GX.vchart,[]),this._levelNodes.set(GX.chart,[]),this._levelNodes.set(GX.model,[]),this._levelNodes.set(GX.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),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=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const nK={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 sK{globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||WX.chart),n=this.getEventListeners(e.filter?.source||WX.chart);i.get(t)||i.set(t,new iK);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||WX.chart),s=this.getEventListeners(e?.filter?.source||WX.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||WX.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||WX.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(GX.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(GX.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(WX.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(WX.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if(l(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&C(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return nK[n]&&(n=nK[n]),(!t.type||n===t.type)&&(!c(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=c(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=c(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&c(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();c(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:C(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:c(t.id)?GX.model:GX.vchart:GX.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ft(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=gt(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=WX.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==GX.model&&i!==GX.mark||(n=e.type),e?.source&&(s=e.source),c(e?.id)&&(o=e?.id,i=GX.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case WX.chart:return this._viewBubbles;case WX.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case WX.chart:return this._viewListeners;case WX.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return NX.includes(t)||Object.values(hV).includes(t)||Object.values(VX).includes(t)}}function rK(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function aK(t,e,i){t.getParser(e)||t.registerParser(e,i)}const oK=new Map;let lK;function hK(t,e,i={type:"geojson",centroid:!0}){oK.has(t)&&Yo(`map type of '${t}' already exists, will be overwritten.`),lK||(lK=new jo,aK(lK,"geojson",Do),aK(lK,"topojson",Oo),rK(lK,"simplify",Qa));const n=new Vo(lK),s=L({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),oK.set(t,n)}function cK(t,e=!1){let i=e;return t.latestData instanceof Vo&&(i=!1),i?R(t.latestData):t.latestData.slice()}const dK=(t,e)=>0===t.length?[]:1===t.length?cK(t[0],e?.deep):t.map((t=>cK(t,e?.deep)));function uK(t,e,i){rK(e=e instanceof jo?e:t.dataSet,"copyDataView",dK);const n=new Vo(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function pK(t,e,i=[]){if(t instanceof Vo)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new Vo(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!f(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Xo("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const gK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)},logLevel:We.getInstance().level()}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!f(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&gj.getCancelAnimationFrame()(this._rafId),this._rafId=gj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const n=function(n,s){const r=s?.mark?.context??{},a=c(r.modelId)?r.modelId:null,o=c(r.markId)?r.markId:null,l=c(r.modelUserId)?r.modelUserId:null,h=c(r.markUserId)?r.markUserId:null,d={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,d)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===WX.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();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===WX.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(h(e))return;const i=e.id(),n=t.grammarType;h(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(h(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];c(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return c(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return Zo(this._option.mode)?globalThis:this.getStage()?.window}}async function SK(t){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){console.error("getCanvasDataURL",t)}return t.toDataURL()}class wK{id=el();static useChart(t){t.forEach((t=>B$.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>B$.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>B$.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>B$.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>B$.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){B$.registerTransform(t,e)}static registerMap(t,e,i){hK(t,e,i)}static unregisterMap(t){!function(t){oK.has(t)?oK.delete(t):Yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,oK.get(e);var e}static hideTooltip(t=[]){_$.forEach((t=>t?.hideTooltip?.()),t)}static getLogger(){return We.getInstance()}static InstanceManager=_$;static ThemeManager=v$;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=L(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,poptip:a,...o}=this._option;i&&(this._container=f(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=v$.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new xK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,pluginList:!1!==a?["poptipForText"]:[],...o,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new sK(this,this._compiler),this._event=new eK(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!Zo(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(VX.initialized,{}),_$.registerInstance(this)):Xo("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=Jh(f(t)?JSON.parse(t):t))}_initData(){if(h(this._dataSet))return void Yo("dataSet is not initialized");const t=N(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Xo("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=gt(((...t)=>{const{width:e,height:i}=en(this._container,qj,Zj),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof jo?t:new jo,aK(this._dataSet,"dataview",Fo),aK(this._dataSet,"array",cn),rK(this._dataSet,"stackSplit",gK),rK(this._dataSet,"copyDataView",dK);for(const t in B$.transforms)rK(this._dataSet,t,B$.transforms[t]);for(const t in B$.dataParser)aK(this._dataSet,t,B$.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return c(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),oK.clear(),lK=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,_$.unregisterInstance(this)}async updateData(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):m(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(f(t)&&(t=JSON.parse(t)),e&&(t=L({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=Jh(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}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)}_updateCurrentTheme(){var t;f(this._spec?.theme)?(this._currentTheme=L({},v$.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=L({},v$.getTheme(this._currentThemeName),this._spec?.theme??{}),t=L({},this._currentTheme.component?.poptip),L(xG.poptip,bG,t)}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return v$.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===un.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(c(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await SK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!Zo(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await 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):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(c(this._container))return this._container;let t;return t=f(this._canvas)?document?.getElementById(this._canvas):this._canvas,c(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(M(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),Zh(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||h(t)||M(e))return null;if(!m(t)){const{axisId:n,axisIndex:s}=e;let r;if(c(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):c(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Yo("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?Zh(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!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"}(yK||(yK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(_K||(_K={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(vK||(vK={}));class AK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){h(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,L({},AK.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]}getMarksInType(t){const e=N(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]))))}}class kK{event;interaction;_option;_marks=new AK;_markReverse=new AK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){M(t.stateStyle[yK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),M(t.stateStyle[yK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Q$.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=m(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(yK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(yK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class MK{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class CK extends MK{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=a$.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Kh(qh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=h(t.minHeight)?null:$h(t.minHeight,e.height,e),this._maxHeight=h(t.maxHeight)?null:$h(t.maxHeight,e.height,e),this._minWidth=h(t.minWidth)?null:$h(t.minWidth,e.width,e),this._maxWidth=h(t.maxWidth)?null:$h(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:$h(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:$h(t.height,e.height,e)},{height:9}),h(t.offsetX)||(this.layoutOffsetX=$h(t.offsetX,e.width,e)),h(t.offsetY)||(this.layoutOffsetY=$h(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{h(this._spec[i])||(e[i]=$h(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};h(n)||(r.width-=n),h(s)||(r.width-=s),h(e)||(r.height-=e),h(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):(h(n)?h(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,h(e)?h(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){b(t)&&(this._layoutStartPoint.x=t),b(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){b(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),b(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}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={...t};return this._layoutRectLevelMap.width<9?(h(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),h(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(h(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),h(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class TK extends MK{grammarType;id=el();_product;getProduct(){if(c(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return c(e)&&c(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){c(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(c(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(c);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class EK extends TK{grammarType=mK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}c(this._value)&&this._product.value(this._value),c(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class PK extends MK{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new EK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class RK extends PK{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(L(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class BK extends RK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class IK extends CK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new AK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=el(),this._originalSpec=t,this._spec=Qh(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new eK(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new BK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Qh(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(h(t)||h(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=L({},e?.[N(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),m(t))return t.map((t=>d(t)&&!l(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];d(n)&&!l(n)&&(Fh(n)?e[i]=Oh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){c(t)&&c(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!c(t)||!c(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${Kj}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=B$.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const DK={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},LK={symbol:function(t,e){return"shape"===t?DK[e]??e:e}};const OK={};Object.values(yK).forEach((t=>{OK[t]=!0}));const FK={[yK.STATE_HOVER]:yK.STATE_HOVER_REVERSE,[yK.STATE_SELECTED]:yK.STATE_SELECTED_REVERSE,[yK.STATE_DIMENSION_HOVER]:yK.STATE_DIMENSION_HOVER_REVERSE};function zK(t){return FK[t]}class HK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!M(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=zK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=zK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=zK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=zK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class jK extends RK{id=el();stateKeyToSignalName=t=>`${Kj}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===fK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===fK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}}}}class NK extends IK{static type="region";modelType="region";type=NK.type;_series=[];layoutType="region";layoutZIndex=r$.Region;animate;interaction=new HK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler})),c(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:R$.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",qX.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",qX.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:R$.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:R$.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",qX.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(r$.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",qX.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",qX.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",qX.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):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=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||N(t.userId).includes(e.userId))&&(!c(t.specIndex)||!e.getSpecIndex||N(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||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(VX.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new kK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in _K)M(t.stateStyle[_K[e]])||this.interaction.registerMark(_K[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class VK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const WK=[R$.line,R$.area,"trail"];function GK(t){return WK.includes(t)}class UK extends RK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),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];c(n.domain)&&(s.domain=n.domain),c(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=o(GK)?n:!t.mark||GK(t.mark.markType);let s=!1,r=!1;if(c(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!OK[t])).map((t=>[t,10])),n=!t.mark||GK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(m(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Kj)));n=t.datums.some((t=>i&&m(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(d(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Kj)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(zl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class YK extends TK{grammarType=mK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();h(t)||(h(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class XK extends YK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return c(t)?t:`${Kj}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct(t)}}class $K extends TK{grammarType=mK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=r$.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){c(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){h(this._data)&&this.initMarkData({...this._option,mark:this}),c(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new UK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new eK(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new XK(t)}stateKeyToSignalName(t){return`${Kj}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(c(e)&&this.removeProduct());if(c(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),h(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(h(this._data))return;this._data.compile();const t=this._data.getProduct();c(this._product)&&c(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[yK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!l(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(hV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===fK.appear&&this.runAnimationByState(fK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),LK[a]?LK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class KK extends $K{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(c(t.id)&&(this._userId=t.id),o(t.interactive)&&(this._interactive=t.interactive),c(t.zIndex)&&this.setZIndex(t.zIndex),o(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(v(t))return Sl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Sl)),t}return"function"==typeof t?(e,i,n,s)=>Sl(t(e,i,n,s)):t}isUserLevel(t){return[qX.User_Mark,qX.User_Series,qX.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];h(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){this.stateStyle[i]?.[t]&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;c(r)&&r<=n&&L(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return f(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=Nh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;s=this.stateStyle[i]?.[t]?this.stateStyle[i][t]:this.stateStyle.normal[t];let r=this._computeStateAttribute(s,t,e,i,n);return l(s?.postProcess)&&(r=s.postProcess(r,e,this._attributeContext,n,this.getDataView())),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,r):r}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):o$.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):Hl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",qX.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=l(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,qX.User_Mark,e)}else this.setStyle(i,t,qX.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let h=s,d=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(h=t),d||(d=e)}const u=Dh(Ih(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),p={},g={...l$[n],...a};return Object.keys(g).forEach((t=>{const n=g[t];"stops"===t?p.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??h?.scale(e[d]);return l(s)&&(a=s(e,this._attributeContext,i,o)),c(n)&&(a=Uo.SetOpacity(a,n)),{offset:l(r)?r(e,this._attributeContext,i,o):r,color:a||u[0]}})):l(n)?p[t]=n(e,this._attributeContext,i,o):p[t]=n})),p.gradient=n,p}_computeThresholdAttr(t){return(new Th).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class qK extends KK{static type=R$.group;type=qK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Yo("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?(Yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class ZK extends KK{static type=R$.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(tV.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}class JK extends KK{static type=R$.image;type=JK.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}wK.useMark([ZK,qK,JK]),B$.registerRegion("region",NK),B$.registerLayout("base",VK);var QK,tq,eq;We.getInstance(Ve.Error),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(QK||(QK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(tq||(tq={}));class iq{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Nh("colorOrdinal"):Nh(t.type)),e?(m(t.range)&&e.range(t.range),m(t.domain)&&(nl(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),nl(n.domain)?e.reRender=!0:z(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)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{nl(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{S$(e,[{key:t,operations:zl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&S$(e,[{key:i.field,operations:zl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!nl(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=zl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{zl(e.type)?(h(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),h(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;zl(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){if(!h(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(zl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(zl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));zl(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(h(t.field)||!h(t.changeDomain)&&"none"!==t.changeDomain&&!h(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class nq{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(VX.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][JX]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[JX],s>=0?(t[ZX]=e,e+=t[JX],t[JX]=e):(t[ZX]=i,i+=t[JX],t[JX]=i)})),t.values.forEach((t=>{s=t[JX];const r=s>=0?e:i;n=s>=0?1:-1,t[QX]=Math.min(1,t[ZX]/r)*n,t[t$]=Math.min(1,t[JX]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[JX]=function(t){if(b(t))return t;const e=+t;return b(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class sq extends MK{type="chart";id=el();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:qj,height:Zj};getLayoutRect(){return this._layoutRect}_viewRect={width:qj,height:Zj};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:qj,y2:Zj};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=qh(t.padding??this._theme?.padding),this._event=new eK(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new nq(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),E(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=B$.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=pK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),c(t.regionId)?i=this.getRegionsInUserId(t.regionId):c(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&N(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=B$.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(B$.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(VX.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(VX.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>N(t).some((t=>c(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof IK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof KK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof KK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(c(t)&&c(e))this._canvasRect={width:t,height:e};else{let i=qj,n=Zj;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=en(this._option.container,qj,Zj);i=t,n=e}else if(r&&Zo(this._option.mode)){let t;t=f(r)?document?.getElementById(r):r;const{width:e,height:s}=en(t,qj,Zj);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;if(m(t))e.range=t.map((t=>Oh(t,this._theme?.colorScheme)));else{const i=t;Object.prototype.hasOwnProperty.call(i,"type")&&(e.type=i.type),Object.prototype.hasOwnProperty.call(i,"domain")&&(e.domain=i.domain),Object.prototype.hasOwnProperty.call(i,"range")&&(e.range=i.range),Object.prototype.hasOwnProperty.call(i,"specified")&&(e.specified=i.specified)}}return e.range?.length||(e.range=Ih(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new iq(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Ih(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&N(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};m(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Kh(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}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(M(t[n]))continue;const s=t[n];let r={stateValue:n};r=l(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(yK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(yK.STATE_HOVER,!0,t,e,i)}initEvent(){[VX.dataZoomChange,VX.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(hV.AFTER_MARK_RENDER_END,e)};this._event.on(hV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||l(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===Q$.dimensionHover||s===Q$.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===un.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===un.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class rq extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}function aq(t){t.crosshair=N(t.crosshair||{}).map((e=>L({[t.direction===Gh.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(eq||(eq={}));const oq=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!h(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!h(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!h(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=c,(h(o)||o===UX)&&(t[UX]=c?l.total:+t[n]>=0?l.increase:l.decrease)})),f={...i,lastIndex:t},d.push(i)})),d},lq=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},hq=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:cq(t.map((t=>t.latestData)).flat(),e.fields,i)}};function cq(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>cq(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class dq{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new Vo(e instanceof jo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),rK(e,"dimensionTree",hq),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const uq=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},pq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class gq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new AK;_markReverse=new AK;constructor(t,e){this._spec=t,this._option=e,this.event=new eK(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(yK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(yK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(N(i).forEach((e=>{t.on(e,{level:GX.chart},this.onHover)})),n&&"none"!==n&&N(n).forEach((e=>{t.on(e,{level:GX.vchart,source:WX.chart},this.onUnHover)}))),s&&(N(r).forEach((e=>{t.on(e,{level:GX.mark},this.onSelect)})),a&&"none"!==a&&N(a).forEach((e=>{t.on(e,{level:GX.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=pq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;o(i)?this._hover.enable=i:d(i)&&(this._hover.enable=!0,this._hover=L(this._hover,i));const n=this._spec.select;o(n)?this._select.enable=n:d(n)&&(this._select.enable=!0,this._select=L(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,yK.STATE_HOVER)||this.interaction.getEventElement(yK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(yK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(yK.STATE_HOVER,t.item),this.interaction.reverseEventElement(yK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(yK.STATE_HOVER);this.interaction.clearEventElement(yK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(yK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,yK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(yK.STATE_SELECTED);this.interaction.clearEventElement(yK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(yK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(yK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(yK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(yK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(yK.STATE_SELECTED);const e=this.interaction.getEventElementData(yK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class fq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const mq=(t,e)=>c(e)?t.map((t=>e[t])):void 0,yq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),_q=t=>!h(t)&&(m(t)?t.length>0&&t.every(c):Object.keys(t).length>0);function vq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(c(s.regionId)?[s.regionId]:void 0,c(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=c(s)?t[s]:void 0,a=c(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=mq(i,t);let d=mq(n,t);const u=_q(d),p=!u&&c(s)&&h(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,c=i.map(((t,e)=>[t,e])).filter((([,t])=>h(l?.[t])));let g=[l??[]];c.length>0&&c.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];g.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),g=s})),g.forEach((l=>{if(p){const r=t.getViewData()?.latestData.filter(yq(i,l));a.forEach((a=>{const c=r.find((t=>t[s]===a));if(d=mq(n,c),!_q(d))return;const p=t.dataToPosition(c);h(p)||isNaN(p.x)||isNaN(p.y)||o.push({pos:p,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===tq.pie){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToCentralPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}else{const t=e;if(p){const c=t.getViewData()?.latestData.filter(yq(i,l)),p=c.find((t=>t[s]===r));a.forEach((r=>{if(d=mq(n,p),!_q(d))return;const a=t.dataToPosition(p);h(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),d=r.getLayoutStartPoint(),u=r.getLayoutRect(),p=n.globalInstance.getContainer(),g={x:0,y:0,...p?nn(p):{}},f=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>yq(e,i)(t)&&yq(n,s)(t)&&(h(r)||yq([r],[a])(t))));return o},m=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),u.width),y:Math.min(Math.max(t.y,0),u.height)}))(t),i=s.x??d.x+e.x,n=s.y??d.y+e.y;return{canvasX:i,canvasY:n,clientX:g.x+i,clientY:g.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>f(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:WX.chart,event:m({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...f(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:WX.chart,event:m(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),l}return"none"}const bq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return c(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function xq(t){return h(t.mark)&&h(t.model)&&h(t.datum)}class Sq extends fq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];c(i)&&(e[t]={...i,title:c(i.title)?l(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:c(i.content)?l(i.content)?i.content:N(i.content).map((t=>l(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=bq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:c(e)?N(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of N(e)){const e=this.series.getSeriesStyle(t)?.(i);if(c(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const wq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},Aq={min:t=>t===wq.min()?0:t,max:t=>t===wq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===wq.min()?0:t,"array-max":t=>t===wq.max()?0:t};const kq={min:function(t,e){return il(e)?Math.min(t,e):t},max:function(t,e){return il(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.max(t,...i)}},Mq=(t,e)=>{const i={};let n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;n=S$([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!h(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=wq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=kq[n](i[t.key][n],s)})),i[t.key][n]=Aq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},Cq=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>il(t[s])));else if("zero"===n)return t.forEach((t=>{il(t[s])||(t[s]=0)})),t;return t};class Tq extends YK{_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const Eq=`${Kj}_HIERARCHY_DEPTH`,Pq=`${Kj}_HIERARCHY_ROOT`,Rq=`${Kj}_HIERARCHY_ROOT_INDEX`,Bq=()=>({keyMap:new Map});function Iq(t,e,i){t&&(this._seriesField||(t[$X]=this.getSeriesKeys()[0]),t[YX]=e,t[XX]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function Dq(t,e,i,n=0,s,r){void 0===r&&(r=e),Iq.bind(this)(t,e,i),t[Eq]=n,t[Pq]=s||t[this.getCategoryField()],t[Rq]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>Dq.bind(this)(e,n,i,t[Eq]+1,t[Pq],r)))}class Lq extends IK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[QK.label]:{name:QK.label,type:R$.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(VX.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&c(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(VX.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(h(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),o(this._spec.stack)&&(this._stack=this._spec.stack),o(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),o(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),c(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=uK(this._rawData,this._dataSet,{name:`${Kj}_series_${this.id}_viewDataFilter`});const t=uK(this._viewDataFilter,this._dataSet,{name:`${Kj}_series_${this.id}_viewData`});this._data=new Tq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(rK(this._option.dataSet,"invalidTravel",Cq),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new dq(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${Kj}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){rK(this._dataSet,"dimensionStatistics",Mq);const n=new Vo(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=S$(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&S$(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${Kj}_series_${this.id}_viewStackData`;this._viewStackData=new Vo(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(h(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(f(t))return e[t];if(m(t)&&t.every((t=>f(t))))return t.map((t=>e[t])).join("-");if(l(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(VX.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(VX.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(VX.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(VX.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(VX.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||h(e)?[]:f(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:R$.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||h(t.dataId)&&h(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new gq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??$X;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:KX,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,KX)}))}afterInitMark(){this.event.emit(VX.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",qX.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new Sq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??$X,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??$X}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=L({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:l,dataProductId:d,parent:u,isSeriesMark:p,dataStatistics:g,depend:f,label:m,progressive:y,support3d:_=this._spec.support3d||!!this._spec.zField,morph:v=!1}=e,b=super._createMark(t,{key:i??this._getDataIdKey(),support3d:_,dataStatistics:g??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(c(b)){this._marks.addMark(b),p&&(this._seriesMark=b),h(u)?this._rootMark?.addMark(b):!1!==u&&u.addMark(b),h(l)?(b.setDataView(this.getViewData(),this.getViewDataProductId()),b.setSkipBeforeLayouted(!0)):!1!==l&&b.setDataView(l,d),o(s)&&b.setSkipBeforeLayouted(s),c(f)&&b.setDepend(...N(f)),c(m)&&b.setLabelSpec(m);const t=this.getSpec()||{};b.setMorph(v),b.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),b.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),h(y)||b.setProgressiveConfig(y),h(n)||b.setGroupKey(n),this.initMarkStyleWithSpec(b,L({},r,a||t[b.name]))}return b}_getDataIdKey(){return super._getDataIdKey()??XX}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==JX&&t!==t$&&t!==ZX&&t!==QX||(t=this.getStackValueField()),A$(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=B$.getSeries(this.type);return Object.values(t.mark??{})}return t}}class Oq extends Lq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=N(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=N(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&N(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=Gh.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((e=>{const i={key:e,operations:[]};zl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((e=>{const i={key:e,operations:[]};zl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};zl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===Gh.vertical?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction===Gh.vertical?(this.setFieldY(JX),this.setFieldY2(ZX)):(this.setFieldX(JX),this.setFieldX2(ZX))}setValueFieldToPercent(){this.direction===Gh.vertical?(this.setFieldY(t$),this.setFieldY2(QX)):(this.setFieldX(t$),this.setFieldX2(QX))}setValueFieldToStackOffsetSilhouette(){this.direction===Gh.vertical?(this.setFieldY(i$),this.setFieldY2(e$)):(this.setFieldX(i$),this.setFieldX2(e$))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Go(t.xField,i)&&Go(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),c(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(this._spec?.x2Field),this.setFieldY2(this._spec?.y2Field),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{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)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}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._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===Gh.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===Gh.vertical?N(this._spec.yField??this.fieldY):N(this._spec.xField??this.fieldX)}}const Fq=(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};const zq={type:"clipIn"},Hq={type:"fadeIn"};function jq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Hq;default:return zq}}function Nq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=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 Vq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:Nq(t,e)}),Wq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:Nq(t,e)}),Gq={type:"fadeIn"},Uq={type:"growCenterIn"};function Yq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Gq;case"scaleIn":return Uq;default:return Vq(t)}}const Xq={type:"clipIn"},$q={type:"fadeIn"};function Kq(t,e){switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return $q;default:return Xq}}function qq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Zq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:qq(t,!0,fK.appear)}),Jq={type:"fadeIn"},Qq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:qq(t,!0,fK.enter)}),tZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:qq(t,!0,fK.exit)}),eZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:qq(t,!0,fK.exit)});function iZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Jq;case"growRadius":return Zq({...t,growField:"radius"});default:return Zq({...t,growField:"angle"})}}const nZ={type:"fadeIn"};function sZ(t,e){return"fadeIn"===e?nZ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function rZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aZ=t=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:rZ(t)}),oZ={type:"fadeIn"};function lZ(t,e){return!1===e?{}:"fadeIn"===e?oZ:(t=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:rZ(t)}))(t)}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=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const uZ=(t,e)=>({custom:BC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class pZ extends lC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;l(r)&&l(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);b(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);b(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class gZ extends PC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Ht(d,u,p,g);return f.defined=e.defined,f}}const fZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},mZ={type:"fadeIn"},yZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),_Z=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),vZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function bZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mZ;case"growAngle":return fZ({...t,growField:"angle"});default:return fZ({...t,growField:"radius"})}}const xZ={type:"fadeIn"},SZ={type:"growCenterIn"};function wZ(t,e){switch(e){case"fadeIn":return xZ;case"scaleIn":return SZ;default:return Vq(t,!1)}}const AZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},kZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),MZ={type:"fadeIn"},CZ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function TZ(t,e){return"fadeIn"===e?MZ:kZ(t)}const EZ=t=>({custom:DC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),PZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},RZ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===QN.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},IZ=(t,e,i)=>{if(M(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},DZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),LZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},OZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),FZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},zZ={type:"fadeIn"};function HZ(t){return!1===t?{}:zZ}const jZ={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"}},NZ={bar:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),bar3d:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),line:(t,e)=>({appear:Kq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:PC,duration:jZ.update.duration,easing:jZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:jq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),pie3d:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),rose:(t,e)=>({appear:bZ(t,e),enter:yZ(t),exit:_Z(t),disappear:vZ(t)}),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:cZ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:gZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:dZ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:pZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarGroup:(t,e)=>({appear:uZ(t,"in"),disappear:uZ(t,"out")}),circularProgress:(t,e)=>({appear:sZ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:AZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:lZ(t,e),enter:{type:"grow"},disappear:aZ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:IC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:IC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:EZ(t)}),rangeColumn:(t,e)=>({appear:TZ(t,e),enter:kZ(t),exit:CZ(t),disappear:CZ(t)}),waterfall:(t,e)=>({appear:wZ(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:PZ(0,e),enter:DZ(t),exit:OZ(t),disappear:OZ(t)}),circlePacking:(t,e)=>({appear:FZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:HZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:wU},update:{custom:SU},exit:{custom:LC}})},VZ=["appear","enter","update","exit","disappear","normal"];function WZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=l(n)?n(t,s,r):b(n)?n:0;let h=l(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(o+h))},delete t.oneByOne,t}function YZ(t){return t?.[YX]}function XZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function $Z(t){return!function(t){return c(t.timeSlices)}(t)&&c(t.channel)}class KZ extends KK{static type=R$.rect;type=KZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class qZ extends KK{static type=R$.text;type=qZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}wK.useMark([KZ,qZ]);class ZZ extends Oq{static type=tq.bar;type=tq.bar;_barMarkName=QK.bar;_barMarkType=R$.rect;static mark={...Lq.mark,[QK.bar]:{name:QK.bar,type:R$.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...ZZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e)},"normal",qX.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.bar(t,e),GZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Fq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Fq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Fq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class JZ extends KK{static type=R$.rule;type=JZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}wK.useMark([JZ]);class QZ extends ZZ{static type=tq.waterfall;type=tq.waterfall;static mark={...ZZ.mark,[QK.leaderLine]:{name:QK.leaderLine,type:R$.rule},[QK.stackLabel]:{name:QK.stackLabel,type:R$.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],h(this._seriesField)&&(this._seriesField=UX)}getSeriesKeys(){return this._seriesField===UX?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),rK(this._dataSet,"waterfallFillTotal",lq),rK(this._dataSet,"waterfall",oq),(h(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=uK(this.getViewData(),this._dataSet,{name:`${Kj}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new Tq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:ZX,endAs:JX,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(WZ(NZ.waterfall(t,e),GZ(QK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:i}))}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(QZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(QZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===Gh.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):Vh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===Gh.vertical?Vh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===Gh.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",qX.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",qX.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===Gh.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const tJ=`${Kj}_BOX_PLOT_OUTLIER_VALUE`;var eJ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(eJ||(eJ={}));const iJ=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];m(e)||(e=[e]),i.push(...e.map((e=>{const i={[tJ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class nJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(eJ.OUTLIER),value:this.getContentValue(eJ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(eJ.MAX),value:this.getContentValue(eJ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q3),value:this.getContentValue(eJ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MEDIAN),value:this.getContentValue(eJ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q1),value:this.getContentValue(eJ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MIN),value:this.getContentValue(eJ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.SERIES_FIELD),value:this.getContentValue(eJ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return this.series.getOutliersField();if(t===eJ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case eJ.MIN:return this.series.getMinField();case eJ.MAX:return this.series.getMaxField();case eJ.MEDIAN:return this.series.getMedianField();case eJ.Q1:return this.series.getQ1Field();case eJ.Q3:return this.series.getQ3Field();case eJ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return e[tJ];if(t===eJ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case eJ.MIN:return e[this.series.getMinField()];case eJ.MAX:return e[this.series.getMaxField()];case eJ.MEDIAN:return e[this.series.getMedianField()];case eJ.Q1:return e[this.series.getQ1Field()];case eJ.Q3:return e[this.series.getQ3Field()];case eJ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>c(t[tJ])}class sJ extends KK{static type=R$.boxPlot;type=sJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?($N("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(iW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),qV("barBoxplotScaleIn",ZV(eW)),qV("barBoxplotScaleOut",JV(eW))):($N("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(tW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),qV("boxplotScaleIn",ZV(QV)),qV("boxplotScaleOut",JV(QV)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class rJ extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:z$.circle,fill:void 0,lineWidth:0}}}class aJ extends rJ{static type=R$.symbol;type=aJ.type}wK.useMark([sJ,aJ]);class oJ extends Oq{static type=tq.boxPlot;type=tq.boxPlot;static mark={...Lq.mark,[QK.boxPlot]:{name:QK.boxPlot,type:R$.boxPlot},[QK.outlier]:{name:QK.outlier,type:R$.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};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=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(oJ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(oJ.mark.outlier,{progressive:t,key:YX,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:v(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===Gh.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Vh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Vh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Vh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Vh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Vh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},yK.STATE_NORMAL,qX.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),y:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,yK.STATE_NORMAL,qX.Series)}}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"foldOutlierData",iJ),rK(this._dataSet,"addVChartProperty",uq);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===Gh.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._outlierDataView=new Tq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===Gh.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===Gh.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===Gh.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(NZ.boxPlot()),i=this._initAnimationSpec(GZ(QK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(WZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(WZ(NZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new nJ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class lJ{setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(hJ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",qX.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:F$},"normal",qX.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===O$?t===Gh.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",qX.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(hJ.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series))}}const hJ={[QK.point]:{name:QK.point,type:R$.symbol},[QK.line]:{name:QK.line,type:R$.line}};class cJ extends KK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((c=>{const d=t[c];if(h(d)||s.includes(c))return;a&&r.includes(c)&&(Hl(d?.type)||d?.scale||l(d))&&(o=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class dJ extends cJ{static type=R$.line;type=dJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===tq.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}wK.useMark([dJ,aJ,qZ]);class uJ extends Oq{static type=tq.line;type=tq.line;_invalidType="break";static mark={...Lq.mark,...hJ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}j(uJ,lJ);class pJ extends KK{static type=R$.rect3d;type=pJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}wK.useMark([pJ,qZ]);class gJ extends ZZ{static type=tq.bar3d;type=tq.bar3d;static mark={...Lq.mark,[QK.bar3d]:{name:QK.bar3d,type:R$.rect3d}};_barMarkName=QK.bar3d;_barMarkType=R$.rect3d}function fJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===Gh.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===Gh.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===Gh.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===Gh.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",qX.Series)}class mJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class yJ extends ZZ{static type=tq.rangeColumn;type=tq.rangeColumn;_barMarkType=R$.rect;_barName=tq.bar;static mark={...ZZ.mark,[QK.minLabel]:{name:QK.minLabel,type:R$.text},[QK.maxLabel]:{name:QK.maxLabel,type:R$.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(yJ.mark.bar,{morph:XZ(this._spec.animation,this._spec.morph,GZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===c$.bothEnd?void 0:L({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===c$.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(yJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(yJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});fJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});fJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===Gh.horizontal?(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.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===Gh.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.rangeColumn({direction:this.direction},e),GZ(QK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new mJ(this)}}wK.useMark([pJ]);class _J extends yJ{static type=tq.rangeColumn3d;type=tq.rangeColumn3d;_barMarkType=R$.rect3d;_barName=tq.bar3d}class vJ extends cJ{static type=R$.area;type=vJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}wK.useMark([dJ,vJ,qZ,aJ]);class bJ extends Oq{static type=tq.area;type=tq.area;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(bJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Vh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Vh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(WZ(NZ.area(t,e),GZ(QK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}}j(bJ,lJ);class xJ extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class SJ extends bJ{static type=tq.rangeArea;type=tq.rangeArea;static mark={...bJ.mark};initMark(){this._areaMark=this._createMark(SJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new xJ(this)}}Ar();const wJ={},AJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function kJ(t,e){t&&f(t)||al("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(wJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Ar().projection(n),n.copy=n.copy||function(){const t=i();return AJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),wJ[i]||null}const MJ={albers:Wr,albersusa:function(){var t,e,i,n,s,r,a=Wr(),o=Vr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Vr().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(MJ).forEach((t=>{kJ(t,MJ[t])}));const CJ="Feature",TJ="FeatureCollection";function EJ(t){const e=N(t);return 1===e.length?e[0]:{type:TJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===TJ?t.features:N(t).filter((t=>!h(t))).map((t=>t.type===CJ?t:{type:CJ,geometry:t}))}(e))),[])}}const PJ=AJ.concat(["pointRadius","fit","extent","size"]);function RJ(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{PJ.includes(n)&&(i=i.concat(LN(t[n],e)))})),i):i}const BJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(h(i))for(let i=0;i(l(t),t)))};class IJ extends Lq{type=tq.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;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){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(h(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(h(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return h(r)||isNaN(r.x)||isNaN(r.y)?null:r}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){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Kj}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const DJ=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{t[YX]=i,e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class LJ extends Sq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class OJ extends KK{static type=R$.path;type=OJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var FJ,zJ,HJ;wK.useMark([OJ,qZ]),FJ="projection",zJ=class extends CW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return h(this.spec.pointRadius)||this.detach(LN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(LN(t,this.view)),this.commit(),this}size(t){return h(this.spec.size)||this.detach(LN(this.spec.size,this.view)),this.spec.size=t,this.attach(LN(t,this.view)),this.commit(),this}extent(t){return h(this.spec.extent)||this.detach(LN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(LN(t,this.view)),this.commit(),this}fit(t){return h(this.spec.fit)||this.detach(LN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(LN(t,this.view)),this.commit(),this}configure(t){return this.detach(RJ(this.spec,this.view)),h(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(RJ(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=kJ((t||"mercator").toLowerCase());return e||al("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),AJ.forEach((t=>{var i,n,s;h(this.spec[t])||(i=this.projection,n=t,s=FN(this.spec[t],e,kJ),l(i[n])&&i[n](s))})),h(this.spec.pointRadius)||this.projection.path.pointRadius(FN(this.spec.pointRadius,e,kJ)),!(h(this.spec.fit)||h(this.spec.extent)&&h(this.spec.size))){const t=EJ(FN(this.spec.fit,e,kJ));this.spec.extent?this.projection.fitExtent(FN(this.spec.extent,e,kJ),t):this.spec.size&&this.projection.fitSize(FN(this.spec.size,e,kJ),t)}return this.projection}output(){return this.projection}},HJ="projections",yX[FJ]={grammarClass:zJ,specKey:null!=HJ?HJ:FJ};class jJ extends IJ{static type=tq.map;type=tq.map;static mark={...Lq.mark,[QK.area]:{name:QK.area,type:R$.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(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.map)throw new Error(`map type '${this.map}' is not specified !`);if(!oK.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),rK(this._dataSet,"copyDataView",dK),rK(this._dataSet,"map",DJ),rK(this._dataSet,"lookup",BJ);const t=oK.get(this.map);if(!t)throw Error("no valid map data found!");const e=new Vo(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??$X,XX],as:[this.nameField,this.valueField,this._seriesField??$X,XX]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new Tq(this._option,e)}initMark(){this._pathMark=this._createMark(jJ.mark.area,{morph:XZ(this._spec.animation,this._spec.morph,GZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(jJ.mark.label,{parent:this.getRegion().getGroupMark(),skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>c(t[this._seriesField??$X])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??$X]):this._spec?.defaultFillColor,path:this.getPath.bind(this)},"normal",qX.Series),t.setPostProcess("fill",(t=>c(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",qX.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(WZ(NZ.path(),GZ(QK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initTooltip(){this._tooltipHelper=new LJ(this)}getPath(t){const e=this._areaCache.get(t[YX]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t[YX],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===R$.path?n.group.getGroupGraphicItem().scale(e,e,i):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===R$.path?i.group.getGroupGraphicItem().translate(e[0],e[1]):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return b(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]?t[this.nameField]:t.properties?.[this._nameProperty]?this._spec.nameMap?this._spec.nameMap[t.properties[this._nameProperty]]??"":t.properties[this._nameProperty]??"":""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return YX}}class NJ extends Lq{coordinate="polar";_outerRadius=kN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=c(t)?N(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=c(t)?N(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=N(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(h(t)||h(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(t)),n=this.radiusAxisHelper.dataToPosition(N(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};zl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};zl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),c(this._spec.radius)&&(this._outerRadius=this._spec.radius),c(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Go(t.angleField,i)&&Go(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const VJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=xl(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}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},WJ=(t,e)=>{const i=t[0].latestData;return new UJ(e.series,i).updateLabels()};class GJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class UJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=b$(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[eN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:c}=n;if("inside"!==t?.position){const t=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_HOVER),n.middleAngle),i=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_SELECTED),n.middleAngle),a=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_NORMAL),n.middleAngle);s[cN]=a.x,s[dN]=a.y,s[lN]=t.x,s[hN]=t.y,s[mN]=i.x,s[yN]=i.y,s[uN]=l.x,s[pN]=l.y,s[gN]=c.x,s[fN]=c.y,s[nN]=r.y-o.height/2}else s[nN]=r.y;return s[Qj]=this._computeAlign(n),s[Jj]=Math.max(a,0),s[eN]=n.labelVisible&&!h(n.labelText),s[iN]=r.x,s[tN]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=kl(e.x,e.y,f,t.middleAngle),t.labelLimit=p,at(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=Ml(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=Ml(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(ot(t.pointB.x,n+r)||at(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.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 r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?bl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=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}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?h(i)||"auto"===i?"edge"===n?Ml(t.quadrant)?"left":"right":Ml(t.quadrant)?"right":"left":i:h(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=h(n)||h(t[n])||h(t[s]);return l(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class YJ extends KK{type=XJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),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{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+Al({angle:e[_N],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class XJ extends YJ{static type=R$.arc;type=XJ.type}wK.useMark([OJ,qZ,XJ]);class $J extends NJ{_pieMarkName=QK.pie;_pieMarkType=R$.arc;static mark={...Lq.mark,[QK.pie]:{name:QK.pie,type:R$.arc},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=xN;_endAngle=SN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=c(t),r=c(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}}(c(this._spec?.startAngle)?Sl(this._spec.startAngle):this._startAngle,c(this._spec?.endAngle)?Sl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=c(this._spec?.padAngle)?Sl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;rK(this._dataSet,"pie",VJ),rK(this._dataSet,"arcLabel",WJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:rN,asEndAngle:aN,asRatio:sN,asMiddleAngle:_N,asRadian:bN,asQuadrant:vN,asK:oN}},!1);const e=new Vo(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${Kj}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new Tq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...$J.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark($J.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark($J.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Wh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Wh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this)},void 0,qX.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(VX.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){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}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${Kj}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${Kj}_ARC_LABEL_${e}_AY`])} L${Math.round(t[uN])},${Math.round(t[pN])} L${Math.round(t[gN])},${Math.round(t[fN])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(h(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=Al({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=Al({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===fK.appear)return this._startAngle;if(i===fK.disappear)return this._endAngle;const n=[fK.disappear,fK.exit],s=e.mark.elements,r=t,a=r?.[YX];if(void 0===s.find((t=>t.data[0]?.[YX]t.data[0]?.[YX]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[YX]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class KJ extends $J{static type=tq.pie;type=tq.pie}class qJ extends YJ{static type=R$.arc3d;type=qJ.type}wK.useMark([OJ,qZ,qJ]);class ZJ extends $J{static type=tq.pie3d;type=tq.pie3d;_pieMarkName=QK.pie3d;_pieMarkType=R$.arc3d;static mark={...Lq.mark,[QK.pie3d]:{name:QK.pie3d,type:R$.arc3d},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Ol(iN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Ol(nN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this),...n},void 0,qX.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const JJ=[10,20],QJ=Fl.Linear,tQ="circle",eQ=Fl.Ordinal,iQ=["circle","square","triangle","diamond","star"];wK.useMark([aJ,qZ]);class nQ extends Oq{static type=tq.scatter;type=tq.scatter;static mark={...Lq.mark,[QK.point]:{name:QK.point,type:R$.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if(l(e))return e;if(m(e)){if(h(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${Kj}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(d(e)){if(h(t))throw new Error(`${s}Field is required.`);const r={id:`${Kj}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return h(e)?10:v(e)?e:!f(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:QJ,defaultRange:JJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return h(e)?tQ:f(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:eQ,defaultRange:iQ},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(nQ.mark.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(WZ(NZ.scatter({},t),GZ(QK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:v(this._size)||l(this._size)?this._size:10,shape:f(this._shape)||l(this._shape)?this._shape:tQ},yK.STATE_NORMAL,qX.Series),(c(this._sizeField)||c(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},yK.STATE_NORMAL,qX.User_Mark),(c(this._shapeField)||c(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},yK.STATE_NORMAL,qX.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},yK.STATE_NORMAL,qX.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class sQ extends NJ{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(JX),this.setInnerRadiusField(ZX)}setValueFieldToPercent(){this.setRadiusField(t$),this.setInnerRadiusField(QX)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}wK.useMark([XJ,qZ]);class rQ extends sQ{static type=tq.rose;type=tq.rose;static mark={...ZZ.mark,[QK.rose]:{name:QK.rose,type:R$.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(rQ.mark.rose,{morph:XZ(this._spec.animation,this._spec.morph,GZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(rQ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Vh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(wl(e)??0)+90},void 0,qX.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(WZ(NZ.rose(e,t),GZ(QK.rose,this._spec)))}}}wK.useMark([vJ,dJ,aJ,qZ]);class aQ extends sQ{static type=tq.radar;type=tq.radar;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(aQ.mark.area,{progressive:t,isSeriesMark:e})}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._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:F$},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:Sl(this._spec.startAngle)??xN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.radarGroup(t,e),GZ(QK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(c(i)){const s=NZ[n];i.setAnimationConfig(WZ(s(t,e),GZ(i.name,this._spec)))}}))}}j(aQ,lJ);class oQ extends Sq{updateTooltipSpec(){super.updateTooltipSpec(),c(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>Wo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const lQ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},hQ={fill:"#bbb",fillOpacity:.2};wK.useMark([aJ,qZ,JZ,KZ]);class cQ extends Oq{static type=tq.dot;type=tq.dot;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.grid]:{name:QK.grid,type:R$.rule},[QK.gridBackground]:{name:QK.gridBackground,type:R$.rect},[QK.dot]:{name:QK.dot,type:R$.symbol},[QK.title]:{name:QK.title,type:R$.text},[QK.subTitle]:{name:QK.subTitle,type:R$.text},[QK.symbol]:{name:QK.symbol,type:R$.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){c(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){c(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){c(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){c(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){c(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),rK(this._option.dataSet,"objFlat",lQ),rK(this._option.dataSet,"copyDataView",dK),aK(this._option.dataSet,"dataview",Fo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){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(L(hQ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(cQ.mark.group),this._containerMark=this._createMark(cQ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cQ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cQ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cQ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cQ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cQ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cQ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",qX.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i));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",qX.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",qX.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(o))}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){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??$X}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new oQ(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class dQ extends Sq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>Wo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}wK.useMark([JZ,aJ]);class uQ extends Oq{static type=tq.link;type=tq.link;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.link]:{name:QK.link,type:R$.rule},[QK.arrow]:{name:QK.arrow,type:R$.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){c(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){c(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){c(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();rK(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(uQ.mark.group),this._containerMark=this._createMark(uQ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(uQ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(uQ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",qX.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?z$.triangleDown:z$.triangleUp},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new dQ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class pQ extends NJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=Sl(this._spec.startAngle)??Sl(t?.startAngle)??xN,this._endAngle=Sl(this._spec.endAngle)??Sl(t?.endAngle)??SN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||c(n?.startAngle)||c(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[ZX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[JX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class gQ extends YJ{static type=R$.arc;static constructorType=R$.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){c(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),c(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const h=c(t.innerPadding)&&c(a)||c(t.outerPadding)&&c(o),d=c(t.innerRadius)&&s||c(t.outerRadius)&&r;if(h||d){const e=Object.assign({},t);return s&&c(a)&&(l(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+(l(s)?s(t,e,i,n):s):l(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&c(o)&&(l(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-(l(r)?r(t,e,i,n):r):l(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}wK.useMark([XJ,gQ]);class fQ extends pQ{static type=tq.circularProgress;type=tq.circularProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.progressArc},[QK.progress]:{name:QK.progress,type:R$.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(fQ.mark.track),this._progressMark=this._createMark(fQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}}class mQ extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}wK.useMark([KZ]);class yQ extends Oq{static type=tq.linearProgress;type=tq.linearProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.rect},[QK.progress]:{name:QK.progress,type:R$.rect},[QK.group]:{name:QK.group,type:R$.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(yQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(yQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(yQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Vh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(hB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Vh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(hB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",qX.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.linearProgress(t,e),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}initTooltip(){this._tooltipHelper=new mQ(this)}}const _Q=[0],vQ=[20,40],bQ=[200,500],xQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},SQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],wQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:AQ,triangle:AQ,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 AQ(){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 kQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const MQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function CQ(t){return l(t)?t:function(){return t}}class TQ{constructor(t){var e,i;switch(this.options=Object.assign({},TQ.defaultOptions,t),l(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>wQ[t]?wQ[t]():wQ.circle())(this.options.shape),this.getText=null!==(e=CQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=CQ(this.options.fontWeight),this.getTextFontSize=CQ(this.options.fontSize),this.getTextFontStyle=CQ(this.options.fontStyle),this.getTextFontFamily=CQ(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=CQ(this.options.color)}if(h(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=l(this.options.rotate)?t=>{var e;return Gt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Gt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!h(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class PQ extends TQ{constructor(t){var e;super(Object.assign({},PQ.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.spiral=f(this.options.spiral)?null!==(e=EQ[this.options.spiral])&&void 0!==e?e:EQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=CQ(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:n}=kQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));for(this.data=r;s>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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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>=n)s&&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(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(IQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}DQ(p,this._size)&&(p=LQ(p,this._size))}else if(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||BQ(p,i))&&(!i||!RQ(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function RQ(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function BQ(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,DQ=(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 LQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),U(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:n}=kQ(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}FQ.defaultOptions={enlarge:!1};const HQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?NQ(t.fontFamily):"sans-serif",u=t.fontStyle?NQ(t.fontStyle):"normal",p=t.fontWeight?NQ(t.fontWeight):"normal",g=t.rotate?NQ(t.rotate):0,f=NQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?NQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",b=null!==(r=t.shrink)&&void 0!==r&&r,x=null!==(a=t.enlarge)&&void 0!==a&&a,S=null!==(o=t.clip)&&void 0!==o&&o,w=null!==(l=t.minFontSize)&&void 0!==l?l:0,A=t.randomVisible,k=t.as||HQ,M=t.depth_3d,C=t.postProjection;let T=t.fontSize?NQ(t.fontSize):14;const E=t.fontSizeRange;if(E&&!v(T)){const t=T;T=e=>VQ(t(e),WQ(t,h),E)}let P=PQ;"fast"===t.layoutType?P=FQ:"grid"===t.layoutType&&(P=OQ);const R=new P({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:T,shrink:b,clip:S,enlarge:x,minFontSize:w,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},NQ=t=>f(t)||v(t)||l(t)?t:e=>e[t.field],VQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],WQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function GQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),XQ=(t,e)=>{let i=0;for(const e of t)YQ(e)?i+=1:i+=.53;return i};function $Q(t){return x(t)?new Promise(((e,i)=>{const n=pB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{We.getInstance().error("image 加载失败!",t)}})):null}var KQ=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 qQ(t){return KQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield $Q(e);r&&(a=yield function(t,e,i){return KQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&JQ(s,n,a-1);)--a;for(;oo&&QQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield $Q(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||ZQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function ZQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function JQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||n0(e,t,r)))return i0(e,t,r),!0}return!1}function i0(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function n0(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function s0(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,m;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(d=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function r0(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?t0(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=r0(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return t0(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){s0(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!n0(i,y,_)&&(i0(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var l0=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())}))};const h0={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},c0=(t,e,i,n)=>l0(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||al("WordcloudShape shape must be specified."),t.text||al("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(UQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||h0;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=gj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield qQ(l),p=t.colorMode||"ordinal",g={getText:f0(t.text),getFontSize:f0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?f0(t.colorField):f0(t.text),getFillingColor:f0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:f0(t.colorHexField),getFontFamily:f0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:f0(t.padding||1),getFontStyle:f0(t.fontStyle||"normal"),getFontWeight:f0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?f0(t.fontOpacity):()=>1};u0(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:f0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:f0(t.fillingFontStyle||"normal"),getFillingFontWeight:f0(t.fillingFontWeight||"normal"),getFillingPadding:f0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=XQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,P=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),R=Math.max(...P.map((t=>t.fontSize)));P.forEach((t=>t.weight=t.fontSize/R)),P.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield o0(P,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(UQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),d0=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new Wl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Wl).domain(e).range(f).scale(t)}}else(new _h).domain(g0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new _h).domain(g0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},u0=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new Mh).domain(g0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&l(s)&&!n){const e=.5,[o,l]=(i.shapeArea,g0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=p0(h,i,!0);n=[~~(e*c),~~c];const d=(new Mh).domain(g0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=p0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},p0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=XQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},f0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:l(t)?t:e=>e[t.field]:null,m0=`${Kj}_WORD_CLOUD_ANGLE`,y0=`${Kj}_WORD_CLOUD_FILLING_ANGLE`,_0=`${Kj}_WORD_CLOUD_WEIGHT`,v0=`${Kj}_WORD_CLOUD_TEXT`;wK.useMark([qZ]),TN("wordcloud",{transform:jQ,markPhase:"beforeJoin"},!0),TN("wordcloudShape",{transform:c0,markPhase:"beforeJoin"},!0);class b0 extends Lq{static mark={...Lq.mark,[QK.word]:{name:QK.word,type:R$.text},[QK.fillingWord]:{name:QK.fillingWord,type:R$.text}};_nameField;_valueField;setValueField(t){c(t)&&(this._valueField=t,this.setFontSizeRange(vQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){c(t)&&c(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??bQ,this._rotateAngles=this._spec.rotateAngles??_Q,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:xQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:_Q,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!SQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(b0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?v0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud(),GZ(QK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??$X};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:XX,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?v0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:Zo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class x0 extends b0{static type=tq.wordCloud;type=tq.wordCloud}class S0 extends b0{static type=tq.wordCloud3d;type=tq.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(b0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.fillingWord,this._spec)))}}const w0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=b(y*f)?y/f:null,x=b(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:x),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},A0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},k0=`${Kj}_FUNNEL_TRANSFORM_RATIO`,M0=`${Kj}_FUNNEL_REACH_RATIO`,C0=`${Kj}_FUNNEL_HEIGHT_RATIO`,T0=`${Kj}_FUNNEL_VALUE_RATIO`,E0=`${Kj}_FUNNEL_LAST_VALUE_RATIO`,P0=`${Kj}_FUNNEL_NEXT_VALUE_RATIO`,R0=`${Kj}_FUNNEL_LAST_VALUE`,B0=`${Kj}_FUNNEL_CURRENT_VALUE`,I0=`${Kj}_FUNNEL_NEXT_VALUE`,D0=`${Kj}_FUNNEL_TRANSFORM_LEVEL`,L0=20;class O0 extends Sq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===QK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===QK.transform){const e=t?.[M0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===QK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])?t?.[n[0]]:t?.[s]}}class F0 extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class z0 extends F0{static type=R$.polygon;type=z0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}wK.useMark([z0,qZ,JZ]);class H0 extends Lq{static type=tq.funnel;type=tq.funnel;_funnelMarkName=QK.funnel;_funnelMarkType=R$.polygon;_transformMarkName=QK.transform;_transformMarkType=R$.polygon;static mark={...Lq.mark,[QK.funnel]:{name:QK.funnel,type:R$.polygon},[QK.transform]:{name:QK.transform,type:R$.polygon},[QK.transformLabel]:{name:QK.transformLabel,type:R$.text},[QK.outerLabel]:{name:QK.outerLabel,type:R$.text},[QK.outerLabelLine]:{name:QK.outerLabelLine,type:R$.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"funnel",w0),rK(this._dataSet,"funnelTransform",A0);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new Tq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:B0,asTransformRatio:k0,asReachRatio:M0,asHeightRatio:C0,asValueRatio:T0,asNextValueRatio:P0,asLastValueRatio:E0,asLastValue:R0,asNextValue:I0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:D0}})}initMark(){if(this._funnelMark=this._createMark({...H0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...H0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(H0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(H0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(H0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(H0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new O0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>c(t[this._valueField]),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Ol(M0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",qX.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",qX.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),GZ(QK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(WZ(NZ.funnel({},t),GZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(WZ(NZ.label(),GZ(QK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[E0])/2:this._getSecondaryAxisLength(t[T0])/2,s=this._getSecondaryAxisLength(t[T0])/2):(n=this._getSecondaryAxisLength(t[T0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[P0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[D0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return c(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!c(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(v(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-L0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series)}}function V0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=U0(t.children,u.children,i+1,o,u,r);u.value=h(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else u.isLeaf=!0,u.value=h(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:l,flattenIndex:o}},Y0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=Y0(t.children,e,t,s))})),n},X0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=X0(t.children,e,t,s)),s=e(t,n,i,s)})),s},$0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:V0,slice:W0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?W0:V0)(t,e,i,n,s)}};class K0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=m(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=m(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=m(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=m(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},K0.defaultOpionts,t);const i=this.options.nodeKey,n=l(i)?i:i?ll(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?G0(this.options.aspectRatio):null!==(e=$0[this.options.splitType])&&void 0!==e?e:$0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=U0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(v(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(v(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)}))}}K0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const q0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class Z0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];V0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),q0);const n=m(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],n)return this._layoutLabel(t,o(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},Z0.defaultOpionts,t):Object.assign({},Z0.defaultOpionts);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+ml(this.options.center[0],t.width),n=t.y0+ml(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=m(r),l=o?r.map((t=>ml(t,s))):ml(r,s),c=m(a),d=this.options.gapRadius,u=c?a.map((t=>ml(t,s))):ml(a,s),p=Y(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return h(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:ih(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(m(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=ml(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(m(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=U0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("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=$t({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}Z0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const J0=4294967296;function Q0(t,e){let i,n;if(i1(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function i1(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function a1(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function o1(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function l1(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function h1(t){return{_:t,next:null,prev:null}}function c1(t,e){const i=(t=N(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];a1(s,n,r);let a,o,l,h,c,d,u,p=h1(n),g=h1(s),f=h1(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:m(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="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 h=[],c=U0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%J0)/J0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=l(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:g1.defaultOpionts.nodeSort;Y0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)Y0([u],d1(this.options.setRadius)),X0([u],u1(this._getPadding,.5,d)),Y0([u],p1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);Y0([u],d1(g1.defaultOpionts.setRadius)),X0([u],u1(cl,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&X0([u],u1(this._getPadding,u.radius/t,d)),Y0([u],p1(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}g1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const f1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):f1(t.children,e,i)))})),e},m1=(t,e={})=>{if(!t)return[];const i=[];return f1(t,i,e),i},y1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new Z0(i).layout(t,{width:n,height:s})};class _1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var v1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(v1||(v1={}));const b1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(h(s))return t;if(i.type===v1.DrillDown){return N(k$(t,s,n,"children"))}if(i.type===v1.DrillUp){const e=M$(t,s,n,"children");if(e)return N(e)}return t};class x1{pointerId;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(){}parserDragEvent(){return!0}}class S1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const w1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1}};class A1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return w1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===un.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;rK(t,"drillFilter",b1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(h(t.datum)||h(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!m(t)||M(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:v1.DrillDown},e().reRunAllTransform(),i.emit(VX.drill,{value:{path:t,type:v1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!m(i)||M(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:v1.DrillUp},t().reRunAllTransform(),e.emit(VX.drill,{value:{path:i,type:v1.DrillUp},model:this}),i}}wK.useMark([XJ,qZ]);class k1 extends NJ{static type=tq.sunburst;type=tq.sunburst;static mark={...Lq.mark,[QK.sunburst]:{name:QK.sunburst,type:R$.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),this._startAngle=Gt(this._spec.startAngle),this._endAngle=Gt(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),rK(this._dataSet,"sunburstLayout",y1),rK(this._dataSet,"flatten",m1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[c(this._centerX)?this._centerX:this.getLayoutRect().width/2,c(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(k1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){h(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.y+(c(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(k1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return d(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(c(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},yK.STATE_NORMAL,qX.Series)}initTooltip(){this._tooltipHelper=new _1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((i=>{i.setAnimationConfig(WZ(NZ.sunburst(t,e),GZ(i.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(m(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}j(k1,A1);const M1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new g1(i).layout(t,{width:n,height:s})};class C1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}wK.useMark([XJ,qZ]);class T1 extends Oq{static type=tq.circlePacking;type=tq.circlePacking;static mark={...Lq.mark,[QK.circlePacking]:{name:QK.circlePacking,type:R$.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,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();h(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"circlePackingLayout",M1),rK(this._dataSet,"flatten",m1),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(T1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){h(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},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(T1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},yK.STATE_NORMAL,qX.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new C1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((e=>{e.setAnimationConfig(WZ(NZ.circlePacking({},t),GZ(e.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}j(T1,A1);const E1=t=>{let e=0;return t.forEach(((t,i)=>{var n;h(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=E1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function P1(t){return t.depth}function R1(t,e){return e-1-t.endDepth}const B1=(t,e)=>t.y0-e.y0,I1={left:P1,right:R1,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?W(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:P1,end:R1};class D1{constructor(t){this._ascendingSourceBreadth=(t,e)=>B1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D1.defaultOptions,t);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._alignFunc=l(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I1[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];E1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(h(s.source)||h(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(f(e)){const t=ct(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(v(e)){if(r=e,v(i))a=i;else if(h(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else l(e)&&v(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}h(this.options.nodeSortBy)&&s.sort(B1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},O1=(t,e)=>{if(!t||!e?.view||!m(t))return t;const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new D1(e),s=[];return s.push(n.layout(t,i)),s},F1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],z1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class H1 extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(v(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class j1 extends KK{static type=R$.linkPath;type=j1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){$N("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),qV("linkPathGrowIn",aW),qV("linkPathGrowOut",oW),qV("linkPathUpdate",lW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}wK.useMark([KZ,j1,qZ]),TN("sankey",{transform:L1,markPhase:"beforeJoin"},!0);class N1 extends Oq{static type=tq.sankey;type=tq.sankey;static mark={...ZZ.mark,[QK.node]:{name:QK.node,type:R$.rect},[QK.link]:{name:QK.link,type:R$.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=r$.Node;_labelLayoutZIndex=r$.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Vt;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){rK(this._dataSet,"sankey",O1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new jo;aK(t,"dataview",Fo),rK(t,"sankeyNodes",F1),rK(t,"addVChartProperty",uq);const e=new Vo(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._nodesSeriesData=new Tq(this._option,e);const i=new jo;aK(i,"dataview",Fo),rK(i,"sankeyLinks",z1),rK(i,"addVChartProperty",uq);const n=new Vo(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._linksSeriesData=new Tq(this._option,n)}}initMark(){const t=this._createMark(N1.mark.node,{isSeriesMark:!0,key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(N1.mark.link,{key:YX,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(N1.mark.label,{key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},yK.STATE_NORMAL,qX.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},yK.STATE_NORMAL,qX.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(WZ(NZ.sankeyNode(t,e),GZ(QK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(WZ(NZ.sankeyLinkPath(),GZ(QK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:GX.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:GX.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(N(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||N(s[r]).includes(e.source)&&N(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(N(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new H1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Ih(this._option.getTheme().colorScheme,this.type),n=new Hh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const V1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new K0(e).layout(t,i)},W1=(t,e)=>{let i={},n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=m1(s);return i=Mq([{latestData:r}],e),i};class G1 extends Sq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class U1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,w1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return w1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;h(s)||Yh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){w1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){w1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;h(s)&&h(r)||Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:GX.chart},(t=>{if(!t.event)return;const{event:n}=t;Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:GX.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){w1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:GX.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:GX.chart,source:WX.chart},l),this._eventObj.off(n,{level:GX.chart,source:WX.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:GX.chart,source:WX.chart},l),this._eventObj.on(n,{level:GX.chart,source:WX.chart},o)}}wK.useMark([KZ,qZ]);class Y1 extends Oq{static type=tq.treemap;type=tq.treemap;static mark={...Lq.mark,[QK.nonLeaf]:{name:QK.nonLeaf,type:R$.rect},[QK.leaf]:{name:QK.leaf,type:R$.rect},[QK.nonLeafLabel]:{name:QK.nonLeafLabel,type:R$.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Vt;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qt),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),b(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"treemap",V1),rK(this._dataSet,"flatten",m1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){rK(this._dataSet,"hierarchyDimensionStatistics",W1),rK(this._dataSet,"flatten",m1);const i=new Vo(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initMark(){const t=this._createMark(Y1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(Y1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(Y1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(Y1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},yK.STATE_NORMAL,qX.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()},yK.STATE_NORMAL,qX.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}initAnimation(){this.getMarksInType(R$.rect).forEach((t=>{t.setAnimationConfig(WZ(NZ.treemap(),GZ(t.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}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 G1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(hV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(hV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}j(Y1,U1),j(Y1,A1),wK.useMark([OJ,KZ]);class X1 extends pQ{static type=tq.gaugePointer;type=tq.gaugePointer;static mark={...Lq.mark,[QK.pin]:{name:QK.pin,type:R$.path},[QK.pinBackground]:{name:QK.pinBackground,type:R$.path},[QK.pointer]:{name:QK.pointer,type:[R$.path,R$.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?R$.rect:R$.path}initMark(){this._pinBackgroundMark=this._createMark(X1.mark.pinBackground),this._pointerMark=this._createMark({...X1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(X1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===R$.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return c(this.radiusAxisHelper)&&c(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.pointer,this._spec)))}}wK.useMark([gQ]);class $1 extends pQ{static type=tq.gauge;type=tq.gauge;static mark={...Lq.mark,[QK.segment]:{name:QK.segment,type:R$.progressArc},[QK.track]:{name:QK.track,type:R$.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=Sl(this._spec.padAngle??0)}initData(){super.initData();rK(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[s$]=t[this._angleField[0]],t[n$]=e>0?i[e-1][s$]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark($1.mark.track),this._segmentMark=this._createMark($1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(c(t[n$])?this.angleAxisHelper.dataToPosition([t[n$]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[s$]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.segment,this._spec)))}}class K1 extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return c(i)&&"dimension"===t&&(i.visible=!1),i}}class q1 extends rJ{static type=R$.cell;type=q1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}wK.useMark([q1,qZ]);class Z1 extends Oq{static type=tq.heatmap;type=tq.heatmap;static mark={...Lq.mark,[QK.cell]:{name:QK.cell,type:R$.cell},[QK.cellBackground]:{name:QK.cellBackground,type:R$.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=N(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(Z1.mark.cell,{morph:XZ(this._spec.animation,this._spec.morph,GZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(Z1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=Ge(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",qX.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(WZ(NZ.heatmap(t),GZ(QK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new K1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}wK.useSeries([bJ]);class J1 extends rq{static type=eq.area;static view="singleDefault";type=eq.area;seriesType=tq.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([ZZ]);class Q1 extends rq{static type=eq.bar;static view="singleDefault";type=eq.bar;seriesType=tq.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class t2 extends rq{static type=eq.bar3d;static view="singleDefault";type=eq.bar3d;seriesType=tq.bar3d}wK.useSeries([oJ]);class e2 extends rq{static type=eq.boxPlot;static view="singleDefault";type=eq.boxPlot;seriesType=tq.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??Gh.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===Gh.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),aq(t)}}wK.useSeries([T1]);class i2 extends sq{static type=eq.circlePacking;static view="singleDefault";type=eq.circlePacking;seriesType=tq.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=tq.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class n2 extends sq{static type=eq.common;static view="singleDefault";type=eq.common}class s2 extends sq{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([H0]);class r2 extends s2{static type=eq.funnel;static view="singleDefault";type=eq.funnel;seriesType=tq.funnel}wK.useSeries([N0]);class a2 extends s2{static type=eq.funnel3d;static view="singleDefault";type=eq.funnel3d;seriesType=tq.funnel3d}const o2={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function l2(t){let e=0;return C(t,"tick.visible")&&(e+=C(t,"tick.tickSize")),C(t,"label.visible")&&(e+=C(t,"label.space")),e}function h2(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function c2(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function d2(t){const e=t?.orient;return"angle"===e||"radius"===e}const u2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},j$(t)?r:a)},p2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class g2 extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=N(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return c(i)&&e.forEach((t=>{h(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));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],c(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class f2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),h(n.angle.type)&&(n.angle.type="linear"),h(n.radius.type)&&(n.radius.type="band");const s=h2(n.angle,{min:0,max:1});h(n.angle.min)&&(n.angle.min=s.min),h(n.angle.max)&&(n.angle.max=s.max)}}wK.useSeries([X1,$1]);class m2 extends f2{static type=eq.gauge;static view="singleDefault";type=eq.gauge;seriesType=tq.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:tq.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===tq.gauge||t.type===tq.circularProgress));h(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&h(e.radiusField)&&h(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===tq.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),h(e.angle.type)&&(e.angle.type="linear"),h(e.radius.type)&&(e.radius.type="linear")}}wK.useSeries([Z1]);class y2 extends rq{static type=eq.heatmap;static view="singleDefault";type=eq.heatmap;seriesType=tq.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class _2 extends rq{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}wK.useSeries([ZZ]);class v2 extends _2{static type=eq.histogram;static view="singleDefault";type=eq.histogram;seriesType=tq.bar;transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class b2 extends _2{static type=eq.histogram3d;static view="singleDefault";type=eq.histogram3d;seriesType=tq.bar3d}wK.useSeries([uJ]);class x2 extends rq{static type=eq.line;static view="singleDefault";type=eq.line;seriesType=tq.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([jJ]);class S2 extends sq{static type=eq.map;static view="singleDefault";type=eq.map;seriesType=tq.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor}}isValidSeries(t){return t===tq.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class w2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}wK.useSeries([KJ]);class A2 extends w2{static type=eq.pie;static view="singleDefault";type=eq.pie;seriesType=tq.pie}wK.useSeries([ZJ]);class k2 extends w2{static type=eq.pie3d;static view="singleDefault";type=eq.pie3d;seriesType=tq.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}wK.useSeries([fQ]);class M2 extends f2{static type=eq.circularProgress;static view="singleDefault";type=eq.circularProgress;seriesType=tq.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}wK.useSeries([yQ]);class C2 extends rq{static type=eq.linearProgress;static view="singleDefault";type=eq.linearProgress;seriesType=tq.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="band"),h(e.type)&&(e.type="linear");const n=h2(e,{min:0,max:1});h(e.min)&&(e.min=n.min),h(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="linear"),h(e.type)&&(e.type="band");const n=h2(i,{min:0,max:1});h(i.min)&&(i.min=n.min),h(i.max)&&(i.max=n.max)}}}class T2 extends g2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}wK.useSeries([aQ]);class E2 extends T2{static type=eq.radar;static view="singleDefault";type=eq.radar;seriesType=tq.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:L({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}wK.useSeries([SJ]);class P2 extends rq{static type=eq.rangeArea;static view="singleDefault";type=eq.rangeArea;seriesType=tq.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([yJ]);class R2 extends rq{static type=eq.rangeColumn;static view="singleDefault";type=eq.rangeColumn;seriesType=tq.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([_J]);class B2 extends rq{static type=eq.rangeColumn3d;static view="singleDefault";type=eq.rangeColumn3d;seriesType=tq.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}wK.useSeries([rQ]);class I2 extends T2{static type=eq.rose;static view="singleDefault";type=eq.rose;seriesType=tq.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??kN,outerRadius:t.outerRadius??kN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}wK.useSeries([N1]);class D2 extends sq{static type=eq.sankey;static view="singleDefault";type=eq.sankey;seriesType=tq.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([nQ]);class L2 extends rq{static type=eq.scatter;static view="singleDefault";type=eq.scatter;seriesType=tq.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}wK.useSeries([cQ,uQ]);class O2 extends sq{static type=eq.sequence;static view="singleDefault";type=eq.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==tq.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[tq.bar,tq.line,tq.area,tq.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===tq.dot?"band":"linear",visible:t.type!==tq.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===tq.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===tq.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=pK(t.data,this._dataSet,this._spec.data),t.type===tq.link&&(t.dataDot=pK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===tq.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===tq.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}wK.useSeries([k1]);class F2 extends sq{static type=eq.sunburst;static view="singleDefault";type=eq.sunburst;seriesType=tq.sunburst;getDefaultSeriesSpec(t){const e=c(t.startAngle)?t.startAngle:wN,i=c(t.endAngle)?t.endAngle:e+Ut(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=tq.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([Y1]);class z2 extends sq{static type=eq.treemap;static view="singleDefault";type=eq.treemap;seriesType=tq.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([QZ]);class H2 extends Q1{static type=eq.waterfall;static view="singleDefault";type=eq.waterfall;seriesType=tq.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&N(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),aq(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class j2 extends sq{type=eq.wordCloud;seriesType=tq.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([x0]);class N2 extends j2{static type=eq.wordCloud;static view="singleDefault";type=eq.wordCloud;seriesType=tq.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}wK.useSeries([S0]);class V2 extends j2{static type=eq.wordCloud3d;static view="singleDefault";type=eq.wordCloud3d;seriesType=tq.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class W2{plugins;id=el();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function G2(t){const e={...t};return M(t.style)||(e.textStyle=P$(t.style)),M(t.textStyle)||L(e.textStyle,P$(t.textStyle)),t.shape?.style&&P$(e.shape.style),t.background?.style&&P$(e.background.style),e}function U2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class Y2 extends IK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new W2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case un.cartesianBandAxis:return u2(W$(i),"band",e);case un.cartesianLinearAxis:return u2(W$(i),"linear",e);case un.cartesianAxis:case un.cartesianTimeAxis:return u2(W$(i),void 0,e);case un.polarBandAxis:return p2(i.orient,"band",e);case un.polarLinearAxis:return p2(i.orient,"linear",e);case un.polarAxis:return p2(i.orient,void 0,e);case un.cartesianCrosshair:case un.polarCrosshair:return e.component?.crosshair;case un.colorLegend:return e.component?.colorLegend[U2(i)];case un.sizeLegend:return e.component?.sizeLegend[U2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),m(this._originalSpec)?this._spec=this._originalSpec.map((t=>L({},this._theme,t))):this._spec=L({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:WX.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const X2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(h(a)||h(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},$2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{h(i[e])||t.latestData.forEach((t=>{N(i[e]).forEach((i=>{h(t[i])||(h(o[t[i]])&&(o[t[i]]=0),h(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class K2 extends Y2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=W$(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?Gh.horizontal:Gh.vertical)===Gh.horizontal,c(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(c(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):c(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),h(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(c(t)&&(c(t.userId)&&(this._seriesUserId=N(t.userId)),c(t.specIndex)&&(this._seriesIndex=N(t.specIndex))),c(this._spec.seriesId)){const t=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(c(this._spec.seriesIndex)){const t=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(c(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(c(this._spec.regionId)){const t=N(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(zl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};Ll(this._regions,(s=>{const r="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,a="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!r||!a)return;const o=r.getAxisId()===this._relatedAxisComponent.id?r:a.getAxisId()===this._relatedAxisComponent.id?a:this._isHorizontal?r:a,l=o===r?a:r,h=zl(l.getScale(0).type);t.push(s.getRawData());const c=s.getSpec(),d=N(c.xField),u=N(c.yField),p="cartesian"===s.coordinate?d[0]:c.angleField??c.categoryField,g="cartesian"===s.coordinate?u[0]:c.radiusField??c.valueField;if(n[s.id]="link"===s.type?"from_xField":o===r?p:g,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":l===r?p:g;i.push(h?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else h(this._spec.valueField),Ll(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;aK(n,"dataview",Fo),rK(n,"dataFilterComputeDomain",$2);const s=new Vo(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new YK(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&zl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&zl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new ah,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(rK(this._option.dataSet,"dataFilterWithNewDomain",X2),Ll(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>zl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ct(this._start-s,0,1),a=ct(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}j(K2,U1);class q2 extends K2{static type=un.scrollBar;type=un.scrollBar;name=un.scrollBar;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(h(i))return;if(!m(i))return new q2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new q2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new JW({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return h(i)||(n.padding=i),M(t?.style)||(n.railStyle=P$(t.style)),M(e?.style)||(n.sliderStyle=P$(e.style)),n}}class Z2 extends K2{static type=un.dataZoom;type=un.dataZoom;name=un.dataZoom;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;_startHandlerSize;_endHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(h(i))return;if(!m(i))return new Z2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new Z2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const t=this._spec.startHandler.style.visible??!0,e=this._spec.endHandler.style.visible??!0;this._startHandlerSize=t?this._spec.startHandler.style.size:0,this._endHandlerSize=e?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new _h;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e+i};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e+i};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new kU({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:P$(this._spec.background?.style),startHandlerStyle:P$(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:P$(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:P$(this._spec.middleHandler.background?.style)}},endHandlerStyle:P$(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:P$(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:P$(this._spec.endText?.style)},selectedBackgroundStyle:P$(this._spec.selectedBackground.style),dragMaskStyle:P$(this._spec.dragMask?.style),backgroundChartStyle:{line:L(P$(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:L(P$(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class J2 extends Y2{static type=un.customMark;type=un.customMark;layoutType="absolute";layoutZIndex=r$.CustomMark;layoutLevel=a$.CustomMark;static createComponent(t,e){return t.customMark?[new J2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`});if(s&&(h(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),c(t.dataId)||b(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class Q2 extends Y2{layoutType="absolute";static type=un.brush;type=un.brush;name=un.brush;layoutZIndex=r$.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!h(i)&&!1!==i.visible)return[new Q2(i,{...e,specKey:Q2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new SY({zIndex:this.layoutZIndex,brushStyle:P$(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=VX.brushChange;r="brushStart"===n||"brushDown"===n?VX.brushStart:"brushEnd"===n||"brushMaskUp"===n?VX.brushEnd:VX.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{...P$(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&Le(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&De(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){c(this._spec.regionId)&&c(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){c(this._spec.brushLinkSeriesId)&&c(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&N(t).includes(s.userId)||e&&N(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var t3;function e3(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function i3(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function n3(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:i3(t.rect),anchorCandidates:h3(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>e3(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;te3(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function s3(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=Be(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=o3(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=hn(r,n,i);if(!o3(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],r3(a3(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=r3(a3(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=l3(t.rect,a,0),t}));return n3(h)}function r3(t){return t>180?t-360:t}function a3(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function o3(t,e){for(let i=0;i{const{x:r,y:a}=l3({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(t3||(t3={}));class c3 extends Y2{static type=un.mapLabel;type=un.mapLabel;name=un.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=r$.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!c(i.series)?new c3(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new Vo(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new YK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new FU({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=qh(this._spec.background?.padding),d=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const u={},p=this.dataToPosition(t),g=aB({});if(g.name=`${this.name}_marker_itemContainer_${e}`,u.container=g,this._spec.background?.visible){const t=hB(P$({...this._spec.background.style}));t.setAttributes(p),u.labelBackground=t,g.appendChild(t)}if(this._spec.icon?.visible){const t=uB(P$({...this._spec.icon.style}));t.setAttributes(p),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;u.icon=t,g.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=dB(P$({...this._spec.nameLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.nameLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&c(t[this.valueField])){const e=dB(P$({...this._spec.valueLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.valueLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}const f=Object.values(u).find((t=>!!t&&"group"!==t.type)),m={x:f?.getComputedAttribute("x"),y:f?.getComputedAttribute("y")},y={x:m.x,y:m.y,width:0,height:0};y.width=n+r+(i-1)*d,y.height=s+a;const _={rect:y,point:m,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));_.rect=l3(y,o,l),_.anchors=t,_.offset=l}else _.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:_,contentMarks:u}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:P$({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):n3(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class d3{id;name;service;static Name;constructor(t=d3.Name){this.id=el(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function u3(t,e){const i=e.getSpec?.();M(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=j$(e.layoutOrient),r=t[0],a=V(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);u3(n?n.getChildren():[],t.component),u3(s?s.getChildren():[],t.component)}}function g3(t){return 2===t.length&&b(t[0])&&b(t[1])&&t[1]>=t[0]}function f3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!b(a.min),extendable_max:!b(a.max)}}function m3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function y3(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 _3(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 v3(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 b3=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),x3=(t,e,i=0)=>{const n=new Wt(t).expand(i/2),s=new Wt(e).expand(i/2);return n.intersects(s)},S3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function A3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=Sl(-90));const u=b$(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Wt).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},M3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return b3(p,r.options)};class C3 extends d3{Name="AxisSyncPlugin";constructor(){super(C3.Name)}_checkEnableSync(t){if(!zl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(VX.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!zl(i.type)||!zl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!g3(s)||!g3(r))return;const a=f3(t,s),o=f3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!y3(a,o))return}else if(0===p&&0===g){if(!y3(o,a))return}else if(u||y)if(u&&!y){if(!m3(a,o))return}else if(y&&!u){if(!m3(o,a))return}else{if(h===g)return;if(h>g){if(!_3(a,o))return}else if(!_3(o,a))return}else{if(0===h&&0===p){if(!v3(a,o))return}else if(0===g&&0===l&&!v3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){rK(e.getOption().dataSet,"tickAlign",M3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var T3={AxisLabelOverlapPlugin:p3,AxisSyncPlugin:C3};const E3=t=>t,P3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!w3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},R3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?S3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return b3(t.domain());let h;if(c(s))h=t.stepTicks(s);else if(c(n))h=t.forceTicks(n);else if(c(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=l2(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=l2(r),c=b$(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Bl(u),{x:m,y:y}=$t({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Wt).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=I3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}else h=t.domain();return b3(h)},I3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&x3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},D3=(t,e)=>{if(zl(t.type))return((t,e)=>{if(!zl(t.type))return b3(t.domain());const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=c(s)?t.stepTicks(s):c(n)?t.forceTicks(n):t.ticks(i??5),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=k3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&A3(s,i);)s=P3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),V(a)!==V(r)&&a.push(V(r))),r=a}return b3(r)})(t,e);if(jl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(c(s))l=t.stepTicks(s);else if(c(n))l=t.forceTicks(n);else if(c(i))l=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=k3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=R3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}else l=t.domain();return b3(l)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return B3(t,e)}return b3(t.domain())};class L3 extends Y2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),c(this._spec.id)&&t.setUserId(this._spec.id),o(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==C(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=WZ(NZ.axis(),{appear:this._spec.animationAppear??C(this._option.getChart().getSpec(),"animationAppear.axis")??C(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??C(this._option.getChart().getSpec(),"animationDisappear.axis")??C(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??C(this._option.getChart().getSpec(),"animationEnter.axis")??C(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??C(this._option.getChart().getSpec(),"animationExit.axis")??C(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??C(this._option.getChart().getSpec(),"animationUpdate.axis")??C(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return Ll(this._regions,(e=>{m(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;c(t)&&(this._seriesUserId=N(t)),c(i)&&(this._regionUserId=N(i)),c(e)&&(this._seriesIndex=N(e)),c(n)&&(this._regionIndex=N(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(Ll(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!zl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=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));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(Ll(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===rU.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&h(t.title.angle)&&(i="left"===t.orient?-90:90,e=o2[t.orient]),{orient:this.orient,select:t.select,hover:t.hover,line:(n=t.domainLine,(n=C$(n)).startSymbol=C$(n.startSymbol),n.endSymbol=C$(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:l(t.label.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.label.style(e.rawValue,i,e,n,s));return P$(this._preprocessSpec(L({},this._theme.label?.style,r)))}:P$(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:E$(t.label.state),autoRotate:!!t.label.autoRotate,autoHide:!!t.label.autoHide,autoLimit:!!t.label.autoLimit,autoRotateAngle:t.label.autoRotateAngle,autoHideMethod:t.label.autoHideMethod,autoHideSeparation:t.label.autoHideSeparation,limitEllipsis:t.label.limitEllipsis,layoutFunc:t.label.layoutFunc},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:l(t.tick.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.tick.style(e,i,n,s));return P$(this._preprocessSpec(L({},this._theme.tick?.style,r)))}:P$(t.tick.style),state:T$(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:l(t.subTick.style)?(e,i,n,s)=>{const r=t.subTick.style(e,i,n,s);return P$(L({},this._theme.subTick?.style,r))}:P$(t.subTick.style),state:T$(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:l(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return P$(this._preprocessSpec(L({},this._theme.grid?.style,n)))}:P$(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:P$(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Gt(i):null,textStyle:L({},e,P$(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:P$(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:P$(t.title.background?.style)},state:{text:T$(t.title.state),shape:T$(t.title.shape?.state),background:T$(t.title.background?.state)}},panel:{visible:t.background?.visible,style:P$(t.background?.style),state:T$(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const O3=[T3.AxisLabelOverlapPlugin,T3.AxisSyncPlugin];class F3 extends L3{static type=un.cartesianAxis;type=un.cartesianAxis;name=un.cartesianAxis;layoutType="region-relative";layoutZIndex=r$.Axis;layoutLevel=a$.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;_verticalLimitSize;constructor(t,e){super(t,{...e}),this._orient=W$(t,["z"]),V$(this._orient)&&(this.layoutType="absolute"),c(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?j$(t)?"linear":"band":j$(t)?"band":"linear"}(t.orient,i),s=`${F3.type}-${n}`,r=B$.getComponentInKey(s);if(r){let n=t.inverse;return i&&!j$(t.orient)&&(n=!c(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(F3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[F3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===Gh.horizontal;if(!m(i))return c2(i)?F3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>N$(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{c2(t)&&a.push(F3.createAxis(t,{...e,specIndex:i,specKey:F3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):N$(this.orient)?t.setYAxisHelper(this.axisHelper()):V$(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];j$(this.orient)?b(e)&&(s=n?[e,0]:[0,e]):V$(this.orient)?b(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):b(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(O3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();j$(this.orient)?h(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):h(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=j$(this.orient)?t.fieldX:V$(this.orient)?t.fieldZ:t.fieldY,zl(this._scale.type)?e:[e[0]]}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(hV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(j$(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(VX.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Ll(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:j$(this.orient)?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:V$(this.orient)?i.fieldZ:i.fieldY,n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{j$(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):N$(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):V$(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;b(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),b(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=j$(this.orient)?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=j$(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(L({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=L({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&h(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{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=j$(this.orient),s=t=>(n?!j$(t.orient):j$(t.orient))&&zl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(c(t))a=r.find((e=>e.id===t));else if(c(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const z3=Math.sqrt(50),H3=Math.sqrt(10),j3=Math.sqrt(2);class N3{_extend={};setExtraAttrFromSpec(){c(this._spec.nice)&&(this._nice=this._spec.nice),c(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=h2(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];c(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),c(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(W(t)-function(t){if(t&&m(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=z3?10:s>=H3?5:s>=j3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(VX.scaleUpdate,{model:this})}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{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._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}j(G3,W3);class U3 extends V3{static type=un.cartesianTimeAxis;type=un.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=L({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new YK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=Wo.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return m(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&m(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class Y3 extends L3{static type=un.polarAxis;type=un.polarAxis;name=un.polarAxis;layoutType="absolute";layoutZIndex=r$.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=xN;get startAngle(){return this._startAngle}_endAngle=SN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${Y3.type}-${i}`,s=B$.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(Y3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!m(i))return d2(i)?(i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),Y3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!d2(i))return;i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),i.outerRadius=i.radius??t.outerRadius??t.radius??kN;const o=Y3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Sl(this._spec.startAngle??wN),this._endAngle=Sl(this._spec.endAngle??(c(this._spec.startAngle)?this._spec.startAngle+360:AN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(VX.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._spec.tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return zl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=Al({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=jt.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=kN,e=0;const i=this.getChart().getSpec();return Ll(this.getRegions(),(n=>{const s=n;if(function(t){return[tq.rose,tq.radar,tq.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;b(n)&&(t=n),b(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(L({},this._axisStyle,t))}}class X3 extends Y3{static type=un.polarLinearAxis;type=un.polarLinearAxis;_zero=!0;_nice=!0;_scale=new _h;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}j(X3,N3);class $3 extends Y3{static type=un.polarBandAxis;type=un.polarBandAxis;_scale=new ah;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function K3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:p,regionId:g,regionIndex:f,seriesIndex:m,seriesId:y,padding:_,...v}=L({},t),b=v;return i.visible&&(b.title=G2(i)),M(n.focusIconStyle)||P$(n.focusIconStyle),n.shape=C$(n.shape),n.label=C$(n.label),n.value=C$(n.value),n.background=C$(n.background),Xh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),Xh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),Xh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),b.item=n,M(s.textStyle)||P$(s.textStyle),C$(s.handler),b.pager=s,r.visible&&!M(r.style)&&(L(b,r.style),c(r.padding)&&(b.padding=r.padding)),b}j($3,W3);const q3=(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},Z3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return c(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class J3 extends Y2{layoutType="normal";layoutZIndex=r$.Legend;layoutLevel=a$.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Uh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;c(i)&&(this._seriesUserId=N(i)),c(t)&&(this._regionUserId=N(t)),c(n)&&(this._seriesIndex=N(n)),c(e)&&(this._regionUserIndex=N(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new YK(this._option,t),this._initSelectedData(),Ll(this._regions,(t=>{t.event.on(VX.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;h(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(VX.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;b(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(L({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(L({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),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,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class Q3 extends J3{static type=un.discreteLegend;type=un.discreteLegend;name=un.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return i.type&&"discrete"!==i.type?void 0:new Q3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new Q3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){rK(this._option.dataSet,"discreteLegendFilter",Z3),rK(this._option.dataSet,"discreteLegendDataMake",q3);const t=new Vo(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!nl(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=A$(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...K3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return KU}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(GU.legendItemClick,(e=>{const i=C(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(VX.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(GU.legendItemHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(GU.legendItemUnHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:b(r)?r:1,strokeOpacity:b(a)?a:1,opacity:b(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return l(this._spec.data)?this._spec.data(t):t}}const t5=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;b(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},e5=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!M(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function i5(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:d,id:u,visible:p,orient:g,position:f,data:m,defaultSelected:y,field:_,filter:v,regionId:b,regionIndex:x,seriesIndex:S,seriesId:w,padding:A,...k}=L({},t),C=k;return e.visible&&(C.title=G2(e)),C.showHandler=!1!==i.visible,M(i.style)||(C.handlerStyle=P$(i.style)),c(n.width)&&(C.railWidth=n.width),c(n.height)&&(C.railHeight=n.height),M(n.style)||(C.railStyle=P$(n.style)),M(s.style)||(C.trackStyle=P$(s.style)),C.startText=C$(r),C.endText=C$(a),C.handlerText=C$(o),M(l)||(C.sizeBackground=P$(l)),h.visible&&!M(h.style)&&(L(C,h.style),c(h.padding)&&(C.padding=h.padding)),C}function n5(t){return"color"===t||"size"===t}const s5={color:tY,size:iY},r5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],a5=[2,10];class o5 extends J3{static type=un.continuousLegend;type=un.colorLegend;name=un.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return n5(i.type)?new o5(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{n5(t.type)&&n.push(new o5(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?un.colorLegend:un.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){rK(this._option.dataSet,"continuousLegendFilter",e5),rK(this._option.dataSet,"continuousLegendDataMake",t5);const t=new Vo(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=A$(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!nl(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=A$(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),M(n)&&(n="color"===this._legendType?r5:a5);const r={...i5(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return s5[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",gt((e=>{const i=C(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(VX.legendFilter,{model:this,value:i,event:e})}),30))}}}const l5=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),N(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class h5 extends Y2{static speckey="indicator";static type=un.indicator;type=un.indicator;name=un.indicator;layoutType="absolute";layoutZIndex=r$.Indicator;layoutLevel=a$.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==h5.type)return null;const i=N(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map(((t,i)=>new h5(t,{...e,specIndex:i,specKey:h5.speckey})));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){rK(this._option.dataSet,"indicatorFilter",l5);const t=new Vo(this._option.dataSet);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 YK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return N(this._spec.content).forEach((t=>{const e=L({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{...P$(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!c(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{...P$(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rY(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":l(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return Ll(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){this._indicatorComponent&&(this._container.removeChild(this._indicatorComponent),this._indicatorComponent=null),this._cacheAttrs=null,super.clear()}}class c5 extends Y2{static type=un.title;type=un.title;layoutType="normal";layoutZIndex=r$.Title;layoutLevel=a$.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Uh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!m(i))return new c5(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new c5(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;b(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),b(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:b(t.width())?t.width():0,height:this._spec.height?this._spec.height:b(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new nY(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class d5{projection;constructor(t){if(this.projection=kJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function u5(t,e){return`${Kj}_${e}_${t}`}class p5 extends Y2{static type=un.geoCoordinate;type=un.geoCoordinate;name=un.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:u5(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(h(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new p5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=L(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(VX.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new d5(this._projectionSpec)}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===tq.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===tq.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(tq.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==tq.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}j(p5,U1);const g5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},f5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class m5 extends Y2{layoutType="absolute";gridZIndex=r$.CrossHair_Grid;labelZIndex=r$.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach(((t,i)=>this._registerEvent(t,m(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:WX.chart},this._handleEvent),this.event.on(e,{level:GX.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ft((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(g5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(m(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(g5[e][t]),s=s.concat(g5[e][i(t)])})),{in:n,out:s}}return{in:g5[e][t],out:g5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=C(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{f5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),m(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function _5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var v5,b5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(v5||(v5={}));class x5 extends m5{static type=un.cartesianCrosshair;type=un.cartesianCrosshair;name=un.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.xField||i.yField?new x5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new x5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,v5.VERTICAL,!0),this.layoutByValue(v5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,v5.HORIZONTAL,!1),this.layoutByValue(v5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return zl(t.getScale().type)&&b(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){j$(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(v5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=v5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,d;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(jl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(zl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=_5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=l2(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(jl(s.type)){const t=s._step;d=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(zl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=_5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(d=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):d=1,a=r}}if(this.yHair.label?.visible){const e=l2(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(v5.HORIZONTAL&&this._layoutHorizontal(n,d??0),v5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EG({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new PG({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new yG(e)),n.add(t)),y5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(b5||(b5={}));class S5 extends m5{static type=un.polarCrosshair;type=un.polarCrosshair;name=un.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.categoryField||i.valueField?new S5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new S5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});zl(s.getScale().type)&&b(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:jt.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(b5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",L(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=l2(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=l2(t.getSpec())),n.angle=i.angle,n.axis=t,L(n,s)}))),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(b5.HORIZONTAL&&this._layoutHorizontal(n),b5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:$t(l,n,i),end:$t(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new EG({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new BG({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Bl(i),e={...$t(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Kt(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=$t(t,s,p),m=$t(t,s,g),y=ve([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=ct(jt.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new IG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new RG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=xl(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}}(i),n={...$t(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new yG(e),n.add(t),i(t)),y5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const w5=t=>P$({...t}),A5=t=>({...t,style:{...P$(t.style)}}),k5=t=>{const e=w5(t?.slider?.trackStyle??{}),i=w5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},P$({...s}));var s;const r=A5(t?.controller?.start??{}),a=A5(t?.controller?.pause??{}),o=A5(t?.controller?.backward??{}),l=A5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},M5=(t,e)=>({...k5(t),data:e,type:"continuous"}),C5=(t,e)=>({...k5(t),data:e,type:"discrete"}),T5=t=>"left"===t||"right"===t,E5=t=>"top"===t||"bottom"===t;class P5 extends Y2{layoutZIndex=r$.Player;layoutLevel=a$.Player;static type=un.player;type=un.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return h(i)||!1===i.visible?null:new P5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),b(t.x)){const e=T5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(b(t.y)){const e=E5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{...C5(this._spec,this._specs),...e}:{...M5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new _Y(t):this._playerComponent=new bY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 v(this._spec.width)?Math.min(t.width,Number(this._spec.width)):T5(this._orient)?this._maxSize():t.width}_computeHeight(t){return v(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):E5(this._orient)?this._maxSize():t.height}_computeDx(t){return T5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return E5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size),(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(VX.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnEnd,(()=>{this.event.emit(VX.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];N(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(VX.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const R5=(t,e)=>Tl(t[0].latestData,e.field),B5=(t,e)=>El(t[0].latestData,e.field);function I5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function D5(t,e){return Pl(t[0].latestData,e.field)}function L5(t,e){return Rl(t[0].latestData,e.field)}function O5(t,e){return function(t,e){return Math.sqrt(Rl(t,e))}(t[0].latestData,e.field)}function F5(t,e){return function(t,e){return Z(t.map((t=>t[e])))}(t[0].latestData,e.field)}function z5(t,e){const i={min:R5,max:B5,sum:I5,average:D5,variance:L5,standardDeviation:O5,median:F5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(c(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(c(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function H5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.x)){v(t.x)&&V5(u,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function j5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.y)){v(t.y)&&V5(u,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function N5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();v(t.x)&&V5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),v(t.y)&&V5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function V5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const W5=["sum","average","min","max","variance","standardDeviation","median"];class G5 extends Y2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||W5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??N(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(N(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Tl(t,e),r=El(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Y5 extends G5{static type=un.markLine;type=un.markLine;name=un.markLine;layoutZIndex=r$.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new Y5(i,{...e,specKey:Y5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new Y5(t,{...e,specIndex:i,specKey:Y5.speckey}))})),n}_createMarkerComponent(){const t=new LU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:P$(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:P$(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:P$(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)||c(t.coordinates)&&c(t.process)&&c(t.process.x),a=c(t.y)||c(t.coordinates)&&c(t.process)&&c(t.process.y),o=c(t.coordinates)&&(!c(t.process)||"process"in t&&"xy"in t.process),l=c(t.positions),h=t?.autoRange??!1;let d=[];r?d=H5(e,i,n,s,h)[0]:a?d=j5(e,i,n,s,h)[0]:o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new Vo(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new Vo(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class X5 extends G5{static type=un.markArea;type=un.markArea;name=un.markArea;layoutZIndex=r$.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new X5(i,{...e,specKey:X5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new X5(t,{...e,specIndex:i,specKey:X5.speckey}))})),n}_createMarkerComponent(){const t=new OU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:P$(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)&&c(t.x1),a=c(t.y)&&c(t.y1),o=c(t.coordinates),l=c(t.positions),h=t?.autoRange??!1;let d=[],u=[];r?(u=H5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):a?(u=j5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=c(t.x)&&c(t.x1),n=c(t.y)&&c(t.y1),s=c(t.coordinates);if(!i&&!n&&!s)return null;let r;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new Vo(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class $5 extends G5{static type=un.markPoint;type=un.markPoint;name=un.markPoint;layoutZIndex=r$.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new $5(i,{...e,specKey:$5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new $5(t,{...e,specIndex:i,specKey:$5.speckey}))})),n}_createMarkerComponent(){const t=new FU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:P$(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:P$(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{...P$(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{...P$(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:P$(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=N5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!c(t.coordinate))return;rK(this._option.dataSet,"markerAggregation",z5);const i=this._processSpecCoo(t),n=new Vo(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const K5=(t,e,i)=>h(t)?t:l(t)?t(e,i):t,q5=(t,e,i)=>{if(h(t))return t;if(m(t)){const n=[];return t.forEach((t=>{if(l(t)){const s=t(e,i);c(s)&&n.push(s)}else n.push(t)})),n}return l(t)?t(e,i):t};const Z5=(t,e)=>(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight),J5="vchart-tooltip-container",Q5=20,t4={key:"其他",value:"..."},e4={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class i4{static dom=`${Kj}_TOOLTIP_HANDLER_DOM`;static canvas=`${Kj}_TOOLTIP_HANDLER_CANVAS`}const n4=(t,e,i)=>{const n=K5(e.key,t,i),s=K5(e.value,t,i),r=!1!==K5(e.visible,t,i)&&(c(n)||c(s)),a=K5(e.isKeyAdaptive,t,i),o=K5(e.shapeType,t,i),l=K5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},s4=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,r4=(t,e)=>{let i;if(c(t))if(v(t))i=t;else if(l(t)){const n=t(e);v(n)&&(i=n)}return i},a4=(t,e)=>{const i=b$(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function o4(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Ej,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var l4;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(l4||(l4={}));class h4{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),l4.success):(this._updateTooltip(!1,e),l4.success)}if(h(n)||h(s))return l4.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(c(t.visible)||c(t.activeType)?s.visible=bq(t).includes("mark"):c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=s4(i,"mark")??{},a=L({},R(e.mark),R(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(c))),[]);if(t.every((t=>!bq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=s4(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{l(t)?o.push(t):o.push(...N(t))})),r={...i[0],content:o};let d={};const u=t.filter((t=>{const e=t.tooltipHelper?.spec;return c(e?.dimension)&&bq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(u.length){let t=[];u.every((({content:t})=>h(t)))?t=void 0:u.forEach((({content:e})=>{h(e)||(l(e)?t?.push(e):t?.push(...N(e)))})),d={...u[0],content:t}}a=L({},R(e.dimension),d)}const o=r.title,d={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(c(a.title))if(l(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...d,...n}}}else a.title={...r.title,...d,...a.title};else a.title={...r.title,...d};const u=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),p=N(r.content);if(c(a.content))if(l(a.content)){const t=a.content;a.content=(e,i)=>{const n=N(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...u(p[0]),...t}})),n}}else{const t=N(a.content);t.forEach(((e,i)=>{t[i]={...u(p[0]),...e}}))}else a.content=p.map((t=>({...t,...u(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return l4.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??l4.success;const a=r[n];if(!a)return l4.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),h(o.title?.key)&&h(o.title?.value)&&!o.content?.length?l4.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??l4.success;const o=i[n];if(!o)return l4.failed;const l=this._getActualTooltipPosition(e,q5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),l4.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=v(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...e4,offsetX:t?.x??e4.offsetX,offsetY:t?.y??e4.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=q5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=q5(t.title,e,i),s=N(q5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=Q5}=t,o=!1!==K5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,c(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=K5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=n4(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...t4});break}if(!(r.content.lengthh(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=n4(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...t4});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(h(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),h(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!c(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,u=this._component.getSpec(),p="canvas"===u.renderMode,g=i?.chart?.getCanvasRect(),f=g?.width??qj,m=g?.height??Zj;let y,_,v,x,S,w,A=!1;if(d(e)){const{left:t,right:i,top:n,bottom:s}=e;y=r4(t,r),_=r4(n,r),v=r4(i,r),x=r4(s,r)}else if(c(e)&&"mark"===t.activeType){A=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case H$.left:y=t-a-l,_=(i+c)/2-o/2;break;case H$.right:y=n+l,_=(i+c)/2-o/2;break;case H$.top:y=(t+n)/2-a/2,_=i-o-h;break;case H$.bottom:y=(t+n)/2-a/2,_=c+h;break;case H$.inside:y=(t+n)/2-a/2,_=(i+c)/2-o/2}}}const k={width:0,height:0},M=(t=0)=>({x:t,y:t});let C=M(),T=M(),E=1,P=1;if(Zo(this._env)&&!u.confine){if(k.width=window.innerWidth,k.height=window.innerHeight,!p){T=n.getBoundingClientRect();const t=this._compiler.getCanvas()??this._chartContainer,e=t.getBoundingClientRect();C={x:e.x-T.x,y:e.y-T.y},E=Z5(t,e),P=Z5(n,T)}}else k.width=f,k.height=m;const{canvasX:R,canvasY:B}=r;S=b(y)?y:b(v)?f-a-v:R+l,w=b(_)?_:b(x)?m-o-x:B+h,S*=E,w*=E,Zo(this._env)&&(S+=C.x,w+=C.y),S/=P,w/=P;const{width:I,height:D}=k;return(S+a)*P+T.x>I&&(A?S=(I-T.x)/P-a:S-=2*l+a),(w+o)*P+T.y>D&&(A?w=(D-T.y)/P-o:w-=2*h+o),S*P+T.x<0&&(S=0-T.x/P),w*P+T.y<0&&(w=0-T.y/P),{x:S,y:w}};_getTooltipBoxSize(t,e){return e&&!h(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:m="",hasShape:y,shapeType:_="",shapeHollow:v,shapeColor:b}=h;if(l.title.visible=f,f){const{text:t,width:e,height:i}=a4(m,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},u=e,g=i,y&&WP[_]){const t={symbolType:_};v?t.stroke=b:t.fill=b,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],h=[],d=[];l.content=t.map(((l,u)=>{const g={height:0,spaceRow:i};let f=0;const{hasShape:m,key:y,shapeColor:_,shapeHollow:v,shapeType:b="",value:x,isKeyAdaptive:S}=l;if(c(y)){const{width:t,height:e,text:i}=a4(y,a);g.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},S?h.push(t):n.push(t),f=Math.max(f,e)}if(c(x)){const{width:t,height:e,text:i}=a4(x,o);g.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},d.push(t),f=Math.max(f,e)}if(m&&WP[b]){e=!0;const t={visible:!0,symbolType:b};v?t.stroke=_:t.fill=_,f=Math.max(r.size,f),g.shape=t}else g.shape={visible:!1};return g.height=f,p+=f,uc(t)?m(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function d4(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=L({},e,t),d={};return d.fontFamily=i,d.fontSize=c4(n),d.color=s,d.textAlign=r,d.lineHeight=c4(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=c4(c),d}function u4(t,e){if(!t)return;const{size:i}=L({},e,t),n={};return n.width=c4(i),n}class p4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===p4.type}type=p4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return p4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=qo?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(p4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const g4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},f4={boxSizing:"border-box"},m4={display:"flex",whiteSpace:"nowrap"},y4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},_4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},v4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},b4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},x4={lineHeight:"normal"};class S4 extends p4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!WP[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=WP[e].pathStr;let o="currentColor";if(!n||f(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(d(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class w4 extends p4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class A4 extends p4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=$(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=$(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},y4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=L({},a?v4:_4,{height:c4(i[n].height),...t.keyColumn.item});f(r)&&""!==r?.trim?.()||v(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=L({},b4,{height:c4(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=L({},x4,{height:c4(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class k4 extends p4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new A4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new A4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new A4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(L({},m4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class M4 extends p4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new S4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new w4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(L({},g4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class C4 extends p4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&c(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new M4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new k4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},f4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class T4 extends h4{type=i4.dom;_tooltipContainer=qo?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(qo&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:d,lineWidth:u=0},padding:p,key:g,value:f,title:m,shape:y,enterable:_,spaceRow:v,transitionDuration:b}=t,x=i,S={panel:{width:c4((e?.panel?.width??0)+2*u),height:c4((e?.panel?.height??0)+2*u),paddingBottom:c4(p.bottom),paddingLeft:c4(p.left),paddingRight:c4(p.right),paddingTop:c4(p.top),borderColor:d,borderWidth:c4(u),borderRadius:c4(h),backgroundColor:x?`${x}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:_?"auto":"none",transitionDuration:b?`${b}ms`:"initial",transitionProperty:b?"transform":"initial",transitionTimingFunction:b?"ease-out":"initial"},title:d4(m),content:{},shapeColumn:{item:u4(y),width:c4(y.size),marginRight:c4(y.spacing??8)},keyColumn:{item:d4(g),width:c4(e?.keyWidth),marginRight:c4(g.spacing??26)},valueColumn:{item:d4(f),width:c4(e?.valueWidth),marginRight:c4(f.spacing??0)},spaceRow:c4(v)};if(c(v)){const t=v/2;[S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((e=>{e.marginTop=c4(t),e.marginBottom=e.marginTop})),S.content.marginTop=c4(-t),S.content.marginBottom=S.content.marginTop}else[S.content,S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return S}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class E4 extends h4{type=i4.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new CY({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?c(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class P4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&c(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??l4.success:l4.failed}class R4 extends P4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!xq(t)&&!h(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...X$(r,a)??[],...Z$(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(c(i))break}return c(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class B4 extends P4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const I4=t=>c(t)&&!m(t),D4=t=>c(t)&&m(t);class L4 extends Y2{static type=un.tooltip;type=un.tooltip;name=un.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!m(i))return new L4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new L4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?E4:T4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new B4(this),dimension:new R4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:GX.chart},this._handleMouseMove),(Jo(e)||Qo(e))&&(this._mountEvent("pointerdown",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;Zo(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||xq(t)||(n&&I4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&D4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):c(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!h(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),r};_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};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=L({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!c(t.visible)||t.visible,activeType:bq(t),renderMode:"html",trigger:c(t.trigger)?t.trigger:"hover",className:c(t.className)?t.className:"vchart-tooltip-element",enterable:!!c(t.enterable)&&t.enterable,transitionDuration:c(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=c(t.triggerOff)?t.triggerOff:this._spec.trigger,c(t.renderMode)?this._spec.renderMode=t.renderMode:Qo(this._option.mode)&&(this._spec.renderMode="canvas"),c(t.mark)&&(this._spec.mark={...R(t.mark),activeType:"mark"}),c(t.dimension)&&(this._spec.dimension={...R(t.dimension),activeType:"dimension"}),c(t.parentElement)?f(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Zo(this._option.mode)&&(this._spec.parentElement=qo?.body),c(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=vq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:WX.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(h(this._cacheInfo)||h(t))return!1;if(D4(t)){if(I4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>D$(t,e[i])))}if(D4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(c(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(c(n)&&c(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function O4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function F4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const z4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??O4(e)};let o=!1;return f(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??F4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class H4 extends Y2{static type=un.label;type=un.label;name=un.label;layoutType="absolute";layoutZIndex=r$.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new H4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(VX.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(hV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(hV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Ll(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:R$.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:R$.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{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}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=z4[s.type]??z4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return L({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class j4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(b(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:l(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&c(t.modelId)){if(c(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&c(t.modelKey)&&"modelIndex"in t&&c(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>N4(t))),a=s.filter((t=>!N4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>N4(t))),h=o.filter((t=>!N4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);b(o.width)||(o.width=a.width),b(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function N4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class V4 extends VK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&j$(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&N$(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var W4;W4={},L(xG.poptip,W4),Wk.load(CG),wK.useChart([J1,x2,Q1,t2,L2,S2,A2,k2,I2,E2,n2,O2,v2,b2,M2,N2,V2,r2,a2,C2,R2,B2,F2,i2,z2,H2,e2,D2,m2,P2,y2]),wK.useComponent([V3,G3,U3,$3,X3,Q3,o5,L4,x5,S5,Z2,q2,h5,p5,Y5,c5,X5,P5,H4,$5,Q2,J2,c3]),B$.registerLayout("grid",j4),B$.registerLayout("layout3d",V4),t.Arc3dMark=qJ,t.ArcMark=XJ,t.AreaChart=J1,t.AreaMark=vJ,t.AreaSeries=bJ,t.Bar3dChart=t2,t.Bar3dSeries=gJ,t.BarChart=Q1,t.BarSeries=ZZ,t.BaseChart=sq,t.BaseMark=KK,t.BaseSeries=Lq,t.BoxPlotChart=e2,t.BoxPlotMark=sJ,t.BoxPlotSeries=oJ,t.Brush=Q2,t.CartesianAxis=F3,t.CartesianBandAxis=G3,t.CartesianChart=rq,t.CartesianCrossHair=x5,t.CartesianLinearAxis=V3,t.CartesianSeries=Oq,t.CartesianTimeAxis=U3,t.CellMark=q1,t.CirclePackingChart=i2,t.CirclePackingSeries=T1,t.CircularProgressChart=M2,t.CircularProgressSeries=fQ,t.CommonChart=n2,t.ComponentMark=ZK,t.ContinuousLegend=o5,t.CustomMark=J2,t.DataZoom=Z2,t.DiscreteLegend=Q3,t.DotSeries=cQ,t.Factory=B$,t.Funnel3dChart=a2,t.Funnel3dSeries=N0,t.FunnelChart=r2,t.FunnelSeries=H0,t.GaugeChart=m2,t.GaugePointerSeries=X1,t.GaugeSeries=$1,t.GeoCoordinate=p5,t.GridLayout=j4,t.GroupMark=qK,t.HeatmapChart=y2,t.HeatmapSeries=Z1,t.Histogram3dChart=b2,t.HistogramChart=v2,t.Indicator=h5,t.Label=H4,t.Layout=VK,t.Layout3d=V4,t.LineChart=x2,t.LineMark=dJ,t.LineSeries=uJ,t.LinearProgressChart=C2,t.LinearProgressSeries=yQ,t.LinkPathMark=j1,t.LinkSeries=uQ,t.MapChart=S2,t.MapLabelComponent=c3,t.MapSeries=jJ,t.MarkArea=X5,t.MarkLine=Y5,t.MarkPoint=$5,t.PathMark=OJ,t.Pie3dChart=k2,t.Pie3dSeries=ZJ,t.PieChart=A2,t.PieSeries=KJ,t.Player=P5,t.PolarAxis=Y3,t.PolarBandAxis=$3,t.PolarChart=g2,t.PolarCrossHair=S5,t.PolarLinearAxis=X3,t.PolarSeries=NJ,t.PolygonMark=z0,t.ProgressArcMark=gQ,t.ProgressLikeChart=f2,t.ProgressLikeSeries=pQ,t.Pyramid3dMark=j0,t.RadarChart=E2,t.RadarSeries=aQ,t.RangeAreaChart=P2,t.RangeAreaSeries=SJ,t.RangeColumn3dChart=B2,t.RangeColumn3dSeries=_J,t.RangeColumnChart=R2,t.RangeColumnSeries=yJ,t.Rect3dMark=pJ,t.RectMark=KZ,t.RoseChart=I2,t.RoseLikeChart=T2,t.RoseLikeSeries=sQ,t.RoseSeries=rQ,t.RuleMark=JZ,t.SankeyChart=D2,t.SankeySeries=N1,t.ScatterChart=L2,t.ScatterSeries=nQ,t.ScrollBar=q2,t.SequenceChart=O2,t.SunburstChart=F2,t.SunburstSeries=k1,t.SymbolMark=aJ,t.TextMark=qZ,t.ThemeManager=v$,t.Title=c5,t.Tooltip=L4,t.TreeMapChart=z2,t.TreeMapSeries=Y1,t.VChart=wK,t.WaterfallChart=H2,t.WaterfallSeries=QZ,t.WordCloud3dChart=V2,t.WordCloud3dSeries=S0,t.WordCloudChart=N2,t.WordCloudSeries=x0,t.default=wK,t.version="1.1.1",Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/lark-vchart/CHANGELOG.json b/packages/lark-vchart/CHANGELOG.json index f343864aa7..aa646df434 100644 --- a/packages/lark-vchart/CHANGELOG.json +++ b/packages/lark-vchart/CHANGELOG.json @@ -1,6 +1,12 @@ { "name": "@visactor/lark-vchart", "entries": [ + { + "version": "1.1.1", + "tag": "@visactor/lark-vchart_v1.1.1", + "date": "Fri, 28 Jul 2023 08:52:08 GMT", + "comments": {} + }, { "version": "1.1.0", "tag": "@visactor/lark-vchart_v1.1.0", diff --git a/packages/lark-vchart/CHANGELOG.md b/packages/lark-vchart/CHANGELOG.md index 56a0435b7f..475e2d8247 100644 --- a/packages/lark-vchart/CHANGELOG.md +++ b/packages/lark-vchart/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log - @visactor/lark-vchart -This log was last generated on Wed, 26 Jul 2023 03:18:52 GMT and should not be manually modified. +This log was last generated on Fri, 28 Jul 2023 08:52:08 GMT and should not be manually modified. + +## 1.1.1 +Fri, 28 Jul 2023 08:52:08 GMT + +_Version update only_ ## 1.1.0 Wed, 26 Jul 2023 03:18:52 GMT diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index c1d86aa9dd..0af5fc6bc1 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "1.1.0", + "version": "1.1.1", "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 faa925baed..f02004a875 100644 --- a/packages/lark-vchart/src/vchart/index.js +++ b/packages/lark-vchart/src/vchart/index.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var s={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}]`,o=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||a(t,"Boolean")},l=t=>"function"==typeof t,h=t=>null==t,c=t=>null!=t,d=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},u=t=>"object"==typeof t&&null!==t,p=function(t){if(!u(t)||!a(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},g=t=>void 0===t,f=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||a(t,"String")},m=t=>Array.isArray?Array.isArray(t):a(t,"Array"),y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},_=t=>a(t,"Date"),v=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||a(t,"Number")},b=t=>v(t)&&Number.isFinite(t),x=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),S=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),w=Object.prototype,A=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)},k=Object.prototype.hasOwnProperty;function M(t){if(h(t))return!0;if(y(t))return!t.length;const e=S(t);if("Map"===e||"Set"===e)return!t.size;if(A(t))return!Object.keys(t).length;for(const e in t)if(k.call(t,e))return!1;return!0}const C=(t,e,i)=>{const n=f(e)?e.split("."):e;for(let e=0;enull!=t&&T.call(t,e);function P(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,o){if(null===i)return null;if(0===o)return i;let l;if("object"!=typeof i)return i;if(m(i)?l=[]:a(i,"RegExp")?(l=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(l.lastIndex=i.lastIndex)):l=_(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(l)}for(const e in i)l[e]=t(i[e],o-1);return l}(t,i)}function R(t){let e;if(!c(t)||"object"!=typeof t)return t;const i=m(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:o(t)||v(t)||f(t)?t:_(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=R(n)}return e}function B(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(c(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];c(n[r])&&"object"==typeof n[r]?I(t,e,r,i):D(t,r,n[r])}}}}function I(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(m(r)){if(n)a=[];else if(m(s))a=s;else if(y(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!z(t[i],e[i]))return!1;return!0}if(!p(t))return!1;const i=F(t),n=F(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!z(t[s],e[s]))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;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function G(t,e){if(!m(t)||!m(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Y(t,e,i){c(e)||(e=t,t=0),c(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function $(t){return Number(t)}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function q(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(h(n)&&(n=t.length);i>>1;X(t[s],e)>0?n=s:i=s+1}return i}const Z=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(X)),K(i,.5)},J=Math.sqrt(50),Q=Math.sqrt(10),et=Math.sqrt(2);function it(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=J?s*=10:r>=Q?s*=5:r>=et&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:nt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function at(t,e,i,n){return t>e&&!rt(t,e,i,n)}function ot(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},ht=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?lt(n,r)+s:"center"===i?lt(n,Math.floor(r/2))+s+lt(n,Math.ceil(r/2)):s+lt(n,r)},ct=function(t,e,i){return ti?i:t},dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,p=!0;const g=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function y(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function _(){const t=Date.now();if(y(t))return v(t);o=m(_,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function v(t){return o=void 0,p&&n?f(t):(n=s=void 0,a)}function x(){const t=Date.now(),i=y(t);for(var r=arguments.length,d=new Array(r),p=0;pt*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const _t=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vt=new RegExp(_t.source,"g");const bt=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function xt(t){if(t instanceof Date)return t;if(f(t)){const e=bt.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return h(t)?new Date(NaN):new Date(Math.round(t))}const St=1e-12,wt=Math.PI,At=wt/2,kt=2*wt,Mt=2*Math.PI,Ct=Math.abs,Tt=Math.atan2,Et=Math.cos,Pt=Math.max,Rt=Math.min,Bt=Math.sin,It=Math.sqrt,Dt=Math.pow;function Lt(t){return t>1?0:t<-1?wt:Math.acos(t)}function Ot(t){return t>=1?At:t<=-1?-At:Math.asin(t)}function Ft(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function zt(t,e){return t[0]*e[1]-t[1]*e[0]}class Ht{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ht(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 v(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return v(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 jt{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Ht((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return m(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Nt(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 Wt extends Vt{}function Gt(t){return t*(Math.PI/180)}function Ut(t){return 180*t/Math.PI}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-kt;)t+=kt;else if(t>0)for(;t>kt;)t-=kt;return t},Xt=Yt;function $t(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Kt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new qt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new qt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new qt(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=Ut(r.rotateDeg),r}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return v(t)?new re(t>>16,t>>8&255,255&t,1):m(t)?new re(t[0],t[1],t[2]):new re(255,255,255)}let se=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(c(te[t]))return function(t){return v(t)?new re(t>>>24,t>>>16&255,t>>>8&255,255&t):m(t)?new re(t[0],t[1],t[2],t[3]):new re(255,255,255,1)}(te[t]);if(c(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new re((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new re(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new re(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new re(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new re(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}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}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=Zt(h(t)?s.h:ct(t,0,360),h(e)?s.s:e>=0&&e<=1?100*e:e,h(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new re(r.r,r.g,r.b,n),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}};class re{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)),c(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ae(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new re(e,c,d,l*(1-t)+h*t)}},rgbToHex:oe,rgbToHsl:Jt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ye;function _e(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}function be(t,e,i){return null===t?e:null===e?t:(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,i&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>=fe||de<=ge||ue>=ye||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ye)})}var xe;function Se(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me]),ce>fe||deye||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function ke(t){return t/180*Math.PI}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?t.angle:ke(t.angle),n=Me(t);return[Ae({x:t.x1,y:t.y1},i,n),Ae({x:t.x2,y:t.y1},i,n),Ae({x:t.x2,y:t.y2},i,n),Ae({x:t.x1,y:t.y2},i,n)]}let Te,Ee,Pe,Re;function Be(t){return Te=1/0,Ee=1/0,Pe=-1/0,Re=-1/0,t.forEach((t=>{Te>t.x&&(Te=t.x),Pet.y&&(Ee=t.y),Ree&&r>n||rs?o:0}function Fe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class He{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(),c(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=c(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(h(this._canvas)&&(c(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),h(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&c(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),h(this._context)&&c(this._canvas)){const t=this._canvas.getContext("2d");c(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!h(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(h(t))return{width:0,height:0};if(h(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 c;try{const h=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});c={width:h.width(),height:h.height()}}catch(e){this._notSupportVRender=!0,c=this.measureWithNaiveCanvas(t)}return c}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}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===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(h(this._numberCharSize)){const t=this._standardMethod(He.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/He.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return h(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(He.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(h(this._letterCharSize)){const t=this._standardMethod(He.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/He.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return c(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){c(this._canvas)&&(this._canvas=null),c(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}He.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",He.NUMBERS_CHAR_SET="0123456789",He.FULL_SIZE_CHAR="字";const je="undefined"!=typeof console;function Ne(t,e,i){const n=[e].concat([].slice.call(i));je&&console[t].apply(console,n)}var Ve;!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"}(Ve||(Ve={}));class We{static getInstance(t,e){return We._instance&&v(t)?We._instance.level(t):We._instance||(We._instance=new We(t,e)),We._instance}static setInstance(t){return We._instance=t}static setInstanceLevel(t){We._instance?We._instance.level(t):We._instance=new We(t)}static clearInstance(){We._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Ve.Info}canLogDebug(){return this._level>=Ve.Debug}canLogError(){return this._level>=Ve.Error}canLogWarn(){return this._level>=Ve.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Ve.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):Ne(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Warn&&Ne(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Info&&Ne(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Debug&&Ne(this._method||"log","DEBUG",e),this}}function Ge(t){if(b(t))return[t,t,t,t];if(m(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(d(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 Ue(t){return t?"getUTCFullYear":"getFullYear"}function Ye(t){return t?"getUTCMonth":"getMonth"}function Xe(t){return t?"getUTCDate":"getDate"}function $e(t){return t?"getUTCHours":"getHours"}function Ke(t){return t?"getUTCMinutes":"getMinutes"}function qe(t){return t?"getUTCSeconds":"getSeconds"}function Ze(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Je(t){return t?"setUTCFullYear":"setFullYear"}We._instance=null;const Qe=1e3,ti=6e4,ei=36e5,ii=24*ei,ni=31*ii,si=365*ii,ri=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),ai=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),oi=(t,e)=>e.getFullYear()-t.getFullYear(),li=t=>t.getFullYear(),hi=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),ci=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),di=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),ui=t=>t.getUTCFullYear(),pi=t=>(t.setDate(1),t.setHours(0,0,0,0),t),gi=(t,e)=>(t.setMonth(t.getMonth()+e),t),fi=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),mi=t=>t.getMonth(),yi=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),_i=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),vi=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),bi=t=>t.getUTCMonth(),xi=t=>(t.setHours(0,0,0,0),t),Si=(t,e)=>(t.setDate(t.getDate()+e),t),wi=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ii,Ai=t=>t.getDate()-1,ki=t=>(t.setUTCHours(0,0,0,0),t),Mi=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Ci=(t,e)=>(+e-+t)/ii,Ti=t=>t.getUTCDate()-1,Ei=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),Pi=(t,e)=>(t.setHours(t.getHours()+e),t),Ri=(t,e)=>(+e-+t)/ei,Bi=t=>t.getHours(),Ii=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),Di=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Li=t=>t.getUTCHours(),Oi=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),Fi=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),zi=(t,e)=>(+e-+t)/6e4,Hi=t=>t.getMinutes(),ji=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),Ni=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Vi=t=>t.getUTCMinutes(),Wi=t=>(t.setTime(+t-t.getMilliseconds()),t),Gi=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ui=(t,e)=>(+e-+t)/1e3,Yi=t=>t.getSeconds(),Xi=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),$i=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ki=t=>t.getUTCSeconds(),qi=t=>t,Zi=(t,e)=>(t.setTime(+t+e),t),Ji=(t,e)=>+e-+t,Qi=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},tn=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Qi(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Qi(h,c)}};function en(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function nn(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var sn=6371008.8,rn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*sn,kilometers:6371.0088,kilometres:6371.0088,meters:sn,metres:sn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:sn/1852,radians:1,yards:6967335.223679999};function an(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function on(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ln(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function hn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Gt(t[0]),r=Gt(t[1]),a=Gt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=rn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Ut(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Ut(l)}}const cn=t=>t;var dn,un;t.RenderModeEnum=void 0,(dn=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",dn["mobile-browser"]="mobile-browser",dn.node="node",dn.worker="worker",dn.miniApp="miniApp",dn["desktop-miniApp"]="desktop-miniApp",dn.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(un||(un={}));for(let t=0;t<256;t++)t.toString(16);const pn=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};function gn(){return new fn}function fn(){this.reset()}fn.prototype={constructor:fn,reset:function(){this.s=this.t=0},add:function(t){yn(mn,t,this.t),yn(this,mn.s,this.s),this.s?this.t+=mn.t:this.s=mn.t},valueOf:function(){return this.s}};var mn=new fn;function yn(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var _n=1e-6,vn=Math.PI,bn=vn/2,xn=vn/4,Sn=2*vn,wn=180/vn,An=vn/180,kn=Math.abs,Mn=Math.atan,Cn=Math.atan2,Tn=Math.cos,En=Math.exp,Pn=Math.log,Rn=Math.pow,Bn=Math.sin,In=Math.sign||function(t){return t>0?1:t<0?-1:0},Dn=Math.sqrt,Ln=Math.tan;function On(t){return t>1?0:t<-1?vn:Math.acos(t)}function Fn(t){return t>1?bn:t<-1?-bn:Math.asin(t)}function zn(){}function Hn(t,e){t&&Nn.hasOwnProperty(t.type)&&Nn[t.type](t,e)}var jn={Feature:function(t,e){Hn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nvn?t+Math.round(-t/Sn)*Sn:t,e]}function ts(t,e,i){return(t%=Sn)?e||i?Jn(is(t),ns(e,i)):is(t):e||i?ns(e,i):Qn}function es(t){return function(e,i){return[(e+=t)>vn?e-Sn:e<-vn?e+Sn:e,i]}}function is(t){var e=es(t);return e.invert=es(-t),e}function ns(t,e){var i=Tn(t),n=Bn(t),s=Tn(e),r=Bn(e);function a(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*i+o*n;return[Cn(l*s-c*r,o*i-h*n),Fn(c*s+l*r)]}return a.invert=function(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*s-l*r;return[Cn(l*s+h*r,o*i+c*n),Fn(c*i-o*n)]},a}function ss(t,e){(e=Yn(e))[0]-=t,Zn(e);var i=On(-e[1]);return((-e[2]<0?-i:i)+Sn-_n)%Sn}function rs(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:zn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function as(t,e){return kn(t[0]-e[0])<_n&&kn(t[1]-e[1])<_n}function os(t,e,i,n){this.x=t,this.z=e,this.o=i,this.e=n,this.v=!1,this.n=this.p=null}function ls(t,e,i,n,s){var r,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,i,n=t[0],a=t[e];if(as(n,a)){if(!n[2]&&!a[2]){for(s.lineStart(),r=0;r=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function hs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function ps(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function gs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=rs(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=y,u.lineStart=_,u.lineEnd=v,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=ps(a);var t=function(t,e){var i=ds(e),n=e[1],s=Bn(n),r=[Bn(i),-Tn(i),0],a=0,o=0;cs.reset(),1===s?n=bn+_n:-1===s&&(n=-bn-_n);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>vn,C=f*x;if(cs.add(Cn(C*A*Bn(k),m*S+C*Tn(k))),a+=M?w+A*Sn:w,M^p>=i^v>=i){var T=$n(Yn(u),Yn(_));Zn(T);var E=$n(r,T);Zn(E);var P=(M^w>=0?-1:1)*Fn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-_n||a<_n&&cs<-_n)^1&o}(r,n);a.length?(d||(s.polygonStart(),d=!0),ls(a,ms,t,i,s)):t&&(d||(s.polygonStart(),d=!0),s.lineStart(),i(null,null,1,s),s.lineEnd()),d&&(s.polygonEnd(),d=!1),a=r=null},sphere:function(){s.polygonStart(),s.lineStart(),i(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function p(e,i){t(e,i)&&s.point(e,i)}function g(t,e){l.point(t,e)}function f(){u.point=g,l.lineStart()}function m(){u.point=p,l.lineEnd()}function y(t,e){o.push([t,e]),c.point(t,e)}function _(){c.lineStart(),o=[]}function v(){y(o[0][0],o[0][1]),c.lineEnd();var t,e,i,n,l=c.clean(),u=h.result(),p=u.length;if(o.pop(),r.push(o),o=null,p)if(1&l){if((e=(i=u[0]).length-1)>0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(fs))}return u}}function fs(t){return t.length>1}function ms(t,e){return((t=t.x)[0]<0?t[1]-bn-_n:bn-t[1])-((e=e.x)[0]<0?e[1]-bn-_n:bn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return us(e(t),i)})}(us);var ys=gs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?vn:-vn,l=kn(r-i);kn(l-vn)<_n?(t.point(i,n=(n+a)/2>0?bn:-bn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=vn&&(kn(i-s)<_n&&(i-=s*_n),kn(r-o)<_n&&(r-=o*_n),n=function(t,e,i,n){var s,r,a=Bn(t-i);return kn(a)>_n?Mn((Bn(e)*(r=Tn(n))*Bn(i)-Bn(n)*(s=Tn(e))*Bn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*bn,n.point(-vn,s),n.point(0,s),n.point(vn,s),n.point(vn,0),n.point(vn,-s),n.point(0,-s),n.point(-vn,-s),n.point(-vn,0),n.point(-vn,s);else if(kn(t[0]-e[0])>_n){var r=t[0]0,s=kn(e)>_n;function r(t,i){return Tn(t)*Tn(i)>e}function a(t,i,n){var s=[1,0,0],r=$n(Yn(t),Yn(i)),a=Xn(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=$n(s,r),u=qn(s,h);Kn(u,qn(r,c));var p=d,g=Xn(u,p),f=Xn(p,p),m=g*g-f*(Xn(u,u)-1);if(!(m<0)){var y=Dn(m),_=qn(p,(-g-y)/f);if(Kn(_,u),_=Un(_),!n)return _;var v,b=t[0],x=i[0],S=t[1],w=i[1];x0^_[1]<(kn(_[0]-b)<_n?S:w):S<=_[1]&&_[1]<=w:A>vn^(b<=_[0]&&_[0]<=x)){var M=qn(p,(-g+y)/f);return Kn(M,u),[_,Un(M)]}}}function o(e,i){var s=n?t:vn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return gs(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=n?f?0:o(d,u):f?o(d+(d<0?vn:-vn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||as(e,p)||as(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(s&&e&&n^f){var y;m&i||!(y=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!f||e&&as(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Tn(e),o=Bn(e),l=n*i;null==s?(s=e+n*Sn,r=e-l/2):(s=ss(a,s),r=ss(a,r),(n>0?sr)&&(s+=n*Sn));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return kn(n[0]-t)<_n?s>0?0:3:kn(n[0]-i)<_n?s>0?2:1:kn(n[1]-e)<_n?s>0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,y,_,v=a,b=rs(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);y=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,s=(l=ps(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&ls(l,o,e,r,a),a.polygonEnd());v=a,l=h=c=null}};function S(t,e){s(t,e)&&v.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),y)d=r,u=a,p=o,y=!1,o&&(v.lineStart(),v.point(r,a));else if(o&&m)v.point(r,a);else{var l=[g=Math.max(bs,Math.min(vs,g)),f=Math.max(bs,Math.min(vs,f))],b=[r=Math.max(bs,Math.min(vs,r)),a=Math.max(bs,Math.min(vs,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(v.lineStart(),v.point(r,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),o||v.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ss(t){return t}var ws,As,ks,Ms,Cs=gn(),Ts=gn(),Es={point:zn,lineStart:zn,lineEnd:zn,polygonStart:function(){Es.lineStart=Ps,Es.lineEnd=Is},polygonEnd:function(){Es.lineStart=Es.lineEnd=Es.point=zn,Cs.add(kn(Ts)),Ts.reset()},result:function(){var t=Cs/2;return Cs.reset(),t}};function Ps(){Es.point=Rs}function Rs(t,e){Es.point=Bs,ws=ks=t,As=Ms=e}function Bs(t,e){Ts.add(Ms*t-ks*e),ks=t,Ms=e}function Is(){Bs(ws,As)}var Ds=Es,Ls=1/0,Os=Ls,Fs=-Ls,zs=Fs,Hs={point:function(t,e){tFs&&(Fs=t);ezs&&(zs=e)},lineStart:zn,lineEnd:zn,polygonStart:zn,polygonEnd:zn,result:function(){var t=[[Ls,Os],[Fs,zs]];return Fs=zs=-(Os=Ls=1/0),t}};var js,Ns,Vs,Ws,Gs=Hs,Us=0,Ys=0,Xs=0,$s=0,Ks=0,qs=0,Zs=0,Js=0,Qs=0,tr={point:er,lineStart:ir,lineEnd:rr,polygonStart:function(){tr.lineStart=ar,tr.lineEnd=or},polygonEnd:function(){tr.point=er,tr.lineStart=ir,tr.lineEnd=rr},result:function(){var t=Qs?[Zs/Qs,Js/Qs]:qs?[$s/qs,Ks/qs]:Xs?[Us/Xs,Ys/Xs]:[NaN,NaN];return Us=Ys=Xs=$s=Ks=qs=Zs=Js=Qs=0,t}};function er(t,e){Us+=t,Ys+=e,++Xs}function ir(){tr.point=nr}function nr(t,e){tr.point=sr,er(Vs=t,Ws=e)}function sr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,er(Vs=t,Ws=e)}function rr(){tr.point=er}function ar(){tr.point=lr}function or(){hr(js,Ns)}function lr(t,e){tr.point=hr,er(js=Vs=t,Ns=Ws=e)}function hr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,Zs+=(s=Ws*t-Vs*e)*(Vs+t),Js+=s*(Ws+e),Qs+=3*s,er(Vs=t,Ws=e)}var cr=tr;function dr(t){this._context=t}dr.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,Sn)}},result:zn};var ur,pr,gr,fr,mr,yr=gn(),_r={point:zn,lineStart:function(){_r.point=vr},lineEnd:function(){ur&&br(pr,gr),_r.point=zn},polygonStart:function(){ur=!0},polygonEnd:function(){ur=null},result:function(){var t=+yr;return yr.reset(),t}};function vr(t,e){_r.point=br,pr=fr=t,gr=mr=e}function br(t,e){fr-=t,mr-=e,yr.add(Dn(fr*fr+mr*mr)),fr=t,mr=e}var xr=_r;function Sr(){this._string=[]}function wr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ar(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Gn(t,i(n))),n.result()}return r.area=function(t){return Gn(t,i(Ds)),Ds.result()},r.measure=function(t){return Gn(t,i(xr)),xr.result()},r.bounds=function(t){return Gn(t,i(Gs)),Gs.result()},r.centroid=function(t){return Gn(t,i(cr)),cr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ss):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Sr):new dr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function kr(t){return function(e){var i=new Mr;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Mr(){}function Cr(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Gn(i,t.stream(Gs)),e(Gs.result()),null!=n&&t.clipExtent(n),t}function Tr(t,e,i){return Cr(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Er(t,e,i){return Tr(t,[[0,0],e],i)}function Pr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Rr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Sr.prototype={_radius:4.5,_circle:wr(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=wr(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}},Mr.prototype={constructor:Mr,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 Br=16,Ir=Tn(30*An);function Dr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,m){var y=h-n,_=c-s,v=y*y+_*_;if(v>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Dn(b*b+x*x+S*S),A=Fn(S/=w),k=kn(kn(S)-1)<_n||kn(r-d)<_n?(r+d)/2:Cn(x,b),M=t(k,A),C=M[0],T=M[1],E=C-n,P=T-s,R=_*E-y*P;(R*R/v>e||kn((y*E+_*P)/v-.5)>.3||a*u+o*p+l*g2?t[2]%360*An:0,E()):[m*wn,y*wn,_*wn]},C.angle=function(t){return arguments.length?(v=t%360*An,E()):v*wn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Dr(o,M=t*t),P()):Dn(M)},C.fitExtent=function(t,e){return Tr(C,t,e)},C.fitSize=function(t,e){return Er(C,t,e)},C.fitWidth=function(t,e){return Pr(C,t,e)},C.fitHeight=function(t,e){return Rr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function jr(t){var e=0,i=vn/3,n=Hr(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*An,i=t[1]*An):[e*wn,i*wn]},s}function Nr(t,e){var i=Bn(t),n=(i+Bn(e))/2;if(kn(n)<_n)return function(t){var e=Tn(t);function i(t,i){return[t*e,Bn(i)/e]}return i.invert=function(t,i){return[t/e,Fn(i*e)]},i}(t);var s=1+i*(2*n-i),r=Dn(s)/n;function a(t,e){var i=Dn(s-2*n*Bn(e))/n;return[i*Bn(t*=n),r-i*Tn(t)]}return a.invert=function(t,e){var i=r-e,a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,Fn((s-(t*t+i*i)*n*n)/(2*n))]},a}function Vr(){return jr(Nr).scale(155.424).center([0,33.6442])}function Wr(){return Vr().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Gr(t){return function(e,i){var n=Tn(e),s=Tn(i),r=t(n*s);return[r*s*Bn(e),r*Bn(i)]}}function Ur(t){return function(e,i){var n=Dn(e*e+i*i),s=t(n),r=Bn(s),a=Tn(s);return[Cn(e*r,n*a),Fn(n&&i*r/n)]}}var Yr=Gr((function(t){return Dn(2/(1+t))}));Yr.invert=Ur((function(t){return 2*Fn(t/2)}));var Xr=Gr((function(t){return(t=On(t))&&t/Bn(t)}));function $r(t,e){return[t,Pn(Ln((bn+e)/2))]}function Kr(){return qr($r).scale(961/Sn)}function qr(t){var e,i,n,s=zr(t),r=s.center,a=s.scale,o=s.translate,l=s.clipExtent,h=null;function c(){var r=vn*a(),o=s(function(t){function e(e){return(e=t(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e}return t=ts(t[0]*An,t[1]*An,t.length>2?t[2]*An:0),e.invert=function(e){return(e=t.invert(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e},e}(s.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),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function Zr(t){return Ln((bn+t)/2)}function Jr(t,e){var i=Tn(t),n=t===e?Bn(t):Pn(i/Tn(e))/Pn(Zr(e)/Zr(t)),s=i*Rn(Zr(t),n)/n;if(!n)return $r;function r(t,e){s>0?e<-bn+_n&&(e=-bn+_n):e>bn-_n&&(e=bn-_n);var i=s/Rn(Zr(e),n);return[i*Bn(n*t),s-i*Tn(n*t)]}return r.invert=function(t,e){var i=s-e,r=In(n)*Dn(t*t+i*i),a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,2*Mn(Rn(s/r,1/n))-bn]},r}function Qr(t,e){return[t,e]}function ta(t,e){var i=Tn(t),n=t===e?Bn(t):(i-Tn(e))/(e-t),s=i/n+t;if(kn(n)<_n)return Qr;function r(t,e){var i=s-e,r=n*t;return[i*Bn(r),s-i*Tn(r)]}return r.invert=function(t,e){var i=s-e,r=Cn(t,kn(i))*In(i);return i*n<0&&(r-=vn*In(t)*In(i)),[r/n,s-In(n)*Dn(t*t+i*i)]},r}Xr.invert=Ur((function(t){return t})),$r.invert=function(t,e){return[t,2*Mn(En(e))-bn]},Qr.invert=Qr;var ea=1.340264,ia=-.081106,na=893e-6,sa=.003796,ra=Dn(3)/2;function aa(t,e){var i=Fn(ra*Bn(e)),n=i*i,s=n*n*n;return[t*Tn(i)/(ra*(ea+3*ia*n+s*(7*na+9*sa*n))),i*(ea+ia*n+s*(na+sa*n))]}function oa(t,e){var i=Tn(e),n=Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function la(t,e){var i=e*e,n=i*i;return[t*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791)),e*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))]}function ha(t,e){return[Tn(e)*Bn(t),Bn(e)]}function ca(t,e){var i=Tn(e),n=1+Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function da(t,e){return[Pn(Ln((bn+e)/2)),-t]}aa.invert=function(t,e){for(var i,n=e,s=n*n,r=s*s*s,a=0;a<12&&(r=(s=(n-=i=(n*(ea+ia*s+r*(na+sa*s))-e)/(ea+3*ia*s+r*(7*na+9*sa*s)))*n)*s*s,!(kn(i)<1e-12));++a);return[ra*t*(ea+3*ia*s+r*(7*na+9*sa*s))/Tn(n),Fn(Bn(n)/ra)]},oa.invert=Ur(Mn),la.invert=function(t,e){var i,n=e,s=25;do{var r=n*n,a=r*r;n-=i=(n*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))-e)/(1.007226+r*(.045255+a*(.259866*r-.311325-.005916*11*a)))}while(kn(i)>_n&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ha.invert=Ur(Fn),ca.invert=Ur((function(t){return 2*Mn(t)})),da.invert=function(t,e){return[-e,2*Mn(En(t))-bn]},Kr().translate([0,0]).center([0,0]).scale(63781);var ua=Object.prototype.hasOwnProperty;function pa(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^ya[2]^ya[3])}function va(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=pa(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return _a(r[t])}function S(t,e){return ga(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=Sa(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ia(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Da(t,e)}))}:Da(t,e)}function Da(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=La(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function La(t,e){var i=Ra(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function Ha(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Ba(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=ja(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=Ya(t.slice(0,n),e),o=Ya(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Xa=Ya;!function(t){var e=Xa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=Ka(Ja,e),{tolerance:n}=i;return $a(t,n)};var to;!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"}(to||(to={}));const eo=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},io=(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.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?"+"+oo(e,6):oo(e,4))+"-"+oo(t.getUTCMonth()+1,2)+"-"+oo(t.getUTCDate(),2)+(r?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"."+oo(r,3)+"Z":s?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"Z":n||i?"T"+oo(i,2)+":"+oo(n,2)+"Z":"")}function ho(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 so;if(h)return h=!1,no;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.DSV;const i=Ka(po,e),{delimiter:n}=i;if(!f(n))throw new TypeError("Invalid delimiter: must be a string!");return ho(n).parse(t)},fo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,co(t)},mo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,uo(t)};function yo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return _o(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 _o(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return bo(t);default:throw new Error("unknown GeoJSON type")}}function _o(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=vo(t.properties),e.geometry=bo(t.geometry),e}function vo(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=vo(n):e[i]=n})),e):e}function bo(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return bo(t)})),e):(e.coordinates=xo(t.coordinates),e)}function xo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return xo(t)}))}function So(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 wo(t){for(var e,i,n=So(t),s=0,r=1;r0}function Ao(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=yo(t));var r=[];switch(t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,n)})),t;case"FeatureCollection":return Ao(t,(function(t){Ao(Co(t,n),(function(t){r.push(t)}))})),on(r)}return Co(t,n)}function Co(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,e)})),t;case"LineString":return To(So(t),e),t;case"Polygon":return Eo(So(t),e),t;case"MultiLineString":return So(t).forEach((function(t){To(t,e)})),t;case"MultiPolygon":return So(t).forEach((function(t){Eo(t,e)})),t;case"Point":case"MultiPoint":return t}}function To(t,e){wo(t)===e&&t.reverse()}function Eo(t,e){wo(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Po(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Do=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.GEO;const i=Ka(Bo,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Io(t))})):e.push(Io(t))})),e})(t);let o=t.features;return a&&(o=Mo(t,{reverse:!d(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Ro.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Ro.bounds(t);t.bbox=e}})),t.features=o,t},Lo={},Oo=(t,e,i)=>{i.type=to.GEO;const n=Ka(Bo,Lo,e),{object:s}=n;if(!f(s))throw new TypeError("Invalid object: must be a string!");const r=Ia(t,t.objects[s]);return Do(r,n,i)},Fo=(t,e,i)=>{const n=!o(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!m(t))throw new TypeError("Invalid data: must be DataView array!");return m(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 zo=0;function Ho(){return zo>1e8&&(zo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+zo++}class jo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new r,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Ho("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){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){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const No="_data-view-diff-rank";class Vo{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new r,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Ho("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",io),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=R(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[No]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[No]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[No][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);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};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};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};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};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};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};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};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};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};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};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};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};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};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};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};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=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));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Go(t,e){const i=new Set(N(t)),n=new Set(N(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Uo}=le,Yo=(t,e)=>(l($o.warnHandler)&&$o.warnHandler.call(null,t,e),e?We.getInstance().warn(`[VChart warn]: ${t}`,e):We.getInstance().warn(`[VChart warn]: ${t}`)),Xo=(t,e,i)=>{const n=new Error(t);return We.getInstance().error(`[VChart error]: ${n}`,e)},$o={silent:!1,warnHandler:!1,errorHandler:!1},Ko="undefined"!=typeof window&&void 0!==window.document,qo=Ko&&globalThis.document;function Zo(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ko}function Jo(t){return"miniApp"===t||"mobile-browser"===t}function Qo(t){return t.includes("miniApp")||"lynx"===t}let tl=0;function el(){return tl>=9999999&&(tl=0),tl++}function il(t){return!h(t)&&(!!v(t)||+t==+t)}function nl(t){return!(!t||0===t.length)&&(!h(t[0])&&!h(t[0].dataId)&&m(t[0].fields))}const sl=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const rl=t=>e=>C(e,t),al=t=>{We.getInstance().error(t)},ol=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||al("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&al("Access path missing closing bracket: "+t),a&&al("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return sl((i&&i.get||rl)(n),[s],e||s)},ll=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m(t)){const n=t.map((t=>ol(t,e,i)));return t=>n.map((e=>e(t)))}return ol(t,e,i)};ll("id");const hl=sl((function(t){return t}),[],"identity"),cl=sl((function(){return 0}),[],"zero");sl((function(){return 1}),[],"one"),sl((function(){return!0}),[],"true"),sl((function(){return!1}),[],"false"),sl((function(){return{}}),[],"emptyObject");const dl=(t,e)=>{if((te||h(e))&&!h(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},ul=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>dl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=N(e)||[],s=[],r=[],a={},o=i.comparator||ul;return N(t).forEach(((t,e)=>{if(h(t))return;s.push("desc"===n[e]?-1:1);const o=l(t)?t:ll(t,null,i);var c;r.push(o),(c=o,(h(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:sl(o(r,s),Object.keys(a))},gl=(t,e)=>{const i=l(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(h(e)||h(i))return h(e)&&h(i);if(!u(e)&&!u(i))return e===i;const s=m(e)?e:e[t],r=m(i)?i:i[t];return s===r||!1!==n&&(m(r)?!(!m(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!d(r)&&!(!d(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>fl(t,r,s)))))},ml=(t,e)=>h(t)?e:Math.min(f(t)?e*parseFloat(t)/100:t,e);function yl(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!h(s)&&(s=+s)>=s&&!h(r)&&(r=+r)>=r&&n(s,r,++a)}))}function _l(t,e,i,n,s){let r=0,a=0;return yl(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function vl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;yl(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:_l(t,e,i,s,h)}}const bl=rt;function xl(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Sl=t=>b(t)?Gt(t):null,wl=t=>b(t)?Ut(t):null;function Al(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function kl(t,e,i,n){const s=Al({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function Ml(t){return 3===t||4===t}function Cl(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)}function Tl(t,e){const i=e?+t[0][e]:+t[0];if(!b(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&n{const n=e?+i[e]:+i;return b(n)&&n>t&&(t=n),t}),i)}function Pl(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;b(s)&&(i+=s,n++)}));return i/n}function Rl(t,e){const i=Pl(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Bl(t){let e="center",i="middle";return e=(t=xl(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}}function Il(t,e){const i=Dl(t),n=Dl(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 Dl(t,e={x:0,y:0}){return jt.distancePP(t,e)}function Ll(t,e,i){let n=!1;if(e&&l(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 Ol(t){return function(e){let i;return i=m(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var Fl;function zl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:return!0;default:return!1}}function Hl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}function jl(t){switch(t){case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}!function(t){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"}(Fl||(Fl={}));class Nl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Vl=Symbol("implicit");class Wl extends Nl{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=Fl.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Vl}clone(){return(new Wl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!h(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==Vl)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Yl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),Xl=t=>t<0?-t*t:t*t,$l=t=>-Math.log(-t),Kl=t=>-Math.exp(-t),ql=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Zl=t=>10===t?ql:t===Math.E?Math.exp:e=>Math.pow(t,e),Jl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Ql=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),th=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function eh(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 ih(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function nh(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class ah extends Wl{constructor(t){super(),this.type=Fl.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Y(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&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=[$(t[0]),$(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[$(t[0]),$(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:rh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}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()}clone(){return new ah(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:oh}=le;function lh(t,e){const i=typeof e;let n;if(h(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=se.parseColorString(e)){const e=oh(se.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof re?oh(t,e):e instanceof se?oh(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class hh extends Nl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Gl,this._piecewise=ih,this._interpolate=lh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,$);return this._domain=i,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){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=ut(this._domain[0],this._domain[n-1])),this._piecewise=n>2?nh:ih,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Gl),this.rescale(i)):this._clamp!==Gl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ch=Math.sqrt(50),dh=Math.sqrt(10),uh=Math.sqrt(2);function ph(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=ch?a=10:r>=dh?a=5:r>=uh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function fh(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=gh(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class _h extends hh{constructor(){super(...arguments),this.type=Fl.Linear}clone(){return(new _h).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function vh(t){return e=>-t(-e)}class bh extends hh{constructor(){super(Jl(10),Zl(10)),this.type=Fl.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new bh).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){if(t)return this;super.rescale();const e=Jl(this._base),i=Zl(this._base);return this._domain[0]<0?(this._logs=vh(e),this._pows=vh(i),this.transformer=$l,this.untransformer=Kl):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Gl}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.lengththis._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}}class xh extends ah{constructor(t){super(!1),this.type=Fl.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class Sh extends _h{constructor(){super(),this.type=Fl.Pow,this._exponent=1}clone(){return(new Sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=Gl,this.untransformer=Gl):.5===this._exponent?(this.transformer=Yl,this.untransformer=Xl):(this.transformer=Ul(this._exponent),this.untransformer=Ul(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function wh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class Ah{constructor(){this.type=Fl.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return wh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new kh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class Mh extends _h{constructor(){super(Yl,Xl),this.type=Fl.Sqrt}clone(){return(new Mh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Ch extends _h{constructor(){super(Ql(1),th(1)),this.type=Fl.Symlog,this._const=1}clone(){return(new Ch).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=Ql(t),this.untransformer=th(t),this.rescale(e)):this._const}}class Th{constructor(){this.type=Fl.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!h(t)&&b(+t)?this._range[q(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 Th).domain(this._domain).range(this._range).unknown(this._unknown)}}const Eh=[["second",1,Qe],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,ti],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,ei],["hour",3,3*ei],["hour",6,6*ei],["hour",12,12*ei],["day",1,ii],["day",2,2*ii],["day",7,7*ii],["month",1,ni],["month",3,3*ni],["month",6,6*ni],["year",1,365*ii]];function Ph(t){return+xt(t)}function Rh(t,e,i,n){const s=(+e-+t)/i,r=q(Eh.map((t=>t[2])),s);if(r===Eh.length){const s=Math.max(it(+t/si,+e/si,i),1),r=t=>(t[Je(n)](Math.floor(t[Ue(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Je(n)](t[Ue(n)]()+e*s),t);return{floor:r,offset:a,ceil:Qi(r,a)}}if(0===r){const n=Math.max(it(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Qi(s,r)}}const[a,o]=Eh[s/Eh[r-1][2]"year"===t&&e?{floor:hi,offset:ci,count:di,field:ui}:"month"===t&&e?{floor:yi,offset:_i,count:vi,field:bi}:"day"===t&&e?{floor:ki,offset:Mi,count:Ci,field:Ti}:"hour"===t&&e?{floor:Ii,offset:Di,count:Ri,field:Li}:"minute"===t&&e?{floor:ji,offset:Ni,count:zi,field:Vi}:"second"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"year"===t?{floor:ri,offset:ai,count:oi,field:li}:"month"===t?{floor:pi,offset:gi,count:fi,field:mi}:"day"===t?{floor:xi,offset:Si,count:wi,field:Ai}:"hour"===t?{floor:Ei,offset:Pi,count:Ri,field:Bi}:"minute"===t?{floor:Oi,offset:Fi,count:zi,field:Hi}:"second"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:{floor:qi,offset:Zi,count:Ji})(a,n);return tn(o,l)}class Bh extends hh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=Fl.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(xt);const i=Array.from(t,Ph);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=xt(t),s=e[Ue(n)](),r=e[Ye(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Xe(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[$e(n)](),c=(h-1)%12+1,d=e[Ke(n)](),u=e[qe(n)](),p=e[Ze(n)]();return(i||"").replace(/YYYY/g,ht(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,ht(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,ht(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,ht(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,ht(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,ht(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,ht(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,ht(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Bh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(v(t)||h(t))&&(i=Rh(e[0],e[e.length-1],h(t)?10:t,this._isUtc)),i&&this.domain(sh(e,i)),this}utc(){return this._isUtc}}function Ih(t,e){const i=c(e)?t?.[e]??t?.default:t?.default;if(!i||m(i))return i;if(d(i)){const{dataScheme:n}=i;return n?zh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c)}))):n.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c):[]}return[]}function Dh(t,e){return zh(t)?t.find((t=>c(t.isAvailable)?l(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!c(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function Lh(t,e,i){const n=c(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!c(e.a)&&!c(e.l)||!f(s))return s;let r=new Uo(s);if(c(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Jt(t,i,n),o=Zt(s,a,e.l),l=new Uo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return c(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Oh=(t,e,i)=>{if(Fh(t)&&e){const n=Lh(e,t,i);if(n)return n}return t};function Fh(t){return d(t)&&"palette"===t.type&&!!t.key}function zh(t){return!!m(t)&&t.every((t=>c(t.scheme)))}class Hh extends Wl{_range;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(!zh(this._range))return void super.range(this._range);const t=Dh(this._range,this._domain);super.range(t)}}const jh={linear:_h,band:ah,point:xh,ordinal:Wl,threshold:Th,colorOrdinal:Hh};function Nh(t){const e=jh[t];return e?new e:null}function Vh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Wh(t){return c(t?.field)&&c(t?.scale)}var Gh;function Uh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Yh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Xh(t){return!!f(t)&&(!!t.endsWith("%")&&il(t.substring(0,t.length-1)))}function $h(t,e,i){return v(t)?t:Xh(t)?Number(t.substring(0,t.length-1))*e/100:l(t)?t(i):0}function Kh(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>v(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=$h(t[s],e.size,i)}))})),n}function qh(t){let e={};return m(t)?(h(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),h(t[1])||(e.left=e.right=t[1]),h(t[2])||(e.bottom=t[2]),h(t[3])||(e.left=t[3]),e):v(t)||Xh(t)||l(t)?(e.top=e.left=e.bottom=e.right=t,e):(d(t)&&(e={...t}),e)}function Zh(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function Jh(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]=Jh(t[n],e)}return i}return m(t)?t.map((t=>Jh(t,e))):t}function Qh(t){const e=t;let i;if(!c(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof Vo||e.every((t=>i.includes(t)))}(e))return e;const n=m(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:o(e)||v(e)||f(e)?e:_(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=Qh(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(Gh||(Gh={}));var tc=function(t){return t&&t.Math==Math&&t},ec=tc("object"==typeof globalThis&&globalThis)||tc("object"==typeof window&&window)||tc("object"==typeof self&&self)||tc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),ic={},nc=function(t){try{return!!t()}catch(t){return!0}},sc=!nc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),rc=!nc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),ac=rc,oc=Function.prototype.call,lc=ac?oc.bind(oc):function(){return oc.apply(oc,arguments)},hc={},cc={}.propertyIsEnumerable,dc=Object.getOwnPropertyDescriptor,uc=dc&&!cc.call({1:2},1);hc.f=uc?function(t){var e=dc(this,t);return!!e&&e.enumerable}:cc;var pc,gc,fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},mc=rc,yc=Function.prototype,_c=yc.call,vc=mc&&yc.bind.bind(_c,_c),bc=mc?vc:function(t){return function(){return _c.apply(t,arguments)}},xc=bc,Sc=xc({}.toString),wc=xc("".slice),Ac=function(t){return wc(Sc(t),8,-1)},kc=nc,Mc=Ac,Cc=Object,Tc=bc("".split),Ec=kc((function(){return!Cc("z").propertyIsEnumerable(0)}))?function(t){return"String"==Mc(t)?Tc(t,""):Cc(t)}:Cc,Pc=function(t){return null==t},Rc=Pc,Bc=TypeError,Ic=function(t){if(Rc(t))throw Bc("Can't call method on "+t);return t},Dc=Ec,Lc=Ic,Oc=function(t){return Dc(Lc(t))},Fc="object"==typeof document&&document.all,zc={all:Fc,IS_HTMLDDA:void 0===Fc&&void 0!==Fc},Hc=zc.all,jc=zc.IS_HTMLDDA?function(t){return"function"==typeof t||t===Hc}:function(t){return"function"==typeof t},Nc=jc,Vc=zc.all,Wc=zc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Nc(t)||t===Vc}:function(t){return"object"==typeof t?null!==t:Nc(t)},Gc=ec,Uc=jc,Yc=function(t,e){return arguments.length<2?(i=Gc[t],Uc(i)?i:void 0):Gc[t]&&Gc[t][e];var i},Xc=bc({}.isPrototypeOf),$c=ec,Kc="undefined"!=typeof navigator&&String(navigator.userAgent)||"",qc=$c.process,Zc=$c.Deno,Jc=qc&&qc.versions||Zc&&Zc.version,Qc=Jc&&Jc.v8;Qc&&(gc=(pc=Qc.split("."))[0]>0&&pc[0]<4?1:+(pc[0]+pc[1])),!gc&&Kc&&(!(pc=Kc.match(/Edge\/(\d+)/))||pc[1]>=74)&&(pc=Kc.match(/Chrome\/(\d+)/))&&(gc=+pc[1]);var td=gc,ed=nc,id=ec.String,nd=!!Object.getOwnPropertySymbols&&!ed((function(){var t=Symbol();return!id(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&td&&td<41})),sd=nd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rd=Yc,ad=jc,od=Xc,ld=Object,hd=sd?function(t){return"symbol"==typeof t}:function(t){var e=rd("Symbol");return ad(e)&&od(e.prototype,ld(t))},cd=String,dd=function(t){try{return cd(t)}catch(t){return"Object"}},ud=jc,pd=dd,gd=TypeError,fd=function(t){if(ud(t))return t;throw gd(pd(t)+" is not a function")},md=fd,yd=Pc,_d=function(t,e){var i=t[e];return yd(i)?void 0:md(i)},vd=lc,bd=jc,xd=Wc,Sd=TypeError,wd={exports:{}},Ad=ec,kd=Object.defineProperty,Md=function(t,e){try{kd(Ad,t,{value:e,configurable:!0,writable:!0})}catch(i){Ad[t]=e}return e},Cd=Md,Td="__core-js_shared__",Ed=ec[Td]||Cd(Td,{}),Pd=Ed;(wd.exports=function(t,e){return Pd[t]||(Pd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Rd=wd.exports,Bd=Ic,Id=Object,Dd=function(t){return Id(Bd(t))},Ld=Dd,Od=bc({}.hasOwnProperty),Fd=Object.hasOwn||function(t,e){return Od(Ld(t),e)},zd=bc,Hd=0,jd=Math.random(),Nd=zd(1..toString),Vd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Nd(++Hd+jd,36)},Wd=Rd,Gd=Fd,Ud=Vd,Yd=nd,Xd=sd,$d=ec.Symbol,Kd=Wd("wks"),qd=Xd?$d.for||$d:$d&&$d.withoutSetter||Ud,Zd=function(t){return Gd(Kd,t)||(Kd[t]=Yd&&Gd($d,t)?$d[t]:qd("Symbol."+t)),Kd[t]},Jd=lc,Qd=Wc,tu=hd,eu=_d,iu=function(t,e){var i,n;if("string"===e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;if(bd(i=t.valueOf)&&!xd(n=vd(i,t)))return n;if("string"!==e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;throw Sd("Can't convert object to primitive value")},nu=TypeError,su=Zd("toPrimitive"),ru=function(t,e){if(!Qd(t)||tu(t))return t;var i,n=eu(t,su);if(n){if(void 0===e&&(e="default"),i=Jd(n,t,e),!Qd(i)||tu(i))return i;throw nu("Can't convert object to primitive value")}return void 0===e&&(e="number"),iu(t,e)},au=hd,ou=function(t){var e=ru(t,"string");return au(e)?e:e+""},lu=Wc,hu=ec.document,cu=lu(hu)&&lu(hu.createElement),du=function(t){return cu?hu.createElement(t):{}},uu=du,pu=!sc&&!nc((function(){return 7!=Object.defineProperty(uu("div"),"a",{get:function(){return 7}}).a})),gu=sc,fu=lc,mu=hc,yu=fc,_u=Oc,vu=ou,bu=Fd,xu=pu,Su=Object.getOwnPropertyDescriptor;ic.f=gu?Su:function(t,e){if(t=_u(t),e=vu(e),xu)try{return Su(t,e)}catch(t){}if(bu(t,e))return yu(!fu(mu.f,t,e),t[e])};var wu={},Au=sc&&nc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ku=Wc,Mu=String,Cu=TypeError,Tu=function(t){if(ku(t))return t;throw Cu(Mu(t)+" is not an object")},Eu=sc,Pu=pu,Ru=Au,Bu=Tu,Iu=ou,Du=TypeError,Lu=Object.defineProperty,Ou=Object.getOwnPropertyDescriptor,Fu="enumerable",zu="configurable",Hu="writable";wu.f=Eu?Ru?function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Hu in i&&!i[Hu]){var n=Ou(t,e);n&&n[Hu]&&(t[e]=i.value,i={configurable:zu in i?i[zu]:n[zu],enumerable:Fu in i?i[Fu]:n[Fu],writable:!1})}return Lu(t,e,i)}:Lu:function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),Pu)try{return Lu(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Du("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var ju=wu,Nu=fc,Vu=sc?function(t,e,i){return ju.f(t,e,Nu(1,i))}:function(t,e,i){return t[e]=i,t},Wu={exports:{}},Gu=sc,Uu=Fd,Yu=Function.prototype,Xu=Gu&&Object.getOwnPropertyDescriptor,$u=Uu(Yu,"name"),Ku={EXISTS:$u,PROPER:$u&&"something"===function(){}.name,CONFIGURABLE:$u&&(!Gu||Gu&&Xu(Yu,"name").configurable)},qu=jc,Zu=Ed,Ju=bc(Function.toString);qu(Zu.inspectSource)||(Zu.inspectSource=function(t){return Ju(t)});var Qu,tp,ep,ip=Zu.inspectSource,np=jc,sp=ec.WeakMap,rp=np(sp)&&/native code/.test(String(sp)),ap=Vd,op=Rd("keys"),lp=function(t){return op[t]||(op[t]=ap(t))},hp={},cp=rp,dp=ec,up=Wc,pp=Vu,gp=Fd,fp=Ed,mp=lp,yp=hp,_p="Object already initialized",vp=dp.TypeError,bp=dp.WeakMap;if(cp||fp.state){var xp=fp.state||(fp.state=new bp);xp.get=xp.get,xp.has=xp.has,xp.set=xp.set,Qu=function(t,e){if(xp.has(t))throw vp(_p);return e.facade=t,xp.set(t,e),e},tp=function(t){return xp.get(t)||{}},ep=function(t){return xp.has(t)}}else{var Sp=mp("state");yp[Sp]=!0,Qu=function(t,e){if(gp(t,Sp))throw vp(_p);return e.facade=t,pp(t,Sp,e),e},tp=function(t){return gp(t,Sp)?t[Sp]:{}},ep=function(t){return gp(t,Sp)}}var wp={set:Qu,get:tp,has:ep,enforce:function(t){return ep(t)?tp(t):Qu(t,{})},getterFor:function(t){return function(e){var i;if(!up(e)||(i=tp(e)).type!==t)throw vp("Incompatible receiver, "+t+" required");return i}}},Ap=bc,kp=nc,Mp=jc,Cp=Fd,Tp=sc,Ep=Ku.CONFIGURABLE,Pp=ip,Rp=wp.enforce,Bp=wp.get,Ip=String,Dp=Object.defineProperty,Lp=Ap("".slice),Op=Ap("".replace),Fp=Ap([].join),zp=Tp&&!kp((function(){return 8!==Dp((function(){}),"length",{value:8}).length})),Hp=String(String).split("String"),jp=Wu.exports=function(t,e,i){"Symbol("===Lp(Ip(e),0,7)&&(e="["+Op(Ip(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Cp(t,"name")||Ep&&t.name!==e)&&(Tp?Dp(t,"name",{value:e,configurable:!0}):t.name=e),zp&&i&&Cp(i,"arity")&&t.length!==i.arity&&Dp(t,"length",{value:i.arity});try{i&&Cp(i,"constructor")&&i.constructor?Tp&&Dp(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Rp(t);return Cp(n,"source")||(n.source=Fp(Hp,"string"==typeof e?e:"")),t};Function.prototype.toString=jp((function(){return Mp(this)&&Bp(this).source||Pp(this)}),"toString");var Np=Wu.exports,Vp=jc,Wp=wu,Gp=Np,Up=Md,Yp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Vp(i)&&Gp(i,r,n),n.global)s?t[e]=i:Up(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Wp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Xp={},$p=Math.ceil,Kp=Math.floor,qp=Math.trunc||function(t){var e=+t;return(e>0?Kp:$p)(e)},Zp=function(t){var e=+t;return e!=e||0===e?0:qp(e)},Jp=Zp,Qp=Math.max,tg=Math.min,eg=function(t,e){var i=Jp(t);return i<0?Qp(i+e,0):tg(i,e)},ig=Zp,ng=Math.min,sg=function(t){return t>0?ng(ig(t),9007199254740991):0},rg=function(t){return sg(t.length)},ag=Oc,og=eg,lg=rg,hg=function(t){return function(e,i,n){var s,r=ag(e),a=lg(r),o=og(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},cg={includes:hg(!0),indexOf:hg(!1)},dg=Fd,ug=Oc,pg=cg.indexOf,gg=hp,fg=bc([].push),mg=function(t,e){var i,n=ug(t),s=0,r=[];for(i in n)!dg(gg,i)&&dg(n,i)&&fg(r,i);for(;e.length>s;)dg(n,i=e[s++])&&(~pg(r,i)||fg(r,i));return r},yg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_g=mg,vg=yg.concat("length","prototype");Xp.f=Object.getOwnPropertyNames||function(t){return _g(t,vg)};var bg={};bg.f=Object.getOwnPropertySymbols;var xg=Yc,Sg=Xp,wg=bg,Ag=Tu,kg=bc([].concat),Mg=xg("Reflect","ownKeys")||function(t){var e=Sg.f(Ag(t)),i=wg.f;return i?kg(e,i(t)):e},Cg=Fd,Tg=Mg,Eg=ic,Pg=wu,Rg=nc,Bg=jc,Ig=/#|\.prototype\./,Dg=function(t,e){var i=Og[Lg(t)];return i==zg||i!=Fg&&(Bg(e)?Rg(e):!!e)},Lg=Dg.normalize=function(t){return String(t).replace(Ig,".").toLowerCase()},Og=Dg.data={},Fg=Dg.NATIVE="N",zg=Dg.POLYFILL="P",Hg=Dg,jg=ec,Ng=ic.f,Vg=Vu,Wg=Yp,Gg=Md,Ug=function(t,e,i){for(var n=Tg(e),s=Pg.f,r=Eg.f,a=0;ar;r++)if((o=y(t[r]))&&bm(Mm,o))return o;return new km(!1)}n=xm(t,s)}for(l=u?t.next:n.next;!(h=fm(l,n)).done;){try{o=y(h.value)}catch(t){wm(n,"throw",t)}if("object"==typeof o&&o&&bm(Mm,o))return o}return new km(!1)},Tm=Xc,Em=TypeError,Pm=function(t,e){if(Tm(e,t))return t;throw Em("Incorrect invocation")},Rm=Zd("iterator"),Bm=!1;try{var Im=0,Dm={next:function(){return{done:!!Im++}},return:function(){Bm=!0}};Dm[Rm]=function(){return this},Array.from(Dm,(function(){throw 2}))}catch(al){}var Lm=wu.f,Om=Fd,Fm=Zd("toStringTag"),zm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Om(t,Fm)&&Lm(t,Fm,{configurable:!0,value:e})},Hm=bc,jm=fd,Nm=jc,Vm=String,Wm=TypeError,Gm=function(t,e,i){try{return Hm(jm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Um=Tu,Ym=function(t){if("object"==typeof t||Nm(t))return t;throw Wm("Can't set "+Vm(t)+" as a prototype")},Xm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Gm(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Um(i),Ym(n),e?t(i,n):i.__proto__=n,i}}():void 0),$m=jc,Km=Wc,qm=Xm,Zm=Xg,Jm=ec,Qm=bc,ty=Hg,ey=Yp,iy=If,ny=Cm,sy=Pm,ry=jc,ay=Pc,oy=Wc,ly=nc,hy=function(t,e){if(!e&&!Bm)return!1;var i=!1;try{var n={};n[Rm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},cy=zm,dy=function(t,e,i){var n,s;return qm&&$m(n=e.constructor)&&n!==i&&Km(s=n.prototype)&&s!==i.prototype&&qm(t,s),t},uy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=Jm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=Qm(o[t]);ey(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!oy(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ty(t,!ry(a)||!(s||o.forEach&&!ly((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),iy.enable();else if(ty(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=ly((function(){d.has(1)})),g=hy((function(t){new a(t)})),f=!s&&ly((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){sy(t,o);var i=dy(new a,t,l);return ay(e)||ny(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,Zm({global:!0,constructor:!0,forced:l!=a},h),cy(l,t),s||i.setStrong(l,t,n),l},py={},gy=mg,fy=yg,my=Object.keys||function(t){return gy(t,fy)},yy=sc,_y=Au,vy=wu,by=Tu,xy=Oc,Sy=my;py.f=yy&&!_y?Object.defineProperties:function(t,e){by(t);for(var i,n=xy(e),s=Sy(e),r=s.length,a=0;r>a;)vy.f(t,i=s[a++],n[i]);return t};var wy,Ay=Yc("document","documentElement"),ky=Tu,My=py,Cy=yg,Ty=hp,Ey=Ay,Py=du,Ry="prototype",By="script",Iy=lp("IE_PROTO"),Dy=function(){},Ly=function(t){return"<"+By+">"+t+""},Oy=function(t){t.write(Ly("")),t.close();var e=t.parentWindow.Object;return t=null,e},Fy=function(){try{wy=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Fy="undefined"!=typeof document?document.domain&&wy?Oy(wy):(e=Py("iframe"),i="java"+By+":",e.style.display="none",Ey.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Ly("document.F=Object")),t.close(),t.F):Oy(wy);for(var n=Cy.length;n--;)delete Fy[Ry][Cy[n]];return Fy()};Ty[Iy]=!0;var zy,Hy,jy,Ny=Object.create||function(t,e){var i;return null!==t?(Dy[Ry]=ky(t),i=new Dy,Dy[Ry]=null,i[Iy]=t):i=Fy(),void 0===e?i:My.f(i,e)},Vy=Np,Wy=wu,Gy=function(t,e,i){return i.get&&Vy(i.get,e,{getter:!0}),i.set&&Vy(i.set,e,{setter:!0}),Wy.f(t,e,i)},Uy=Yp,Yy=function(t,e,i){for(var n in e)Uy(t,n,e[n],i);return t},Xy=!nc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),$y=Fd,Ky=jc,qy=Dd,Zy=Xy,Jy=lp("IE_PROTO"),Qy=Object,t_=Qy.prototype,e_=Zy?Qy.getPrototypeOf:function(t){var e=qy(t);if($y(e,Jy))return e[Jy];var i=e.constructor;return Ky(i)&&e instanceof i?i.prototype:e instanceof Qy?t_:null},i_=nc,n_=jc,s_=Wc,r_=e_,a_=Yp,o_=Zd("iterator"),l_=!1;[].keys&&("next"in(jy=[].keys())?(Hy=r_(r_(jy)))!==Object.prototype&&(zy=Hy):l_=!0);var h_=!s_(zy)||i_((function(){var t={};return zy[o_].call(t)!==t}));h_&&(zy={}),n_(zy[o_])||a_(zy,o_,(function(){return this}));var c_={IteratorPrototype:zy,BUGGY_SAFARI_ITERATORS:l_},d_=c_.IteratorPrototype,u_=Ny,p_=fc,g_=zm,f_=Nf,m_=function(){return this},y_=Xg,__=lc,v_=jc,b_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=u_(d_,{next:p_(+!n,i)}),g_(t,s,!1),f_[s]=m_,t},x_=e_,S_=Xm,w_=zm,A_=Vu,k_=Yp,M_=Nf,C_=Ku.PROPER,T_=Ku.CONFIGURABLE,E_=c_.IteratorPrototype,P_=c_.BUGGY_SAFARI_ITERATORS,R_=Zd("iterator"),B_="keys",I_="values",D_="entries",L_=function(){return this},O_=Yc,F_=Gy,z_=sc,H_=Zd("species"),j_=Ny,N_=Gy,V_=Yy,W_=jf,G_=Pm,U_=Pc,Y_=Cm,X_=function(t,e,i,n,s,r,a){b_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!P_&&t in p)return p[t];switch(t){case B_:case I_:case D_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[R_]||p["@@iterator"]||s&&p[s],f=!P_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=x_(m.call(new t)))!==Object.prototype&&o.next&&(x_(o)!==E_&&(S_?S_(o,E_):v_(o[R_])||k_(o,R_,L_)),w_(o,d,!0)),C_&&s==I_&&g&&g.name!==I_&&(T_?A_(p,"name",I_):(u=!0,f=function(){return __(g,this)})),s)if(l={values:c(I_),keys:r?f:c(B_),entries:c(D_)},a)for(h in l)(P_||u||!(h in p))&&k_(p,h,l[h]);else y_({target:e,proto:!0,forced:P_||u},l);return p[R_]!==f&&k_(p,R_,f,{name:s}),M_[e]=f,l},$_=function(t,e){return{value:t,done:e}},K_=function(t){var e=O_(t);z_&&e&&!e[H_]&&F_(e,H_,{configurable:!0,get:function(){return this}})},q_=sc,Z_=If.fastKey,J_=wp.set,Q_=wp.getterFor,tv={getConstructor:function(t,e,i,n){var s=t((function(t,s){G_(t,r),J_(t,{type:e,index:j_(null),first:void 0,last:void 0,size:0}),q_||(t.size=0),U_(s)||Y_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Q_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=Z_(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),q_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=Z_(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return V_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,q_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),q_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=W_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),V_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),q_&&N_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=Q_(e),r=Q_(n);X_(t,e,(function(t,e){J_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?$_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,$_(void 0,!0))}),i?"entries":"values",!i,!0),K_(e)}};uy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),tv);var ev=Ac,iv=Array.isArray||function(t){return"Array"==ev(t)},nv=bc,sv=nc,rv=jc,av=Jf,ov=ip,lv=function(){},hv=[],cv=Yc("Reflect","construct"),dv=/^\s*(?:class|function)\b/,uv=nv(dv.exec),pv=!dv.exec(lv),gv=function(t){if(!rv(t))return!1;try{return cv(lv,hv,t),!0}catch(t){return!1}},fv=function(t){if(!rv(t))return!1;switch(av(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pv||!!uv(dv,ov(t))}catch(t){return!0}};fv.sham=!0;var mv=!cv||sv((function(){var t;return gv(gv.call)||!gv(Object)||!gv((function(){t=!0}))||t}))?fv:gv,yv=iv,_v=mv,vv=Wc,bv=Zd("species"),xv=Array,Sv=function(t){var e;return yv(t)&&(e=t.constructor,(_v(e)&&(e===xv||yv(e.prototype))||vv(e)&&null===(e=e[bv]))&&(e=void 0)),void 0===e?xv:e},wv=jf,Av=Ec,kv=Dd,Mv=rg,Cv=function(t,e){return new(Sv(t))(0===e?0:e)},Tv=bc([].push),Ev=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=kv(l),f=Av(g),m=wv(h,c),y=Mv(f),_=0,v=d||Cv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Tv(b,u)}else switch(t){case 4:return!1;case 7:Tv(b,u)}return r?-1:n||s?s:b}},Pv={forEach:Ev(0),map:Ev(1),filter:Ev(2),some:Ev(3),every:Ev(4),find:Ev(5),findIndex:Ev(6),filterReject:Ev(7)},Rv=bc,Bv=Yy,Iv=If.getWeakData,Dv=Pm,Lv=Tu,Ov=Pc,Fv=Wc,zv=Cm,Hv=Fd,jv=wp.set,Nv=wp.getterFor,Vv=Pv.find,Wv=Pv.findIndex,Gv=Rv([].splice),Uv=0,Yv=function(t){return t.frozen||(t.frozen=new Xv)},Xv=function(){this.entries=[]},$v=function(t,e){return Vv(t.entries,(function(t){return t[0]===e}))};Xv.prototype={get:function(t){var e=$v(this,t);if(e)return e[1]},has:function(t){return!!$v(this,t)},set:function(t,e){var i=$v(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Wv(this.entries,(function(e){return e[0]===t}));return~e&&Gv(this.entries,e,1),!!~e}};var Kv,qv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Dv(t,r),jv(t,{type:e,id:Uv++,frozen:void 0}),Ov(s)||zv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Nv(e),o=function(t,e,i){var n=a(t),s=Iv(Lv(e),!0);return!0===s?Yv(n).set(e,i):s[n.id]=i,t};return Bv(r,{delete:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).delete(t):i&&Hv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).has(t):i&&Hv(i,e.id)}}),Bv(r,i?{get:function(t){var e=a(this);if(Fv(t)){var i=Iv(t);return!0===i?Yv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},Zv=yf,Jv=ec,Qv=bc,tb=Yy,eb=If,ib=uy,nb=qv,sb=Wc,rb=wp.enforce,ab=nc,ob=rp,lb=Object,hb=Array.isArray,cb=lb.isExtensible,db=lb.isFrozen,ub=lb.isSealed,pb=lb.freeze,gb=lb.seal,fb={},mb={},yb=!Jv.ActiveXObject&&"ActiveXObject"in Jv,_b=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},vb=ib("WeakMap",_b,nb),bb=vb.prototype,xb=Qv(bb.set);if(ob)if(yb){Kv=nb.getConstructor(_b,"WeakMap",!0),eb.enable();var Sb=Qv(bb.delete),wb=Qv(bb.has),Ab=Qv(bb.get);tb(bb,{delete:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),Sb(this,t)||e.frozen.delete(t)}return Sb(this,t)},has:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)||e.frozen.has(t)}return wb(this,t)},get:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)?Ab(this,t):e.frozen.get(t)}return Ab(this,t)},set:function(t,e){if(sb(t)&&!cb(t)){var i=rb(this);i.frozen||(i.frozen=new Kv),wb(this,t)?xb(this,t,e):i.frozen.set(t,e)}else xb(this,t,e);return this}})}else Zv&&ab((function(){var t=pb([]);return xb(new vb,t,1),!db(t)}))&&tb(bb,{set:function(t,e){var i;return hb(t)&&(db(t)?i=fb:ub(t)&&(i=mb)),xb(this,t,e),i==fb&&pb(t),i==mb&&gb(t),this}});var kb=Yc,Mb=bc,Cb=Rd,Tb=kb("Map"),Eb=kb("WeakMap"),Pb=Mb([].push),Rb=Cb("metadata"),Bb=Rb.store||(Rb.store=new Eb),Ib=function(t,e,i){var n=Bb.get(t);if(!n){if(!i)return;Bb.set(t,n=new Tb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Tb)}return s},Db={store:Bb,getMap:Ib,has:function(t,e,i){var n=Ib(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Ib(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Ib(i,n,!0).set(t,e)},keys:function(t,e){var i=Ib(t,e,!1),n=[];return i&&i.forEach((function(t,e){Pb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Lb=Tu,Ob=Db.toKey,Fb=Db.set;Xg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Ob(arguments[3]);Fb(t,e,Lb(i),n)}});var zb=Tu,Hb=Db.toKey,jb=Db.getMap,Nb=Db.store;Xg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Hb(arguments[2]),n=jb(zb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=Nb.get(e);return s.delete(i),!!s.size||Nb.delete(e)}});var Vb=Tu,Wb=e_,Gb=Db.has,Ub=Db.get,Yb=Db.toKey,Xb=function(t,e,i){if(Gb(t,e,i))return Ub(t,e,i);var n=Wb(e);return null!==n?Xb(t,n,i):void 0};Xg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Yb(arguments[2]);return Xb(t,Vb(e),i)}});var $b=bc,Kb=Map.prototype,qb={Map:Map,set:$b(Kb.set),get:$b(Kb.get),has:$b(Kb.has),remove:$b(Kb.delete),proto:Kb},Zb=lc,Jb=bc,Qb=function(t,e,i){for(var n,s,r=i||t.next;!(n=Zb(r,t)).done;)if(void 0!==(s=e(n.value)))return s},tx=qb.Map,ex=qb.proto,ix=Jb(ex.forEach),nx=Jb(ex.entries),sx=nx(new tx).next,rx=fd,ax=Pc,ox=rg,lx=Dd,hx=function(t,e,i){return i?Qb(nx(t),(function(t){return e(t[1],t[0])}),sx):ix(t,e)},cx=qb.Map,dx=qb.has,ux=qb.set,px=bc([].push),gx=Xg,fx=bc,mx=Db,yx=Tu,_x=e_,vx=function(t){var e,i,n,s=lx(this),r=ox(s),a=[],o=new cx,l=ax(t)?function(t){return t}:rx(t);for(e=0;e= than the number of constructor arguments of its base class."},yS=function(t,e){return"@postConstruct error in class "+t+": "+e},_S=function(t,e){return"@preDestroy error in class "+t+": "+e},vS=function(t,e){return"onDeactivation() error in class "+t+": "+e},bS="Maximum call stack size exceeded",xS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(Zx,t),userGeneratedMetadata:Reflect.getMetadata(Kx,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(qx,t)||[]},t}(),SS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function wS(t){return t instanceof RangeError||t.message===bS}function AS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function kS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=TS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function MS(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||MS(t.parentRequest,e))}function CS(t){t.childRequests.forEach((function(t){if(MS(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=AS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(gS+" "+e)}CS(t)}))}function TS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ES=function(){function t(t){this.id=rS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),PS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Wx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),RS=function(t,e){this.parentContext=t,this.rootRequest=e},BS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),IS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),DS=function(){function t(t,e,i,n){this.id=rS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new IS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new PS(Wx,n):n instanceof PS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:jS(t,i)}return 0}function NS(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Xx],multiInject:e[$x],targetName:e[Gx],unmanaged:e[Ux]}}var VS=function(){function t(t,e,i,n,s){this.id=rS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function WS(t){return t._bindingDictionary}function GS(t,e,i,n,s){var r=YS(i.container,s.serviceIdentifier),a=[];return r.length===SS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=YS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new VS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case SS.NoBindingsAvailable:if(i.isOptional())return e;var s=AS(t),r=dS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=kS(n,s,YS),new Error(r);case SS.OnlyOneBindingAvailable:return e;case SS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=AS(t),r=cS+" "+s;throw r+=kS(n,s,YS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function US(t,e,i,n,s,r){var a,o;if(null===s){a=GS(t,e,n,null,r),o=new VS(i,n,null,a,r);var l=new RS(n,o);n.addPlan(l)}else a=GS(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===iS.Instance&&null!==e.implementationType){var s=function(t,e){return OS(t,TS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=jS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===nS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=KS(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=iw(iw({},s),{constr:t});n=s.isAsync?function(t){return nw(this,void 0,void 0,(function(){var e,i;return sw(this,(function(n){switch(n.label){case 0:return[4,lw(t.constructorInjections)];case 1:return e=n.sent(),[4,lw(t.propertyInjections)];case 2:return i=n.sent(),[2,ow(iw(iw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):ow(r)}else n=new t;return n}function ow(t){var e,i=new((e=t.constr).bind.apply(e,rw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function lw(t){return nw(this,void 0,void 0,(function(){var e,i,n,s;return sw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Ow=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Lw,onDeactivations:new Lw}},t}(),Fw=function(){return Fw=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new iA(e,i)})).inSingletonScope().whenTargetNamed(e)}class sA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class rA extends sA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const aA=Symbol.for("EnvContribution"),oA=Symbol.for("Global");var lA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,n){e(i,n,t)}};let dA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new rA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};dA=lA([Xw(),cA(0,qw(eA)),cA(0,$w(aA)),hA("design:paramtypes",[Object])],dA);const uA=kt-1e-8;class pA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>uA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=kt)<0&&(n+=kt),(s%=kt)<0&&(s+=kt),ss;++o,a-=At)g(a);else for(a=n-n%At+At,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const fA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,mA={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},yA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let _A,vA,bA,xA,SA,wA;var AA,kA,MA,CA,TA,EA,PA,RA,BA;function IA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function DA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Gt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=kt:T>0&&0===r&&(T-=kt);const E=Math.ceil(Math.abs(T/(At+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*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 FA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class XA extends YA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function $A(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class KA{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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function qA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new KA(s,n),t),s}function ZA(t,e,i,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,n)}class JA{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&&ZA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(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):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:ZA(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}tryUpdateLength(){return this.context.tryUpdateLength()}}function QA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("basis",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new JA(s,n),t),s}function tk(t){return t<0?-1:1}function ek(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(tk(r)+tk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function ik(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function nk(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class sk{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._lastDefined2);break;case 3:nk(this,this._t0,ik(this,this._t0),!1!==this._lastDefined2)}(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;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,nk(this,ik(this,e=ek(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:nk(this,this._t0,e=ek(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}}tryUpdateLength(){return this.context.tryUpdateLength()}}class rk extends sk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ak(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("monotoneX",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new sk(s,n),t),s}function ok(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new XA("monotoneY",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new rk(s,n),t),s}let lk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function hk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new YA("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new lk(r,e,s),t),r}class ck{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.context.closePath()}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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function dk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new ck(s,n),t),s}function uk(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}class pk extends gA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new pA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([yA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([yA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([yA.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([yA.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([yA.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([yA.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([yA.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([yA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([yA.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}toString(){if(!this.toStringCbList){const t=[];t[yA.M]=t=>`M${t[1]} ${t[2]}`,t[yA.L]=t=>`L${t[1]} ${t[2]}`,t[yA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[yA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[yA.A]=t=>{const e=[];LA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;twA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),FA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===PA.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===PA.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)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const gk=["l",0,0,0,0,0,0,0];function fk(t,e,i){const n=gk[0]=t[0];if("a"===n||"A"===n)gk[1]=e*t[1],gk[2]=i*t[2],gk[3]=t[3],gk[4]=t[4],gk[5]=t[5],gk[6]=e*t[6],gk[7]=i*t[7];else if("h"===n||"H"===n)gk[1]=e*t[1];else if("v"===n||"V"===n)gk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Pk=Object.assign(Object.assign({},Sk),{points:[],cornerRadius:0}),Rk=Object.assign(Object.assign({},Sk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Bk=Object.assign(Object.assign({},Sk),{width:0,height:0,cornerRadius:0,length:0}),Ik=Object.assign(Object.assign({},Sk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Dk=Object.assign(Object.assign(Object.assign({},Sk),bk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Lk=Object.assign(Object.assign({},Sk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ok=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Sk),{fill:!0}),Fk=Object.assign(Object.assign({},Ok),{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});var zk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Hk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Dk.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(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._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};Hk=zk([Xw()],Hk);var jk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Nk=Symbol.for("TextMeasureContribution");let Vk=class extends Hk{};Vk=jk([Xw()],Vk);const Wk=new Nw;const Gk=new class{},Uk=Symbol.for("CanvasFactory"),Yk=Symbol.for("Context2dFactory");function Xk(t){return Wk.getNamed(Uk,Gk.global.env)(t)}const $k=1e-4,Kk=Math.sqrt(3),qk=1/3;function Zk(t){return t>-dM&&tdM||t<-dM}const Qk=[0,0],tM=[0,0],eM=[0,0];function iM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function nM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function sM(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 rM(t){return(t%=Mt)<0&&(t+=Mt),t}function aM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function oM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Mt);let d=Math.atan2(l,o);return d<0&&(d+=Mt),d>=n&&d<=s||d+Mt>=n&&d+Mt<=s}function cM(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(Zk(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 pM=[-1,-1,-1],gM=[-1,-1];function fM(){const t=gM[0];gM[0]=gM[1],gM[1]=t}function mM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Zk(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,qk):Math.pow(i,qk),n=n<0?-Math.pow(-n,qk):Math.pow(n,qk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Kk*Math.sin(e)))/(3*a),h=(-o+i*(n-Kk*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,pM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&fM(),p=sM(e,n,r,o,gM[0]),u>1&&(g=sM(e,n,r,o,gM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(Zk(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,pM);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=nM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);pM[0]=-l,pM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Mt-1e-4){n=0,s=Mt;const e=r?1:-1;return a>=pM[0]+t&&a<=pM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Mt,s+=Mt);let c=0;for(let e=0;e<2;e++){const i=pM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=s||t+Mt>=n&&t+Mt<=s)&&(t>wt/2&&t<1.5*wt&&(e=-e),c+=e)}}return c}function vM(t){return Math.round(t/wt*1e8)/1e8%2*wt}function bM(t,e){let i=vM(t[0]);i<0&&(i+=Mt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Mt?s=i+Mt:e&&i-s>=Mt?s=i-Mt:!e&&i>s?s=i+(Mt-vM(i-s)):e&&i1&&(i||(h+=aM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;xM[0]=S,xM[1]=w,bM(xM,Boolean(a[6])),S=xM[0],w=xM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case yA.M:u=m,p=y,c=u,d=p;break;case yA.L:if(i){if(cM(c,d,m,y,e,n,s))return!0}else h+=aM(c,d,m,y,n,s)||0;c=m,d=y;break;case yA.C:if(i){if(lM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=mM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case yA.Q:if(i){if(oM(c,d,m,y,_,v,e,n,s))return!0}else h+=yM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case yA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=aM(c,d,o,l,n,s),i){if(hM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=_M(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case yA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(cM(u,p,o,p,e,n,s)||cM(o,p,o,l,e,n,s)||cM(o,l,u,l,e,n,s)||cM(u,l,u,p,e,n,s))return!0}else h+=aM(o,p,o,l,n,s),h+=aM(u,l,u,p,n,s);break;case yA.Z:if(i){if(cM(c,d,u,p,e,n,s))return!0}else h+=aM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kM=function(t,e){return function(i,n){e(i,n,t)}};let MM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Xk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:bk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new He(Object.assign({defaultFontParams:{fontFamily:bk.fontFamily,fontSize:bk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var CM;MM=wM([Xw(),kM(0,qw(eA)),kM(0,$w(Nk)),kM(1,qw(oA)),AM("design:paramtypes",[Object,Object])],MM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(CM||(CM={}));const TM=new qt;let EM=class{constructor(){this.matrix=new qt}init(t){return this.mode=CM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=CM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(TM.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(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}scale(t,e,i){return this.mode===CM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return TM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}translate(t,e){return this.mode===CM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===CM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};EM=wM([Xw(),AM("design:paramtypes",[])],EM);const PM={arc:wk,area:Ak,circle:kk,line:Tk,path:Ek,symbol:Ik,text:Dk,rect:Rk,rect3d:Bk,polygon:Pk,richtext:Lk,richtextIcon:Fk,image:Ok,group:Mk,glyph:Ck},RM=Object.keys(PM);function BM(){return{arc:Object.assign({},PM.arc),area:Object.assign({},PM.area),circle:Object.assign({},PM.circle),line:Object.assign({},PM.line),path:Object.assign({},PM.path),symbol:Object.assign({},PM.symbol),text:Object.assign({},PM.text),rect:Object.assign({},PM.rect),rect3d:Object.assign({},PM.rect3d),polygon:Object.assign({},PM.polygon),richtext:Object.assign({},PM.richtext),richtextIcon:Object.assign({},PM.richtextIcon),image:Object.assign({},PM.image),group:Object.assign({},PM.group),glyph:Object.assign({},PM.glyph)}}function IM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const DM=new Array(60).fill(0).map((()=>BM()));class LM{constructor(){this._defaultTheme=DM.pop()||BM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?IM(this.userTheme,t.userTheme,!1):this.userTheme=P(t.userTheme),IM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);RM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const OM=new LM;function FM(t,e){return t.glyphHost?FM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):OM.getTheme()}return null}(t)||OM.getTheme()}class zM{static GenAutoIncrementId(){return zM.auto_increment_id++}}zM.auto_increment_id=0;var HM=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 jM extends r{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=zM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return HM(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){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof WM))return void console.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(XM(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=XM(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");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),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 WM))return void console.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=XM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=XM(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.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=YM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(XM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(XM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,XM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof WM))return void console.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"):XM(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 GM))return void console.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.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;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.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){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=0&&t<=C(this.rootTarget,"width")&&e>=0&&e<=C(this.rootTarget,"height")?this.rootTarget:null,i}}const KM={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof NM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new UM(t,e))}},qM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class ZM{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(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,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new $M(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new WM,this.rootWheelEvent=new GM,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&f(t)&&!E(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class JM{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const QM=(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"},tC=(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 eC extends r{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=YM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=YM.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||QM(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=tC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=YM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=tC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=QM(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=YM.now()-i>this.config.press.time&&tC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class nC{static Avaliable(){return!0}avaliable(){return nC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class sC{static Avaliable(){return!!Gk.global.getRequestAnimationFrame()}avaliable(){return sC.Avaliable()}tick(t,e){Gk.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var rC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(rC||(rC={}));class aC{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-aC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*aC.bounceIn(2*t):.5*aC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}aC.quadIn=aC.getPowIn(2),aC.quadOut=aC.getPowOut(2),aC.quadInOut=aC.getPowInOut(2),aC.cubicIn=aC.getPowIn(3),aC.cubicOut=aC.getPowOut(3),aC.cubicInOut=aC.getPowInOut(3),aC.quartIn=aC.getPowIn(4),aC.quartOut=aC.getPowOut(4),aC.quartInOut=aC.getPowInOut(4),aC.quintIn=aC.getPowIn(5),aC.quintOut=aC.getPowOut(5),aC.quintInOut=aC.getPowInOut(5),aC.backIn=aC.getBackIn(1.7),aC.backOut=aC.getBackOut(1.7),aC.backInOut=aC.getBackInOut(1.7),aC.elasticIn=aC.getElasticIn(1,.3),aC.elasticOut=aC.getElasticOut(1,.3),aC.elasticInOut=aC.getElasticInOut(1,.3*1.5);const oC=new class{constructor(){this.id=zM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===CA.END?this.removeAnimate(e):e.status===CA.RUNNING||e.status===CA.INITIAL?(this.animateCount++,e.advance(t)):e.status===CA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class lC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class hC extends lC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let cC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oC;this.id=t,this.timeline=e,this.status=CA.INITIAL,this.tailAnimate=new dC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&TA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:MA.ANIMATE_PLAY})}runCb(t){const e=new hC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===CA.RUNNING&&(this.status=CA.PAUSED)}resume(){this.status===CA.PAUSED&&(this.status=CA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new dC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===CA.RUNNING&&(this.status=CA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=CA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};cC.mode=TA.NORMAL,cC.interpolateMap=new Map;class dC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new uC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?aC[i]:i,s=this._addStep(e,null,n);return s.type=EA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?aC[i]:i,r=this._addStep(e,null,s);return r.type=EA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=EA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=EA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new uC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class uC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const pC=200,gC="cubicOut",fC=1e3,mC="quadInOut";var yC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(yC||(yC={}));const _C=[!1,!1,!1,!1],vC=[0,0,0,0],bC=t=>t?m(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(vC[0]=t[0],vC[2]=t[0],vC[1]=t[1],vC[3]=t[1],vC):t:t:0,xC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],SC=[1,2,3,0,1,2,3,0];function wC(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;xC[0].x=i,xC[1].y=i,xC[2].x=-i,xC[3].y=-i;const s=Math.ceil(t/At)%4,r=Math.ceil(e/At)%4;if(n.add(Et(t)*i,Bt(t)*i),n.add(Et(e)*i,Bt(e)*i),s!==r||e-t>wt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ht(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=AC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class RC extends lC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:MA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class BC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=Gk.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class IC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=Gk.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class DC extends lC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Mt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+wt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z}}class LC extends lC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class OC extends lC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?aC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function FC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function zC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{rt(e,n)&&rt(i,s)||t.push(e,i,n,s,n,s)};function GC(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function UC(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 i=t.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),qC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ZC=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return qC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return qC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);ZC(s[0],n,i),ZC(s[1],e-n,i)}};var JC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const QC={};for(const t in JC)E(JC,t)&&(QC[JC[t]]=t);const tT={to:{},get:{}};function eT(t,e,i){return Math.min(Math.max(e,t),i)}function iT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}tT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=tT.get.hsl(t,n),i="hsl";break;case"hwb":e=tT.get.hwb(t,n),i="hwb";break;default:e=tT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},tT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=JC[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=eT(e[n],0,255);return e[3]=eT(e[3],0,1),e},tT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},tT.to.keyword=function(t){return QC[t.slice(0,3)]};const nT=tT;var sT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(sT||(sT={}));class rT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===sT.Color1){let e=rT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=tT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];rT.store1[t]=s,rT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=rT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=tT.get(t),n&&n.value){const e=n.value;rT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],rT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===sT.Color1){if(rT.store1[t])return;rT.store1[t]=i,rT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(rT.store255[t])return;rT.store255[t]=i,rT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function aT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 oT(t,e,i,n,s){if(!t||!e)return t&&aT(t)||e&&aT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=rT.Get(t,sT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=rT.Get(e,sT.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:aT(a)})))});return o?oT(r,l,i,n,s):oT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),aT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}rT.store255={},rT.store1={};const lT=[0,0,0,0],hT=[0,0,0,0];function cT(t,e,i){return rT.Get(t,sT.Color255,lT),rT.Get(e,sT.Color255,hT),`rgba(${Math.round(lT[0]+(hT[0]-lT[0])*i)},${Math.round(lT[1]+(hT[1]-lT[1])*i)},${Math.round(lT[2]+(hT[2]-lT[2])*i)},${lT[3]+(hT[3]-lT[3])*i})`}const dT=(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=oT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},uT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?GC(t):[],s=GC(e);i&&n&&(i.fromTransform&&UC(n,i.fromTransform.clone().getInverse()),UC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},gT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],fT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!gT.includes(s))return;const r=e[s];h(r)||h(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?rT.Get(t[s],sT.Color255):t[s],to:"string"==typeof r?rT.Get(r,sT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class mT extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;uT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&dT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const yT=(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=pT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=fT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new mT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:fC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:mC)),c};class _T extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;uT(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&&dT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const vT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>MC.includes(t))(i)||(e[i]=t[i])})),e},bT=(t,e,i)=>{const n=vT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Gk.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},xT=(t,e,i)=>{const n=[],s=i?null:vT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:vT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=XC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Gk.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=XC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=XC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return $C(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 $C(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Gk.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:KC(i)}];const n=[];return ZC(i,e,n),n})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&v(t.x)&&v(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 ZC(r,e,h),h})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=GC(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Gk.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&bT(t,n,e),n};class wT{static GetImage(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=wT.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},wT.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gk.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gk.global.loadBlob(t):"json"===e&&(i.dataPromise=Gk.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}wT.cache=new Map;const AT=new qt,kT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],MT=["x","y"],CT=["scaleX","scaleY"],TT=["angle"],ET=new Ht;class PT extends jM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Wt,this._updateTag=AA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=FM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;ET.x=i+e,ET.y=n+s}else ET.x=i,ET.y=n;return ET}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new qt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&AA.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&AA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=AA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===kA.GLOBAL){const i=new Ht(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Gk.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!h(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:pC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:gC)}else this.setAttributes(t,!1,{type:MA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();E(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=AA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=AA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&AA.UPDATE_SHAPE_AND_BOUNDS)===AA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=AA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=AA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=mk.x,y:e=mk.y,scaleX:i=mk.scaleX,scaleY:n=mk.scaleY,angle:s=mk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Et(a),f=Bt(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(mk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=AT.setValue(a.a,a.b,a.c,a.d,a.e,a.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:MA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=oT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return FM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gk.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return f(t,!0)?this.pathProxy=(new pk).fromString(t):this.pathProxy=new pk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",x(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(wT.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new UM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}PT.mixin(KM);var RT=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 BT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let IT=0;function DT(){return IT++}const LT=DT(),OT=DT(),FT=DT(),zT=DT(),HT=DT(),jT=DT(),NT=DT(),VT=DT(),WT=DT(),GT=DT(),UT=DT(),YT=DT(),XT=DT(),$T=DT(),KT=DT(),qT=DT(),ZT=Symbol.for("GraphicService"),JT=Symbol.for("GraphicCreator");var QT;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(QT||(QT={}));let tE=class t extends PT{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=jT,this._childUpdateTag=AA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new LM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new LM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===kA.GLOBAL){const i=new Ht(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&AA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=FM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Gk.graphicService.updateGroupAABBBounds(t,FM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=bC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS,this._childUpdateTag&=AA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&AA.UPDATE_BOUNDS||(this._childUpdateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Gk.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Gk.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Gk.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Gk.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&AA.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=Gk.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const eE=Symbol.for("LayerHandlerContribution");class iE extends tE{get offscreen(){return this.layerHandler.offscreen}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=Wk.get(eE),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 LM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Gk.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Gk.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var nE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rE=function(t,e){return function(i,n){e(i,n,t)}};let aE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new iE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};aE=nE([Xw(),rE(0,qw(oA)),sE("design:paramtypes",[Object])],aE);var oE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hE=function(t,e){return function(i,n){e(i,n,t)}};const cE=Symbol.for("Window"),dE=Symbol.for("WindowHandlerContribution");let uE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new rA(["x","y","width","height"])},this._uid=zM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Wk.getNamed(dE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};oE([tA(),lE("design:type",Function),lE("design:paramtypes",[]),lE("design:returntype",void 0)],uE.prototype,"postInit",null),uE=oE([Xw(),hE(0,qw(oA)),lE("design:paramtypes",[Object])],uE);const pE=Symbol.for("TransformUtil"),gE=Symbol.for("GraphicUtil"),fE=Symbol.for("LayerService");var mE=new Vw((t=>{t(dA).toSelf().inSingletonScope(),t(oA).toService(dA),t(uE).to(uE),t(cE).toService(uE),t(MM).toSelf().inSingletonScope(),t(gE).toService(MM),t(EM).toSelf().inSingletonScope(),t(pE).toService(EM),t(aE).toSelf().inSingletonScope(),t(fE).toService(aE)}));function yE(t){return!!t}function _E(t,e){let i;return i=m(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function vE(t,e){return t*e>0}function bE(t,e,i,n){return t*e>0&&i>0&&n>0}function xE(t,e){return t*e>0}function SE(t,e,i,n){return t*e>0&&i>0&&n>0}function wE(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=FM(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,m=vE(d,u),y=xE(d,g),_=yE(h),v=_E(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return FA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function AE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function ME(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(s=Mt-St)e.moveTo(i+s*Et(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>St&&(e.moveTo(i+r*Et(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*Et(f),T=s*Bt(f),E=r*Et(y),P=r*Bt(y);let R,B,I,D;if((A>St||w>St)&&(R=s*Et(m),B=s*Bt(m),I=r*Et(_),D=r*Bt(_),hSt){const t=Rt(v,k),r=Rt(b,k),o=kE(I,D,C,T,s,t,Number(c)),l=kE(R,B,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Et(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+R,n+s*Bt(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>St)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>St){const t=Rt(S,M),s=Rt(x,M),o=kE(E,P,R,B,r,-s,Number(c)),l=kE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Et(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*Et(_),n+r*Bt(_))}return a?a[3]&&e.lineTo(i+s*Et(l),n+s*Et(l)):e.closePath(),d}class CE{static GetCanvas(){try{return CE.canvas||(CE.canvas=Gk.global.createCanvas({})),CE.canvas}catch(t){return null}}static GetCtx(){if(!CE.ctx){const t=CE.GetCanvas();CE.ctx=t.getContext("2d")}return CE.ctx}}class TE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=CE.GetCanvas(),n=CE.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=TE.dataMap.get(i);return n||(n=new TE(t,e),TE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){TE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return TE.dataMap.get(t)}}TE.dataMap=new Map;class EE{static GetSize(t){for(let e=0;e=t)return EE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=EE.GenKey(t,e,i,n,s),l=EE.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=EE.GenKey(t,e,i,n,s);EE.cache[l]?EE.cache[l].push({width:a,height:o,pattern:r}):EE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}EE.cache={},EE.ImageSize=[20,40,80,160,320,640,1280,2560];const PE=Symbol.for("ArcRenderContribution"),RE=Symbol.for("AreaRenderContribution"),BE=Symbol.for("CircleRenderContribution"),IE=Symbol.for("GroupRenderContribution"),DE=Symbol.for("ImageRenderContribution"),LE=Symbol.for("PathRenderContribution"),OE=Symbol.for("PolygonRenderContribution"),FE=Symbol.for("RectRenderContribution"),zE=Symbol.for("SymbolRenderContribution"),HE=Symbol.for("TextRenderContribution"),jE=Symbol.for("InteractiveSubRenderContribution");var NE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WE=function(t,e){return function(i,n){e(i,n,t)}};let GE=class{constructor(t){this.arcRenderContribitions=t,this.numberType=LT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Ct(d-c),p=d>c;let g=!1;if(sSt||M>St)&&(D=s*Et(v),L=s*Bt(v),O=r*Et(x),F=r*Bt(x),uSt){const t=Rt(S,T),r=Rt(w,T),a=kE(O,F,P,R,s,t,Number(p)),o=kE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>St)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>St){const t=Rt(k,E),s=Rt(A,E),a=kE(B,I,D,L,r,-s,Number(p)),o=kE(P,R,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Et(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,l){const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x:_=h.x,y:v=h.y}=t.attribute,b=vE(p,g),x=xE(p,m),S=yE(c),w=_E(u,f);if(!t.valid||!y)return;if(!(S||w||d))return;if(!(b||x||a||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=!1;const{isFullStroke:E,stroke:P}=(t=>{var e;let i=!0;if(o(t,!0)){for(let n=0;n<4;n++)_C[n]=t,i&&(i=!(null!==(e=_C[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)_C[e]=!!t[e],i&&(i=!!_C[e]);else _C[0]=!1,_C[1]=!1,_C[2]=!1,_C[3]=!1;return{isFullStroke:i,stroke:_C}})(u);if(S||E||d){if(e.beginPath(),ME(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,_-i,v-n,h),e.fill())),w&&E&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,_-i,v-n,h),e.stroke()))}if(!E&&w){if(e.beginPath(),ME(t,e,i,n,A,k,P),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if(M&&C){const{startAngle:r,endAngle:o}=t.getParsedAngle();if(Ct(o-r)>=Mt-St){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:o=h.endAngle,fill:c=h.fill}=t.attribute,d=o;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;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),oT(o.color,l.color,h,!1)}(0,0,o,s);a||vE&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};GE=NE([Xw(),WE(0,qw(eA)),WE(0,$w(PE)),VE("design:paramtypes",[Object])],GE);var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XE=function(t,e){return function(i,n){e(i,n,t)}};let $E=class{constructor(t){this.circleRenderContribitions=t,this.numberType=zT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(y,f),w=xE(y,m),A=yE(h),k=_E(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};$E=UE([Xw(),XE(0,qw(eA)),XE(0,$w(BE)),YE("design:paramtypes",[Object])],$E);const KE=["radius","startAngle","endAngle",...kT];class qE extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=zT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=FM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateCircleAABBBounds(i,FM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function JE(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function QE(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class tP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=qT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=FM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=FM(this).text,n=Gk.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=JE(c,s),e=QE(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=JE(c,s),_=QE(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=FM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;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 g=Gk.graphicUtil.textMeasure,f=new tP(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).text[t]}needUpdateTags(t){for(let e=0;e{WP[t.type]=t}));const GP=["symbolType","size",...kT];let UP=class t extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=KT}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return m(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=FM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=WP[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new pk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Pt(r,a);return s.transform(0,0,o,o),this._parsedPath=new VP(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=FM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateSymbolAABBBounds(i,FM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=VT}isValid(){return super.isValid()&&this._isValid()}_isValid(){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=kC(i,n,e))}doUpdateAABBBounds(){const t=FM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateLineAABBBounds(e,FM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const $P=["width","height","cornerRadius",...kT];class KP extends PT{constructor(t){super(t),this.type="rect",this.numberType=YT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=FM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRectAABBBounds(e,FM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).rect[t]}needUpdateTags(t){for(let e=0;e<$P.length;e++){const i=$P[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$P.length;e++)if(t===$P[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=t.width,i=t.height,n=new pk;return n.moveTo(0,0),n.rect(0,0,e,i),n}clone(){return new KP(Object.assign({},this.attribute))}}const qP=[[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 ZP extends KP{constructor(t){super(t),this.type="rect3d",this.numberType=XT}findFace(){const t={polygons:[],vertices:[],edges:[]},e=FM(this).rect3d,{width:i=e.width,height:n=e.width,length:s=Rt(e.width,e.height)}=this.attribute;for(let e=0;e{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){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=Gk.graphicService.updateGlyphAABBBounds(this.attribute,FM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new JP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const QP={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"}},tR=!0,eR=!1,iR=/\w|\(|\)/,nR=/[.?!,;:/,。?!、;:]/,sR=/\S/;function rR(t,e,i,n,s){if(!e||e<=0)return 0;const r=Gk.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=function(t,e){let i=e;for(;iR.test(t[i-1])&&iR.test(t[i])||nR.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function aR(t,e){const i=Gk.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class oR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=QP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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,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=this.lines[i].getWidthWithEllips();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((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=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(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=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class lR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=aR(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=aR(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=rR(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=aR(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||eR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||tR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=rR(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=aR(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const hR=["width","height","image",...kT];class cR extends PT{constructor(t){super(t),this.type="image",this.numberType=NT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=FM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateImageAABBBounds(e,FM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ok[t]}needUpdateTags(t){for(let e=0;e{if(m(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=bC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Ok.width,height:e=Ok.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 uR{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 dR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=QP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof lR){const e=sR.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof dR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof dR?t.width:t.getWidthWithEllips(this.direction)})),e}}class pR{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=QP[this.direction]}store(t){if(t instanceof dR){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 uR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof dR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=rR(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new lR(i,t.newLine,t.character),new lR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const gR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...kT];class fR extends PT{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=$T}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=FM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRichTextAABBBounds(e,FM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new pR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const mR=["path","customPath",...kT];class yR extends PT{constructor(t){super(t),this.type="path",this.numberType=WT}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=FM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pk?e.path:(h(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pk?this.cache:t.path)}doUpdateAABBBounds(){const t=FM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePathAABBBounds(e,FM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;f(t.path,!0)?this.cache=(new pk).fromString(t.path):t.customPath&&(this.cache=new pk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).path[t]}needUpdateTags(t){for(let e=0;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 vR(Object.assign({},this.attribute))}}const bR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kT];class xR extends PT{constructor(t){super(t),this.type="arc",this.numberType=LT}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=FM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(v(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=FM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Xt(e),i=e+r,n&&Ct(r)St&&o>St)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=FM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=It(n*n+s*s)}=this.attribute,o=Ct(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>St&&a>St){const i=e>t?1:-1;let r=Ot(Number(a)/s*Bt(u)),o=Ot(Number(a)/n*Bt(u));return(p-=2*r)>St?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>St?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateArcAABBBounds(i,FM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Mt-St)o.moveTo(0+s*Et(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>St&&(o.moveTo(0+n*Et(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Et(e),r=s*Bt(e),l=n*Et(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new xR(Object.assign({},this.attribute))}}class SR extends xR{constructor(t){super(t),this.type="arc3d",this.numberType=OT}doUpdateAABBBounds(){const t=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateArc3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const wR=["points","cornerRadius",...kT];class AR extends PT{constructor(t){super(t),this.type="polygon",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePolygonAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=kC(i,n,e))}getDefaultAttribute(t){return FM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new AR(Object.assign({},this.attribute))}}class kR extends AR{constructor(t){super(t),this.type="pyramid3d",this.numberType=UT}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePyramid3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}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}}var MR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CR=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};CR=MR([Xw()],CR);var TR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ER=Symbol.for("RectBoundsContribution");let PR=class extends CR{};PR=TR([Xw()],PR);var RR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const BR=Symbol.for("SymbolBoundsContribution");let IR=class extends CR{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;BT(i,n+r+o/2,!0,a)}return i}};IR=RR([Xw()],IR);var DR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const LR=Symbol.for("CircleBoundsContribution");let OR=class extends CR{};OR=DR([Xw()],OR);var FR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const zR=Symbol.for("ArcBoundsContribution");let HR=class extends CR{};HR=FR([Xw()],HR);var jR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const NR=Symbol.for("PathBoundsContribution");let VR=class extends CR{};VR=jR([Xw()],VR);class WR{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return WR.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$R=function(t,e){return function(i,n){e(i,n,t)}};function KR(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=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]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function qR(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 ZR(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function JR(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),KR(t,t,[s+o,r+l,a+h]),KR(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),KR(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=UR.allocate(),n=[0,0];if(y){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]}KR(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),KR(i,i,[-n[0],-n[1],0]),ZR(t,t,i)}}let QR=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new rA(["graphic"]),onSetStage:new rA(["graphic","stage"]),onRemove:new rA(["graphic"]),onAddIncremental:new rA(["graphic","group","stage"]),onClearIncremental:new rA(["graphic","group","stage"]),beforeUpdateAABBBounds:new rA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new rA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Wt,this.tempAABBBounds2=new Wt}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)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new pA(t);return FA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),Nt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Mt-St?i.set(-a,-a,a,a):wC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=St?i.set(0,0,0,0):Math.abs(a-o)>Mt-St?i.set(-s,-s,s,s):(wC(o,a,s,i),wC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(m(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){BT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){BT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Nt(e,e,s.transMatrix)}};QR=YR([Xw(),$R(0,qw(JT)),$R(1,qw(eA)),$R(1,$w(ER)),$R(2,qw(eA)),$R(2,$w(BR)),$R(3,qw(eA)),$R(3,$w(LR)),$R(4,qw(eA)),$R(4,$w(zR)),$R(5,qw(eA)),$R(5,$w(NR)),XR("design:paramtypes",[Object,Object,Object,Object,Object,Object])],QR);class tB extends tE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const eB=["heightLimit","lineClamp"];class iB extends iP{_isValid(){const{text:t}=this.attribute;return m(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=FM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;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),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=Gk.graphicUtil.textMeasure,f=new tP(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=UR.allocate(),s=UR.allocate();JR(s,t,e),ZR(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),UR.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,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()}};function xB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),SB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=PA.ROW:"y"===n?c=PA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let AB=class extends bB{constructor(){super(...arguments),this.numberType=VT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const y=null!==(f=this.z)&&void 0!==f?f:0;xB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:y}),u.cache&&!m(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:_=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,_-c,v-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,_-c,v-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=vE(d,u),y=xE(d,p),_=yE(h),v=_E(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(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),s=uk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=uk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],Rt(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function kB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),MB(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),MB(t,l,1,n),o=!1):o=!0}t.closePath()}function MB(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]=VA(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)}}AB=wB([Xw()],AB);var CB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EB=function(t,e){return function(i,n){e(i,n,t)}};function PB(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}let RB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=FT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=FM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=vE(y,m),A=yE(f),k=_E(b,x),M=xE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=PB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=PB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=PB(i,n),a=PB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],Rt(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=FM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?PA.ROW:PA.COLUMN,Number.isFinite(c)||(o=PA.COLUMN),Number.isFinite(d)||(o=PA.ROW);const u=i*(o===PA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===BA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,y-h,_-c,o),t.fill())),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;m(i)&&i[0]&&!1===i[1]&&(t.beginPath(),xB(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,y-h,_-c,o),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===BA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1}};RB=CB([Xw(),EB(0,qw(eA)),EB(0,$w(RE)),TB("design:paramtypes",[Object])],RB);var BB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DB=function(t,e){return function(i,n){e(i,n,t)}};let LB=class extends bB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=FM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=vE(f,p),w=xE(f,g),A=yE(d),k=_E(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)FA(t.pathShape.commandList,e,i,n,1,1,x);else{FA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};LB=BB([Xw(),DB(0,qw(eA)),DB(0,$w(LE)),IB("design:paramtypes",[Object])],LB);const OB=wt/2;function FB(t,e,i,n,s,r){let a;if(v(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!G(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-OB,0,!1)}if(t.lineTo(_[0],_[1]),!G(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,OB,!1)}if(t.lineTo(b[0],b[1]),!G(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],OB,wt,!1)}if(t.lineTo(g[0],g[1]),!G(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],wt,wt+OB,!1)}return t.closePath(),t}var zB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jB=function(t,e){return function(i,n){e(i,n,t)}};let NB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:y=l.fillOpacity,lineWidth:_=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=bE(f,y,u,p),A=SE(f,v,u,p),k=yE(h),M=_E(d,_);if(!t.valid||!b)return;if(!(k||M||c))return;if(!(w||A||a||o||c))return;0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),FB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};NB=zB([Xw(),jB(0,qw(eA)),jB(0,$w(FE)),HB("design:paramtypes",[Object])],NB);var VB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class extends bB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=vE(f,p),A=xE(f,g),k=yE(d),M=_E(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};UB=VB([Xw(),GB(0,qw(eA)),GB(0,$w(zE)),WB("design:paramtypes",[Object])],UB);var YB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$B=function(t,e){return function(i,n){e(i,n,t)}};let KB=class extends bB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=qT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=vE(f,p),C=xE(f,g),T=yE(d),E=_E(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const P=!b,R=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===BA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,R,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,R);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,R,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,R);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,R))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,R),this.drawUnderLine(_,v,t,i,n+r,R,h,e)))}P&&this.restoreTransformUseContext2d(t,h,R,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=JE(l,g),m=QE(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=JE(h,a),f=QE("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};KB=YB([Xw(),$B(0,qw(eA)),$B(0,$w(HE)),XB("design:paramtypes",[Object])],KB);var qB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZB=class{};function JB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nI=function(t,e){return function(i,n){e(i,n,t)}};let sI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:y=l.lineWidth,opacity:_=l.opacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(_,p),w=xE(_,f),A=yE(c),k=_E(d,y);t.valid&&v&&(A||k||g)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||m(u)&&u.every((t=>0===t))?JB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)JB(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=tI(l,y,_,c,d),S=tI(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=QB(w,A),M=tI(l,QB(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};sI=eI([Xw(),nI(0,qw(eA)),nI(0,$w(OE)),iI("design:paramtypes",[Object])],sI);var rI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oI=function(t,e){return function(i,n){e(i,n,t)}};const lI=["","repeat-x","repeat-y","repeat"];let hI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=NT}drawShape(t,e,i,n,s,r,a){const o=FM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=vE(d,u),_=yE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,lI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=FM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};hI=rI([Xw(),oI(0,qw(eA)),oI(0,$w(DE)),aI("design:paramtypes",[Object])],hI);const cI=Symbol.for("IncrementalDrawContribution"),dI=Symbol.for("ArcRender"),uI=Symbol.for("Arc3dRender"),pI=Symbol.for("AreaRender"),gI=Symbol.for("CircleRender"),fI=Symbol.for("GraphicRender"),mI=Symbol.for("GroupRender"),yI=Symbol.for("LineRender"),_I=Symbol.for("PathRender"),vI=Symbol.for("PolygonRender"),bI=Symbol.for("RectRender"),xI=Symbol.for("Rect3DRender"),SI=Symbol.for("SymbolRender"),wI=Symbol.for("TextRender"),AI=Symbol.for("RichTextRender"),kI=Symbol.for("Pyramid3dRender"),MI=Symbol.for("GlyphRender"),CI=Symbol.for("ImageRender"),TI=Symbol.for("RenderSelector"),EI=Symbol.for("DrawContribution");function PI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function RI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(m(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const BI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(t)},t));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};return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(e)},e))}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(){this.pools=[]}};var II=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LI=function(t,e){return function(i,n){e(i,n,t)}};let OI=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};OI=II([Xw()],OI);let FI=class{constructor(t){this.subRenderContribitions=t,this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};FI=II([Xw(),LI(0,qw(eA)),LI(0,$w(jE)),DI("design:paramtypes",[Object])],FI);let zI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=BI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return BI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Mt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};zI=II([Xw()],zI);var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),ME(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),ME(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};jI=HI([Xw()],jI);let NI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};NI=HI([Xw()],NI);let VI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};VI=HI([Xw()],VI);var WI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let GI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};GI=WI([Xw()],GI);let UI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};UI=WI([Xw()],UI);let YI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};YI=WI([Xw()],YI);var XI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $I=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};$I=XI([Xw()],$I);var KI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};qI=KI([Xw()],qI);var ZI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),FB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),FB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};JI=ZI([Xw()],JI);let QI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};QI=ZI([Xw()],QI);let tD=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};tD=ZI([Xw()],tD);let eD=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};eD=ZI([Xw()],eD);let iD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};iD=ZI([Xw()],iD);var nD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};sD=nD([Xw()],sD);class rD extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}}class aD extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}}var oD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hD=function(t,e){return function(i,n){e(i,n,t)}};const cD=Symbol.for("RenderService");let dD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}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)}};dD=oD([Xw(),hD(0,qw(EI)),lD("design:paramtypes",[Object])],dD);var uD=new Vw((t=>{t(dD).toSelf(),t(cD).toService(dD)})),pD=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 gD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return pD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function mD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var yD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const _D=Symbol.for("PickItemInterceptor");let vD=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===OT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};vD=yD([Xw()],vD);var bD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SD=function(t,e){return function(i,n){e(i,n,t)}};const wD=Symbol.for("PickerService");let AD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new qt(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=UR.allocate();if(qR(i,e),a){if(i){const t=UR.allocate();r.modelMatrix=ZR(t,a,i),UR.free(i)}}else qR(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Ht(e.x,e.y),a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Ht(e.x,e.y);l.transformPoint(r,r);const a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&UR.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),GR.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};AD=bD([Xw(),SD(0,qw(oA)),SD(1,qw(eA)),SD(1,$w(_D)),xD("design:paramtypes",[Object,Object])],AD);var kD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CD=function(t,e){return function(i,n){e(i,n,t)}};const TD=Symbol.for("GlobalPickerService");let ED=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new qt(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 Ht(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function PD(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function RD(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}ED=kD([Xw(),CD(0,qw(oA)),MD("design:paramtypes",[Object])],ED);class BD{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=UR.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=UR.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const LD=[0,0,0],OD=new qt(1,0,0,1,0,0);let FD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},yk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},vk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new qt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.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&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Mt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),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&&EE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gk.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Gk.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:bk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:bk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[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={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=RI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}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={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=ZE(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=ZE(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(OD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};FD.env="browser",FD=ID([Xw(),DD("design:paramtypes",[Object,Number])],FD);var zD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const jD={WIDTH:500,HEIGHT:500,DPR:1};let ND=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=jD.WIDTH,height:n=jD.HEIGHT,dpr:s=jD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=Gk.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new FD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}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.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};ND.env="browser",ND=zD([Xw(),HD("design:paramtypes",[Object])],ND);const VD=Symbol.for("CanvasArcPicker"),WD=Symbol.for("CanvasArc3dPicker"),GD=Symbol.for("CanvasAreaPicker"),UD=Symbol.for("CanvasCirclePicker"),YD=Symbol.for("CanvasImagePicker"),XD=Symbol.for("CanvasLinePicker"),$D=Symbol.for("CanvasPathPicker"),KD=Symbol.for("CanvasRectPicker"),qD=Symbol.for("CanvasRect3dPicker"),ZD=Symbol.for("CanvasSymbolPicker"),JD=Symbol.for("CanvasTextPicker"),QD=Symbol.for("CanvasPolygonPicker"),tL=Symbol.for("CanvasPyramid3dPicker"),eL=Symbol.for("CanvasRichTextPicker"),iL=Symbol.for("CanvasGlyphPicker"),nL=Symbol.for("CanvasPickerContribution"),sL=Symbol.for("MathArcPicker"),rL=Symbol.for("MathAreaPicker"),aL=Symbol.for("MathCirclePicker"),oL=Symbol.for("MathLinePicker"),lL=Symbol.for("MathPathPicker"),hL=Symbol.for("MathRectPicker"),cL=Symbol.for("MathSymbolPicker"),dL=Symbol.for("MathTextPicker"),uL=Symbol.for("MathPolygonPicker"),pL=Symbol.for("MathGlyphPicker"),gL=Symbol.for("MathPickerContribution");var fL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yL=function(t,e){return function(i,n){e(i,n,t)}};let _L=class extends AD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new ND(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xL=new qt(1,0,0,1,0,0),SL={x:0,y:0};let wL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0),this.path=new pk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},SL),function(t,e,i){return SM(t,0,!1,e,i)}(this.path.commandList,SL.x,SL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},SL);const i=PI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return SM(t,e,!0,i,n)}(this.path.commandList,i,SL.x,SL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(xL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};wL=vL([Xw(),bL("design:paramtypes",[Object,Number])],wL);var AL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ML=function(t,e){return function(i,n){e(i,n,t)}};let CL=class extends AD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new wL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};AL([tA(),kL("design:type",Function),kL("design:paramtypes",[]),kL("design:returntype",void 0)],CL.prototype,"init",null),CL=AL([Xw(),ML(0,qw(eA)),ML(0,$w(gL)),ML(1,qw(oA)),ML(2,qw(eA)),ML(2,$w(_D)),kL("design:paramtypes",[Object,Object,Object])],CL);var TL=new Vw((t=>{t(_L).toSelf().inSingletonScope(),t(CL).toSelf().inSingletonScope(),t(wD).toService(_L),t(ED).toSelf().inSingletonScope(),t(TD).toService(ED),t(vD).toSelf().inSingletonScope(),t(_D).toService(vD),nA(t,_D)})),EL=new Vw((t=>{t(QR).toSelf().inSingletonScope(),t(ZT).toService(QR),t(PR).toSelf().inSingletonScope(),t(ER).toService(PR),nA(t,ER),t(IR).toSelf().inSingletonScope(),t(BR).toService(IR),nA(t,BR),t(OR).toSelf().inSingletonScope(),t(LR).toService(OR),nA(t,LR),t(HR).toSelf().inSingletonScope(),t(zR).toService(HR),nA(t,zR),t(VR).toSelf().inSingletonScope(),t(NR).toService(VR),nA(t,NR),t(JT).toConstantValue(mB)}));const PL=Symbol.for("AutoEnablePlugins"),RL=Symbol.for("PluginService");var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DL=function(t,e){return function(i,n){e(i,n,t)}};let LL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Wk.isBound(PL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};LL=BL([Xw(),DL(0,qw(eA)),DL(0,$w(PL)),IL("design:paramtypes",[Object])],LL);var OL=new Vw((t=>{t(LL).toSelf(),t(RL).toService(LL),nA(t,PL)})),FL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};zL=FL([Xw()],zL);var HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function NL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let VL=class extends zL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(b(o)?o:1),y:(s-r.top)/(b(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return NL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return NL(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:zM.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(){}};function WL(){Wk.rebind(wD).toService(CL)}VL=HL([Xw(),jL("design:paramtypes",[])],VL);var GL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YL=class extends zL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};YL=GL([Xw(),UL("design:paramtypes",[])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KL=class extends zL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Wk.rebind(wD).toService(CL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=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){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}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(){}};KL=XL([Xw(),$L("design:paramtypes",[])],KL);var qL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JL=!1;try{JL=!!lynx.createCanvasNG}catch(t){}let QL=class extends zL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=JL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,JL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(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(){}};QL=qL([Xw(),ZL("design:paramtypes",[])],QL);var tO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eO=class extends zL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};eO=tO([Xw()],eO);var iO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let rO=class extends zL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return sO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{WL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};rO=iO([Xw(),nO("design:paramtypes",[])],rO);var aO=new Vw((t=>{t(VL).toSelf().inSingletonScope(),t(aA).toService(VL),t(YL).toSelf().inSingletonScope(),t(aA).toService(YL),t(KL).toSelf().inSingletonScope(),t(aA).toService(KL),t(QL).toSelf().inSingletonScope(),t(aA).toService(QL),t(rO).toSelf().inSingletonScope(),t(aA).toService(rO),t(eO).toSelf().inSingletonScope(),t(aA).toService(eO),nA(t,aA)})),oO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hO=class{constructor(){this._uid=zM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};hO=oO([Xw(),lO("design:paramtypes",[])],hO);var cO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uO=function(t,e){return function(i,n){e(i,n,t)}};let pO=class extends hO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}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 this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ND(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new ND({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};pO.env="browser",pO=cO([Xw(),uO(0,qw(oA)),dO("design:paramtypes",[Object])],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}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;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};fO.env="feishu",fO=gO([Xw()],fO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _O={WIDTH:500,HEIGHT:500,DPR:1};let vO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=_O.WIDTH,height:n=_O.HEIGHT,dpr:s=_O.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new fO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};vO.env="feishu",vO=mO([Xw(),yO("design:paramtypes",[Object])],vO);var bO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SO=function(t,e){return function(i,n){e(i,n,t)}};let wO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 vO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};wO.env="feishu",wO=bO([Xw(),SO(0,qw(oA)),xO("design:paramtypes",[Object])],wO);var AO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kO=class extends FD{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(RI(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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(PI(this,l,this.dpr)),r.setStrokeStyle(RI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=ZE(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=ZE(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}};kO.env="taro",kO=AO([Xw()],kO);var MO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const TO={WIDTH:500,HEIGHT:500,DPR:1};let EO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=TO.WIDTH,height:n=TO.HEIGHT,dpr:s=TO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new kO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};EO.env="taro",EO=MO([Xw(),CO("design:paramtypes",[Object])],EO);var PO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BO=function(t,e){return function(i,n){e(i,n,t)}};let IO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 EO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};IO.env="taro",IO=PO([Xw(),BO(0,qw(oA)),RO("design:paramtypes",[Object])],IO);var DO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let LO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};LO.env="lynx",LO=DO([Xw()],LO);var OO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zO={WIDTH:500,HEIGHT:500,DPR:1};let HO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=zO.WIDTH,height:n=zO.HEIGHT,dpr:s=zO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new LO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};HO.env="lynx",HO=OO([Xw(),FO("design:paramtypes",[Object])],HO);var jO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VO=function(t,e){return function(i,n){e(i,n,t)}};let WO=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",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:zM.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)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 HO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};WO.env="lynx",WO=jO([Xw(),VO(0,qw(oA)),NO("design:paramtypes",[Object])],WO);var GO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YO=class extends FD{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 qt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};YO.env="node",YO=GO([Xw(),UO("design:paramtypes",[Object,Number])],YO);var XO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$O=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const KO={WIDTH:500,HEIGHT:500,DPR:1};let qO=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=KO.WIDTH,height:n=KO.HEIGHT,canvasControled:s=!0,dpr:r=KO.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new YO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&l(this._nativeCanvas.release)&&this._nativeCanvas.release()}};qO.env="node",qO=XO([Xw(),$O("design:paramtypes",[Object])],qO);var ZO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QO=function(t,e){return function(i,n){e(i,n,t)}};let tF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new qO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new qO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};tF.env="node",tF=ZO([Xw(),QO(0,qw(oA)),JO("design:paramtypes",[Object])],tF);var eF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iF=class extends FD{draw(){}createPattern(t,e){return null}};iF.env="wx",iF=eF([Xw()],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rF={WIDTH:500,HEIGHT:500,DPR:1};let aF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=rF.WIDTH,height:n=rF.HEIGHT,dpr:s=rF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new iF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};aF.env="wx",aF=nF([Xw(),sF("design:paramtypes",[Object])],aF);var oF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hF=function(t,e){return function(i,n){e(i,n,t)}};class cF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let dF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new cF}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:zM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new aF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new aF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};dF.env="wx",dF=oF([Xw(),hF(0,qw(oA)),lF("design:paramtypes",[Object])],dF);var uF=new Vw((t=>{t(pO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(pO))).whenTargetNamed(pO.env),t(wO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(wO))).whenTargetNamed(wO.env),t(IO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(IO))).whenTargetNamed(IO.env),t(WO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(WO))).whenTargetNamed(WO.env),t(dF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(dF))).whenTargetNamed(dF.env),t(tF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(tF))).whenTargetNamed(tF.env)})),pF=new Vw((t=>{t(Vk).toSelf().inSingletonScope(),t(Nk).toService(Vk),nA(t,Nk)})),gF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mF=function(t,e){return function(i,n){e(i,n,t)}};let yF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Xk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,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()}};yF=gF([Xw(),mF(0,qw(oA)),fF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bF=function(t,e){return function(i,n){e(i,n,t)}};let xF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=Xk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};xF=_F([Xw(),bF(0,qw(oA)),vF("design:paramtypes",[Object])],xF);var SF=new Vw((t=>{t(yF).toSelf(),t(xF).toSelf(),t(eE).toService(yF)}));var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const AF=Symbol.for("DrawItemInterceptor"),kF=new Wt;let MF=class{constructor(){this.order=1}afterDrawItem(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){kF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(kF),!0}};MF=wF([Xw()],MF);let CF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=UR.allocate();qR(l,o);const h=r.modelMatrix;if(h){if(l){const t=UR.allocate();r.modelMatrix=ZR(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===OT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&UR.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};CF=wF([Xw()],CF);var TF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},EF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PF=function(t,e){return function(i,n){e(i,n,t)}};let RF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=be(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=mD(e,i,Sk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Se(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):gD(t,Sk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_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||Wk.get(cI);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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IF=class{selector(t){return null}};IF=BF([Xw()],IF);var DF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let FF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:y=l.fillOpacity,strokeOpacity:_=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=bE(u,y,p,g),A=SE(u,_,p,g),k=yE(h),M=_E(d,x);if(!t.valid||!S)return;if(!f){if(!(k||M||c))return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===v||m(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),FB(e,i,n,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=FM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=UR.allocate(),i=UR.allocate();JR(i,t,a),ZR(e,o||e,i),s.modelMatrix=e,UR.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&UR.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};FF=DF([Xw(),OF(0,qw(eA)),OF(0,$w(IE)),LF("design:paramtypes",[Object])],FF);var zF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HF=class extends AB{constructor(){super(...arguments),this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=FM(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,y=vE(u,p),_=xE(u,g),v=yE(c),b=_E(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};HF=zF([Xw()],HF);var jF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NF=class extends RB{constructor(){super(...arguments),this.numberType=FT}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=FM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=vE(u,d),f=yE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};NF=jF([Xw()],NF);var VF,WF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UF=function(t,e){return function(i,n){e(i,n,t)}},YF=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"}(VF||(VF={}));let XF=class extends RF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=VF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new rA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return YF(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,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.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 YF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return YF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>YF(this,void 0,void 0,(function*(){if(2!==t.count)yield fD(t,Sk.zIndex,((i,n)=>{if(this.status===VF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return YF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return YF(this,void 0,void 0,(function*(){this.rendering&&(this.status=VF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=VF.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 YF(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:()=>YF(this,void 0,void 0,(function*(){yield fD(t,Sk.zIndex,(t=>YF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};WF([qw(oA),GF("design:type",Object)],XF.prototype,"global",void 0),XF=WF([Xw(),UF(0,Zw(fI)),UF(1,qw(TI)),UF(2,qw(HF)),UF(3,qw(NF)),UF(4,qw(fE)),UF(5,qw(eA)),UF(5,$w(AF)),GF("design:paramtypes",[Array,Object,Object,Object,Object,Object])],XF);var $F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KF=class extends bB{constructor(){super(...arguments),this.type="rect3d",this.numberType=XT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=bE(g,f,u,p),x=SE(g,y,u,p),S=yE(c),w=_E(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}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){const l=nT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};KF=$F([Xw()],KF);var qF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZF=class{constructor(){this.numberType=$T}drawShape(t,e,i,n,s){const r=FM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&vE(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=FM(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:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),FB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).richtext;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);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};ZF=qF([Xw()],ZF);var JF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let QF=class{constructor(){this.numberType=HT}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=FM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};QF=JF([Xw()],QF);var tz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ez=class extends bB{constructor(){super(...arguments),this.numberType=OT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=vE(p,g),v=xE(p,m),b=yE(c),x=_E(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=nT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(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 d=!1;if(r=Mt-St)e.moveTo(i+r*Et(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>St&&(e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*Et(p),_=r*Bt(p),v=a*Et(f),b=a*Bt(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>St)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Mt,!0,E.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),d=h>l;let u=!1;if(a<=St)e.moveTo(i,n,s);else if(c>=Mt-St)e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Et(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Et(c),f=a*Bt(c),m=a*Et(p),y=a*Bt(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};ez=tz([Xw()],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let nz=class extends bB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=UT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=vE(u,p),x=xE(u,f),S=yE(c),w=_E(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=nT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={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+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};nz=iz([Xw()],nz);var sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};rz=sz([Xw()],rz);let az=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};az=sz([Xw()],az);var oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};lz=oz([Xw()],lz);let hz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};hz=oz([Xw()],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};dz=cz([Xw()],dz);let uz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:CC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:CC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:CC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:CC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};uz=cz([Xw()],uz);var pz=new Vw((t=>{t(RF).toSelf(),t(EI).toService(RF),t(XF).toSelf(),t(cI).toService(XF),t(IF).toSelf(),t(TI).toService(IF),t($E).toSelf().inSingletonScope(),t(gI).to($E),t(fI).to($E),t(GI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(YI).toSelf().inSingletonScope(),t(BE).toService(GI),t(BE).toService(UI),t(BE).toService(YI),nA(t,BE),t(NB).toSelf().inSingletonScope(),t(bI).to(NB),t(fI).to(NB),t(KF).toSelf().inSingletonScope(),t(xI).toService(KF),t(fI).toService(xI),t(JI).toSelf().inSingletonScope(),t(QI).toSelf().inSingletonScope(),t(tD).toSelf().inSingletonScope(),t(eD).toSelf().inSingletonScope(),t(iD).toSelf().inSingletonScope(),t(FE).toService(JI),t(FE).toService(QI),t(FE).toService(tD),t(FE).toService(eD),t(FE).toService(iD),nA(t,FE),t(KB).toSelf().inSingletonScope(),t(wI).to(KB),t(fI).to(KB),nA(t,HE),t(LB).toSelf().inSingletonScope(),t(_I).to(LB),t(fI).to(LB),t(lz).toSelf().inSingletonScope(),t(hz).toSelf().inSingletonScope(),t(LE).toService(lz),t(LE).toService(hz),nA(t,LE),t(UB).toSelf().inSingletonScope(),t(SI).to(UB),t(fI).to(UB),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(aD).toSelf().inSingletonScope(),t(zE).toService(sD),t(zE).toService(rD),t(zE).toService(aD),nA(t,zE),t(GE).toSelf().inSingletonScope(),t(dI).to(GE),t(fI).to(GE),t(ez).toSelf().inSingletonScope(),t(uI).toService(ez),t(fI).toService(uI),t(jI).toSelf().inSingletonScope(),t(NI).toSelf().inSingletonScope(),t(VI).toSelf().inSingletonScope(),t(PE).toService(jI),t(PE).toService(NI),t(PE).toService(VI),nA(t,PE),t(AB).toSelf().inSingletonScope(),t(yI).to(AB),t(fI).to(AB),t(HF).toSelf().inSingletonScope(),t(NF).toSelf().inSingletonScope(),t(RB).toSelf().inSingletonScope(),t(pI).to(RB),t(fI).to(RB),t(dz).toSelf().inSingletonScope(),t(uz).toSelf().inSingletonScope(),t(RE).toService(dz),t(RE).toService(uz),nA(t,RE),t(FF).toSelf().inSingletonScope(),t(mI).to(FF),t(fI).to(FF),t($I).toSelf().inSingletonScope(),t(IE).toService($I),nA(t,IE),t(sI).toSelf().inSingletonScope(),t(vI).to(sI),t(fI).to(sI),t(rz).toSelf().inSingletonScope(),t(az).toSelf().inSingletonScope(),t(OE).toService(rz),t(OE).toService(az),nA(t,OE),t(QF).toSelf().inSingletonScope(),t(MI).toService(QF),t(fI).toService(MI),t(hI).toSelf().inSingletonScope(),t(CI).toService(hI),t(fI).toService(CI),t(qI).toSelf().inSingletonScope(),t(DE).toService(qI),nA(t,DE),t(ZF).toSelf().inSingletonScope(),t(AI).toService(ZF),t(fI).toService(AI),t(nz).toSelf().inSingletonScope(),t(kI).toService(nz),t(fI).toService(kI),t(FI).toSelf().inSingletonScope(),t(HE).toService(FI),t(PE).toService(FI),t(LE).toService(FI),t(zE).toService(FI),t(FE).toService(FI),t(DE).toService(FI),t(BE).toService(FI),t(RE).toService(FI),t(OE).toService(FI),nA(t,jE),nA(t,fI),t(MF).toSelf().inSingletonScope(),t(AF).toService(MF),t(CF).toSelf().inSingletonScope(),t(AF).toService(CF),nA(t,AF)}));var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mz=function(t,e){return function(i,n){e(i,n,t)}};let yz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};yz=gz([Xw(),mz(0,qw(gI)),fz("design:paramtypes",[Object])],yz);var _z=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bz=function(t,e){return function(i,n){e(i,n,t)}};const xz=new Wt;let Sz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=PI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;xz.setValue(i.x1,i.y1,i.x2,i.y2),xz.expand(-r/2),h=!xz.containsPoint(e)}}return n.highPerformanceRestore(),h}};Sz=_z([Xw(),bz(0,qw(bI)),vz("design:paramtypes",[Object])],Sz);var wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Az=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kz=function(t,e){return function(i,n){e(i,n,t)}};let Mz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Mz=wz([Xw(),kz(0,qw(dI)),Az("design:paramtypes",[Object])],Mz);var Cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ez=function(t,e){return function(i,n){e(i,n,t)}};let Pz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Pz=Cz([Xw(),Ez(0,qw(pI)),Tz("design:paramtypes",[Object])],Pz);var Rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Bz=class{constructor(){this.type="image",this.numberType=NT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Bz=Rz([Xw()],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dz=class extends bB{};Dz=Iz([Xw()],Dz);var Lz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fz=function(t,e){return function(i,n){e(i,n,t)}};let zz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};zz=Lz([Xw(),Fz(0,qw(yI)),Oz("design:paramtypes",[Object])],zz);var Hz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nz=function(t,e){return function(i,n){e(i,n,t)}};let Vz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Vz=Hz([Xw(),Nz(0,qw(_I)),jz("design:paramtypes",[Object])],Vz);var Wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Yz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=KT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=FM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Yz=Wz([Xw(),Uz(0,qw(SI)),Gz("design:paramtypes",[Object])],Yz);var Xz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kz=function(t,e){return function(i,n){e(i,n,t)}};let qz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=qT}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=FM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=QE(a,u,s),y=JE(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&UR.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};qz=Xz([Xw(),Kz(0,qw(wI)),$z("design:paramtypes",[Object])],qz);var Zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qz=function(t,e){return function(i,n){e(i,n,t)}};let tH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};tH=Zz([Xw(),Qz(0,qw(vI)),Jz("design:paramtypes",[Object])],tH);var eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let sH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=$T}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};sH=eH([Xw(),nH(0,qw(AI)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};lH=rH([Xw(),oH(0,qw(MI)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let uH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=XT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};uH=hH([Xw(),dH(0,qw(xI)),cH("design:paramtypes",[Object])],uH);var pH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let mH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mH=pH([Xw(),fH(0,qw(kI)),gH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let bH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=OT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};bH=yH([Xw(),vH(0,qw(uI)),_H("design:paramtypes",[Object])],bH);var xH=new Vw(((t,e,i,n)=>{t(yz).toSelf().inSingletonScope(),t(UD).toService(yz),t(nL).toService(UD),t(Sz).toSelf().inSingletonScope(),t(KD).toService(Sz),t(nL).toService(KD),t(uH).toSelf().inSingletonScope(),t(qD).toService(uH),t(nL).toService(qD),t(Mz).toSelf().inSingletonScope(),t(VD).toService(Mz),t(nL).toService(VD),t(Pz).toSelf().inSingletonScope(),t(GD).toService(Pz),t(nL).toService(GD),t(Bz).toSelf().inSingletonScope(),t(YD).toService(Bz),t(nL).toService(YD),t(zz).toSelf().inSingletonScope(),t(XD).toService(zz),t(nL).toService(XD),t(Vz).toSelf().inSingletonScope(),t($D).toService(Vz),t(nL).toService($D),t(Yz).toSelf().inSingletonScope(),t(ZD).toService(Yz),t(nL).toService(ZD),t(qz).toSelf().inSingletonScope(),t(JD).toService(qz),t(nL).toService(JD),t(tH).toSelf().inSingletonScope(),t(QD).toService(tH),t(nL).toService(QD),t(mH).toSelf().inSingletonScope(),t(tL).toService(mH),t(nL).toService(tL),t(bH).toSelf().inSingletonScope(),t(WD).toService(bH),t(nL).toService(WD),t(sH).toSelf().inSingletonScope(),t(eL).toService(sH),t(nL).toService(eL),t(lH).toSelf().inSingletonScope(),t(iL).toService(lH),t(nL).toService(iL),nA(t,nL)})),SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([Xw(),AH(0,qw(_I)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([Xw(),TH(0,qw(gI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BH=function(t,e){return function(i,n){e(i,n,t)}};const IH=new Wt;let DH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;IH.setValue(i.x1,i.y1,i.x2,i.y2),IH.expand(-r/2),h=!IH.containsPoint(e)}}return n.highPerformanceRestore(),h}};DH=PH([Xw(),BH(0,qw(bI)),RH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FH=function(t,e){return function(i,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};zH=LH([Xw(),FH(0,qw(dI)),OH("design:paramtypes",[Object])],zH);var HH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NH=function(t,e){return function(i,n){e(i,n,t)}};let VH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};VH=HH([Xw(),NH(0,qw(pI)),jH("design:paramtypes",[Object])],VH);var WH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let YH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};YH=WH([Xw(),UH(0,qw(yI)),GH("design:paramtypes",[Object])],YH);var XH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KH=function(t,e){return function(i,n){e(i,n,t)}};let qH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=KT}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=FM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qH=XH([Xw(),KH(0,qw(SI)),$H("design:paramtypes",[Object])],qH);var ZH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JH=class{constructor(){this.type="text",this.numberType=qT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};JH=ZH([Xw()],JH);var QH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ej=function(t,e){return function(i,n){e(i,n,t)}};let ij=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ij=QH([Xw(),ej(0,qw(vI)),tj("design:paramtypes",[Object])],ij);var nj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rj=function(t,e){return function(i,n){e(i,n,t)}};let aj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};aj=nj([Xw(),rj(0,qw(MI)),sj("design:paramtypes",[Object])],aj);var oj=new Vw((t=>{t(EH).toSelf().inSingletonScope(),t(aL).toService(EH),t(gL).toService(aL),t(DH).toSelf().inSingletonScope(),t(hL).toService(DH),t(gL).toService(hL),t(zH).toSelf().inSingletonScope(),t(sL).toService(zH),t(gL).toService(sL),t(VH).toSelf().inSingletonScope(),t(rL).toService(VH),t(gL).toService(rL),t(YH).toSelf().inSingletonScope(),t(oL).toService(YH),t(gL).toService(oL),t(kH).toSelf().inSingletonScope(),t(lL).toService(kH),t(gL).toService(lL),t(qH).toSelf().inSingletonScope(),t(cL).toService(qH),t(gL).toService(cL),t(JH).toSelf().inSingletonScope(),t(dL).toService(JH),t(gL).toService(dL),t(ij).toSelf().inSingletonScope(),t(uL).toService(ij),t(gL).toService(uL),t(aj).toSelf().inSingletonScope(),t(pL).toService(aj),t(aj).toService(pL),nA(t,gL)}));var lj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new ND(t))).whenTargetNamed(ND.env),t(Yk).toDynamicValue((()=>(t,e)=>new FD(t,e))).whenTargetNamed(FD.env)})),hj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new EO(t))).whenTargetNamed(EO.env),t(Yk).toDynamicValue((()=>(t,e)=>new kO(t,e))).whenTargetNamed(kO.env)})),cj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new vO(t))).whenTargetNamed(vO.env),t(Yk).toDynamicValue((()=>(t,e)=>new fO(t,e))).whenTargetNamed(fO.env)})),dj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new HO(t))).whenTargetNamed(HO.env),t(Yk).toDynamicValue((()=>(t,e)=>new LO(t,e))).whenTargetNamed(LO.env)})),uj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new aF(t))).whenTargetNamed(aF.env),t(Yk).toDynamicValue((()=>(t,e)=>new iF(t,e))).whenTargetNamed(iF.env)})),pj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new qO(t))).whenTargetNamed(qO.env),t(Yk).toDynamicValue((()=>(t,e)=>new YO(t,e))).whenTargetNamed(YO.env)}));Wk.load(mE),Wk.load(EL),Wk.load(uD),Wk.load(TL),Wk.load(OL),function(t){t.load(aO),t.load(uF),t.load(pF),t.load(SF)}(Wk),function(t){t.load(pz)}(Wk),function(t){t.load(xH),t.load(oj)}(Wk),function(t){t.load(lj),t.load(cj),t.load(hj),t.load(dj),t.load(uj),t.load(pj)}(Wk);const gj=Wk.get(oA);Gk.global=gj;const fj=Wk.get(gE);Gk.graphicUtil=fj;const mj=Wk.get(pE);Gk.transformUtil=mj;const yj=Wk.get(ZT);Gk.graphicService=yj,Wk.get(TD);const _j=Wk.get(fE);Gk.layerService=_j;class vj{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Gk.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Gk.graphicService.hooks.onAttributeUpdate.taps=Gk.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onSetStage.taps=Gk.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class bj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class xj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.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))})),Gk.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){Gk.graphicService.hooks.onAddIncremental.taps=Gk.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onClearIncremental.taps=Gk.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gk.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({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Sj=new Wt;class wj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Gk.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&&(Sj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Sj,t.parent&&t.parent.globalTransMatrix)))})),Gk.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))})),Gk.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Gk.graphicService.hooks.beforeUpdateAABBBounds.taps=Gk.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.afterUpdateAABBBounds.taps=Gk.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onRemove.taps=Gk.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Aj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===rC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=rC.INITIAL,Gk.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Gk.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:sC},{mode:"timeout",cons:nC},{mode:"manual",cons:iC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==rC.INITIAL&&(this.status=rC.PAUSE,!0)}resume(){return this.status!==rC.INITIAL&&(this.status=rC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===rC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===rC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=rC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=rC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Aj.addTimeline(oC),Aj.setFPS(60);class kj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=nT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=It(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=Rt(Pt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=f(e)?nT.get(e).value:e;const r=this.colorRgb;return nT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const Mj="white";class Cj extends tE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:Mj}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new LM,this.hooks={beforeRender:new rA(["stage"]),afterRender:new rA(["stage"])},this.global=Wk.get(oA),this.window=Wk.get(cE),this.renderService=Wk.get(cD),this.pickerService=Wk.get(wD),this.pluginService=Wk.get(RL),this.layerService=Wk.get(fE),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Wt,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Mj,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new ZM({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Aj,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new kj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new BD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new bj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new vj))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new xj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new wj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}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))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive"}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Ht(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Wk.get(cE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Tj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Tj||(Tj={}));const Ej="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Pj=Ej,Rj=14,Bj=18,Ij=4,Dj={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Rj}}},Lj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Oj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Rj,offset:12,position:"outside"}}},Fj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},zj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},Hj="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",jj={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:Hj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Hj,fill:"#ddd"}}},Nj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Vj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Wj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},Gj={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj}}},Uj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Yj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Xj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Rj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Rj}}},$j={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Rj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Rj,textBaseline:"middle",textAlign:"center"}}},Kj="__VCHART",qj=500,Zj=500,Jj=`${Kj}_LABEL_LIMIT`,Qj=`${Kj}_LABEL_ALIGN`,tN=`${Kj}_LABEL_TEXT`,eN=`${Kj}_LABEL_VISIBLE`,iN=`${Kj}_LABEL_X`,nN=`${Kj}_LABEL_Y`,sN=`${Kj}_ARC_RATIO`,rN=`${Kj}_ARC_START_ANGLE`,aN=`${Kj}_ARC_END_ANGLE`,oN=`${Kj}_ARC_K`,lN=`${Kj}_ARC_LABEL_HOVER_AX`,hN=`${Kj}_ARC_LABEL_HOVER_AY`,cN=`${Kj}_ARC_LABEL_POINT_AX`,dN=`${Kj}_ARC_LABEL_POINT_AY`,uN=`${Kj}_ARC_LABEL_POINT_BX`,pN=`${Kj}_ARC_LABEL_POINT_BY`,gN=`${Kj}_ARC_LABEL_POINT_CX`,fN=`${Kj}_ARC_LABEL_POINT_CY`,mN=`${Kj}_ARC_LABEL_SELECTED_AX`,yN=`${Kj}_ARC_LABEL_SELECTED_AY`,_N=`${Kj}_ARC_MIDDLE_ANGLE`,vN=`${Kj}_ARC_QUADRANT`,bN=`${Kj}_ARC_RADIAN`,xN=-Math.PI/2,SN=3*Math.PI/2,wN=-90,AN=270,kN=.6,MN={},CN=[],TN=(t,e,i)=>{MN[t]=Object.assign(e,{type:t}),i||CN.push(t)},EN=()=>{CN.slice().forEach((t=>{(t=>{delete MN[t];const e=CN.indexOf(t);e>=0&&CN.splice(e,1)})(t)}))};function PN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:f(t)?t:h(s=t)?null:s.fname})):null}function RN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function BN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const IN=":vGrammar_identifier:";function DN(t,e){return N(t).reduce(((t,i)=>{const n=f(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function LN(t,e){if(h(t))return[];if(!l(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(f(i))return N(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!l(t)&&!!(null==t?void 0:t.callback)}(t))return DN(t.dependency,e);var i;return[]}function ON(t){return l(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function FN(t,e,i,n){if(h(t))return t;if(l(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return f(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function zN(t,e){return HN(t)?t.output():e[t]}const HN=t=>t&&!h(t.grammarType),jN=t=>l(t)?t:e=>e[t],NN=t=>f(t)&&se.parseColorString(t)?t:null;function VN(t){return!!(null==t?void 0:t.scale)}function WN(t){return!!(null==t?void 0:t.field)}function GN(t,e){if(!t)return[];let i=[];return t.scale&&(i=HN(t.scale)?[t.scale]:N(e.getScaleById(t.scale))),i.concat(LN(t,e))}class UN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return f(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=N(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const YN={},XN=t=>YN[t],$N=(t,e,i,n,s)=>(YN[t]=new UN(e,i,n,s),YN[t]);function KN(t){return null===t?0:t}function qN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const ZN=["fillOpacity","x","y","dx","dy"],JN=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=KN(i.x),["x"]):"y"===e?(t.y=KN(i.y),["y"]):"dx"===e?(t.dx=KN(i.dx),["dx"]):"dy"===e?(t.dy=KN(i.dy),["dy"]):[]};var QN,tV,eV,iV,nV,sV,rV,aV,oV,lV,hV,cV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(QN||(QN={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(tV||(tV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(eV||(eV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(iV||(iV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(nV||(nV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(sV||(sV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(rV||(rV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(aV||(aV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(oV||(oV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(lV||(lV={})),function(t){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_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"}(hV||(hV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(cV||(cV={}));const dV={[tV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),b(e.length)||!b(e.z1)&&b(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):b(e.z1)||!b(e.length)&&b(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[tV.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[tV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return b(e)&&b(i)&&b(n)&&b(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[tV.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const uV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=f(t)?dV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(ZN.includes(r)?JN(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{ZN.includes(t)?JN(s,t,e):s[t]=e[t]}));return s},pV=(t,e,i)=>!(!h(t)||!h(e))||!h(t)&&!h(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(f(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function gV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case tV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case tV.group:case tV.rect:case tV.image:return["width","height","y1"].includes(e);case tV.path:case tV.shape:return["path","customPath"].includes(e);case tV.line:return"defined"===e;case tV.area:return["x1","y1","defined"].includes(e);case tV.rule:return["x1","y1"].includes(e);case tV.symbol:return"size"===e;case tV.polygon:return"points"===e;case tV.text:return"text"===e}return!1}function fV(t,e,i,n,s){i&&(ON(i)?e.forEach((e=>{const s=FN(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],c=s&&!gV(t.mark.markType,r)?[e[0]]:e;if(VN(l)){const t=zN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!h(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=f(null==l?void 0:l.field),d=s?ll(l.field):null;let u=s?null:h(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=v(u)||v(i)?u+e+i:u}))}else if(WN(l)){const t=ll(l.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=FN(l,n,e.datum,t)}))})))}function mV(t,e,i,n){if(!t)return null;if(ON(t))return FN(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const c=t[r];if(VN(c)){const t=zN(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!h(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=f(null==c?void 0:c.field),p=u?ll(c.field):null,g=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):h(null==c?void 0:c.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,c.value);s[r]=v(g)||v(d)?g+i+d:g}else if(WN(c)){const t=ll(c.field);s[r]=t(e)}else s[r]=FN(c,n,e,i)})),s}function yV(t){if(t)return t.type===Fl.Band?t.bandwidth():t.type===Fl.Point?t.step():void 0}const _V={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=l(i)?i:pl(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!h(s)){if(h(t))return;t[s]=e}return e})),e;const r=n(e,i);return h(s)||h(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=We.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=ll(a),c=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),d=h(t.default)?null:t.default,u=s.map((t=>ll(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),h(n)&&(n=o);const t=o.map((t=>ll(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],l=o.length;return(h(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=h(r)?d:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=PN(i,t.as||[]),s=i.map((t=>f(t)?ll(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Y(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],x=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),w=b(S*_)?S/_:null,A=b(_*_)?_/x:null;return d&&(y[d]=x),p&&(y[p]=S),r&&(y[r]=w),a&&(y[a]=0===i?1:A),o&&(y[o]=!0===g?w:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:S/v[1]),c&&(y[c]=0===i?1:x/v[1]),u&&(y[u]=_),y}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=RN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=BN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return BN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;h(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=h(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=h(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{h(n[IN])&&(n[IN]=0);let s=n[IN];const r=t.as;return e.forEach((t=>{t&&h(t[r])&&(s+=1,t[r]=s)})),n[IN]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=yV(a.y),l="y"===t.dodgeChannel||h(t.dodgeChannel)&&o>0?"y":"x",c="y"===l?o:yV(a.x);if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!h(t.dodgeBy)){const e=rl(N(t.dodgeBy));o=t=>e(t.getDatum())}const d=[];e.forEach((t=>{const e=o(t);d.includes(e)||d.push(e)}));const u=d.length;if(u<1)return e;const p=ml(a,c);let g=p>=c?c:c-p;const f=ml(i,g);let m=(g-Math.max(u-1,0)*f)/u;m>t.maxWidth?(g-=(m-t.maxWidth)*u,m=t.maxWidth):m{y[t]=-g/2+e*(m+f)}));const _=r.markType;"rect"===_||"interval"===_?e.forEach((t=>{const e=o(t),i=y[e],n=t.getItemAttribute();if("x"===l){const e={x:(h(n.width)&&!h(n.x1)?Math.min(n.x,n.x1):n.x)+(h(n.width)?h(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};h(n.width)?e.x1=e.x+m:e.width=m,t.setItemAttributes(e)}else if("y"===l){const e={y:(h(n.height)&&!h(n.y1)?Math.min(n.y,n.y1):n.y)+(h(n.height)?h(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};h(n.height)?e.y1=e.y+m:e.height=m,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=y[e];if("x"===l){const e=t.getItemAttribute("x")+c/2;t.setItemAttributes({x:e+i+m/2})}else if("y"===l){const e=t.getItemAttribute("y")+c/2;t.setItemAttributes({y:e+i+m/2})}}))}return e},markPhase:"afterEncodeItems"}},vV="__vgrammar_scene_item__",bV=[tV.line,tV.area],xV=[tV.arc3d,tV.rect3d,tV.pyramid3d],SV="key",wV=[{}],AV=["key"],kV="VGRAMMAR_IMMEDIATE_ANIMATION",MV=0,CV=1e3,TV=0,EV=!1,PV=!1,RV="quintInOut",BV={stopWhenStateChange:!1,immediatelyApply:!0},IV={},DV=t=>IV[t],LV=(t,e)=>{IV[t]={creator:e}};class OV extends tE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new pk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Ik.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new pk;let a,o;r.clear();const l=v(s)?s:Pt(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(hV.BEFORE_CREATE_VRENDER_MARK),e===tV.largeRects)return new OV(i);if(e===tV.largeSymbols)return new FV(i);const n=zV[e]?zV[e](i):DV(e)?DV(e).creator(i):null;return t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}function jV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(hV.BEFORE_CREATE_VRENDER_MARK);const n=new JP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=zV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}const NV=t=>{t&&(t[vV]=null,t.release(),t.parent&&t.parent.removeChild(t))};class VV{constructor(t){this.data=null,this.states=[],this.diffState=QN.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if(l(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));fV(this,o,a,this.mark.parameters());const h=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?uV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),h(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===QN.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(hV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=jN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(hV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=N(FN(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===QN.unChange&&(this.diffState=QN.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||this.useStates(this.states),this.mark.markType===tV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new pk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===QN.enter?(r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.update?(n&&r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.exit&&a&&fV(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=o(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=N(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&f(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=N(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=o(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)fl(n,i,t)&&E(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let c=null==l?void 0:l.nextAttrs;if(t&&t.length&&h(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||qN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[tV.line,tV.area,tV.largeRects,tV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===tV.line||e===tV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>qN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=KN(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=KN(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=KN(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=KN(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===tV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>pV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=uV(tV.line,t.attrs,i);return n.points=e.slice(t.startIndex,h(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?Object.assign(c,{segments:e,points:null}):Object.assign(c,{points:t,segments:null})}else p?Object.assign(c,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(c,{points:s,segments:null})}else e===tV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=KN(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=KN(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=KN(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=KN(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===tV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=KN(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=KN(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!M(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!h(e=C(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return C(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!E(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!E(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(NV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(NV(this.graphicItem),this.graphicItem[vV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?h(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):h(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?m(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const WV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(b(e.center.x)&&(s.x=e.center.x),b(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},GV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),UV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const YV=["visible","path","text","lineWidth","textBaseline","textAlign"],XV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:c+u/2,width:h(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:d+p/2,height:h(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:c+u/2,x1:c+u/2,y:d+p/2,y1:d+p/2,width:h(o)?void 0:0,height:h(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:h(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:h(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:h(n)?void 0:0,height:h(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:h(n)?void 0:0}}:{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:h(n)?void 0:0}}:{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:WV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:GV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:GV(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:UV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:UV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return YV.forEach((t=>{delete n[t],delete s[t]})),N(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{fl(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},$V=Object.assign({},XV),KV=t=>$V[t],qV=(t,e)=>{$V[t]=e},ZV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.from.min=l,m.to.min=d),b(u)&&(m.from.max=l,m.to.max=u),b(p)&&(m.from.q1=l,m.to.q1=p),b(g)&&(m.from.q3=l,m.to.q3=g),b(f)&&(m.from.median=l,m.to.median=f),m},JV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.to.min=l,m.from.min=d),b(u)&&(m.to.max=l,m.from.max=u),b(p)&&(m.to.q1=l,m.from.q1=p),b(g)&&(m.to.q3=l,m.from.q3=g),b(f)&&(m.to.median=l,m.from.median=g),m},QV=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(b(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return b(f)?f:b(_)&&b(v)?(_+v)/2:b(m)&&b(y)?(m+y)/2:b(y)?y:b(m)?m:NaN},tW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),b(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(b(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),b(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const eW=(t,e,i)=>{var n,s,r,a;if(b(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return b(o)?o:b(c)&&b(d)?(c+d)/2:b(l)&&b(h)?(l+h)/2:b(h)?h:b(l)?l:NaN},iW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),b(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(b(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),b(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const nW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},sW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},rW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sW:nW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function hW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(SV,i?t.slice().sort(i):t.slice()),{keys:AV,data:n};const s=jN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class cW{constructor(t,e,i){this.prevData=hW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const dW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const uW=(t,e,i,n,s)=>l(i)?i(t.getDatum(),t,s):i;class pW extends lC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class gW extends lC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{h(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}cC.mode|=TA.SET_ATTR_IMMEDIATELY;let fW=0;const mW=t=>!h(t)&&t.prototype instanceof lC;class yW{constructor(t,e,i){this.id=fW++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),b(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=l(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!KV(e.type))return null;const r=KV(e.type)(t,s,i);return dW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return m(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):d(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!h(null===(r=s[i])||void 0===r?void 0:r.from),l=!h(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?uW(t,0,s[i].from,0,n):void 0,e.to[i]=l?uW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),dW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),c=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=mW(o);return h(o)||mW(o)?u?new o(a.from,a.to,r,t.easing,c):a.to?new gW(a.from,a.to,r,t.easing):void 0:new pW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:c})})).filter((t=>!h(t)));1===e.length?t.play(e[0]):t.play(new OC(r,e))}}}function _W(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(vW(i,t[i]))})),e}function vW(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return N(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,c,d,u;if(h(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:MV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:PV,loop:null!==(n=l.loop)&&void 0!==n?n:EV,controlOptions:L({},BV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:CV,delay:null!==(a=l.delay)&&void 0!==a?a:TV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:RV,customParameters:l.customParameters,options:l.options}]}]}}const p=N(t.timeSlices).filter((t=>t.effects&&N(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:MV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:PV,loop:null!==(d=t.loop)&&void 0!==d?d:EV,controlOptions:L({},BV,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:TV,effects:N(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:RV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function bW(t,e,i){return l(t)?t.call(null,e.getDatum(),e,i):t}class xW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!h(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class SW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=_W(null!=e?e:{})}updateConfig(t){this.configs=_W(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==QN.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=vW(kV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return h(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=N(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===QN.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(h(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},o),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new yW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===QN.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(hV.ANIMATION_START,d),this.mark.emit(hV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=FN(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=bW(t.startTime,e,s),o=bW(t.totalTime,e,s),l=bW(t.oneByOne,e,s),h=bW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=bW(t.delay,e,s),l=null!==(i=bW(t.duration,e,s))&&void 0!==i?i:o/n,h=N(t.effects).map((t=>Object.assign({},t,{customParameters:bW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=v(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:v(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===QN.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===QN.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===kV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===QN.exit&&0===a[QN.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(hV.ANIMATION_END,h),this.mark.emit(hV.ELEMENT_ANIMATION_END,h,i)}}const wW=(t,e)=>HN(t)?t.output():t&&d(t)?l(t.callback)?i=>t.callback(i,e):l(t.value)?t.value(e):t:t,AW=(t,e)=>t?d(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=wW(s,e),i}),{}):t.map((t=>wW(t,e))):t;var kW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let MW=-1;class CW extends r{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=N(this.spec.dependency).map((t=>f(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=N(t).map((t=>f(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((i=>{var n;h(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return h(this.spec[e])||this.detach(LN(this.spec[e],this.view)),this.spec[e]=t,this.attach(LN(t,this.view)),this.commit(),this}}const TW=(t,e,i)=>{var n,s;if("callback"===t&&l(e))return{references:[],value:{callback:e,dependency:[]}};if(!h(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!h(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!h(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=LN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},EW=(t,e)=>{const i=(n=t.type,MN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(DN(a,e))));const o=((t,e,i)=>{if(h(e))return{value:e};if(m(e)){const n=e.map((e=>TW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return TW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},PW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=EW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class RW extends VV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if(l(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return fV(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?uV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=o(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===QN.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!h(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===QN.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=uV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{E(this.items[0].nextAttrs,e)||E(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=dV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{E(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===tV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return bV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&E(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),E(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),E(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)fl(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[vV]=null})),this.glyphGraphicItems=null),super.release()}}const BW=t=>t.markType===tV.glyph?new RW(t):new VV(t);function IW(t){return h(t.offsetX)?h(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function DW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return b(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),b(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&b(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&b(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const LW="window",OW="view",FW={trap:!1},zW="default",HW="width",jW="height",NW="viewWidth",VW="viewHeight",WW="padding",GW="viewBox",UW="autoFit";function YW(t,e,i,n,s){if(s===LW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{DW(t,IW(t),!1)}))}));const e=IW(t);DW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var XW=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 $W extends CW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new SW(this,{}),this.differ=new cW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=f(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=f(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!h(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===QN.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===lV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:wV,e);let n=i;i.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(hV.AFTER_MARK_ENCODE)}return this.emit(hV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(hV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>h(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return XW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,h(t)||(f(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return f(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];ON(i)?this.detach(GN(i,this.view)):f(e)?this.detach(GN(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(GN(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return f(e)?(this.spec.encode[t][e]=i,this.attach(GN(i,this.view))):ON(e)?(this.spec.encode[t]=e,this.attach(GN(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(GN(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=PW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{h(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{h(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return bV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!h(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===QN.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];ON(s)||Object.keys(s).forEach((t=>{VN(s[t])&&(e[t]=zN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV];if((null==n?void 0:n.mark)===this){const i=YW(this.view,t,n,e,OW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new SW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=zN(this.spec.group,e);this.group=t,t&&(this.emit(hV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(hV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==tV.group){if(!this.graphicItem){const t=HV(this,tV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||xV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==tV.group?(h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=jN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>SV),a=jN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>SV),o=this.spec.sort,l=this.spec.groupSort,c=this.isCollectionMark(),d=new Set(this.elements.filter((t=>t.diffState===QN.enter))),u=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(h(e))s=this.elementMap.get(n),s&&(s.diffState=QN.exit);else if(h(i)){s=this.elementMap.has(n)?this.elementMap.get(n):BW(this),s.diffState===QN.exit&&(s.diffState=QN.enter,this.animate.getElementAnimators(s,QN.exit).forEach((t=>t.stop("start")))),s.diffState=QN.enter;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),u.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=QN.update;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),u.push(s)}d.delete(s)}));const p=null!=t?t:wV;this.differ.setCurrentData(hW(p,c?a:t=>`${a(t)}-${r(t)}`,c?l:void 0)),this.differ.doDiff(),d.forEach((t=>{this.elementMap.delete(c?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=u,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:HV(this,this.markType,t);if(this.emit(hV.BEFORE_ADD_VRENDER_MARK),this.markType===tV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(hV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==tV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=hW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=jN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>SV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=BW(this);e.diffState=QN.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=BW(this);i.diffState=QN.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(ON(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===tV.glyph&&XN(i)){const t=XN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>gV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{gV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(gV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(hV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(hV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(hV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||AV).forEach((t=>{const e=HV(this,tV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(hV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==QN.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return dV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=QN.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&NV(this.graphicItem),this.detachAll(),super.release()}}class KW extends $W{constructor(t,e,i){super(t,tV.component,i),this._componentDatum={[SV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:DV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,SV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[SV]+=1}evaluateJoin(t){return this.spec.key=SV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=f(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=f(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const qW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class ZW extends tE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){p(this.attribute[t])?L(this.attribute[t],e):this.attribute[t]=e,qW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>qW.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){h(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ct(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ct(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onSliderPointerMove),gj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onSliderPointerMove),gj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=dt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ge(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]=Ge(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new UM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function QW(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&QW(t,e)}))}JW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const tG=t=>!h(t)&&!1!==t.visible,eG=["#ffffff","#000000"];function iG(t,e,i,n,s){const r=aG(t),a=aG(e);return nG(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...eG);for(const s of r)if(t!==s&&nG(s,e,i,n))return s}(r,a,i,n,s)}function nG(t,e,i,n){return n?sG(t,e)>n:"largeText"===i?sG(t,e)>3:sG(t,e)>4.5}function sG(t,e){const i=rG(t),n=rG(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function rG(t){const e=ae(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 aG(t){if(null==t?void 0:t.includes("#"))return t;const e=new se(t),{r:i,g:n,b:s}=e.color;return"#"+oe(i,n,s)}function oG(t,e){return[t[0]*e,t[1]*e]}function lG(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const hG=-.5*Math.PI,cG=1.5*Math.PI,dG="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var uG;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uG||(uG={}));const pG={[uG.selectedReverse]:{},[uG.selected]:{},[uG.hover]:{},[uG.hoverReverse]:{}},gG=(t,e,i)=>new He(Object.assign({defaultFontParams:{fontFamily:dG,fontSize:11},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function fG(t,e){var i,n;if(!t)return{width:0,height:0};const s=_B({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var mG=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);sl&&(y=l,k.setAttribute("maxLineWidth",l-g[1]-g[2])));let D=0,L=0;"center"===B?(D-=y/2,m&&m.setAttribute("x",(m.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===B||"end"===B?(D-=y,m&&m.setAttribute("x",(m.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==B&&"start"!==B||f.setAttribute("x",g[3]),"middle"===I?(L-=_/2,m&&m.setAttribute("y",0)):"bottom"===I?(L-=_,m&&m.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===I&&(f.setAttribute("y",g[0]),m&&m.setAttribute("y",E/2));const{visible:O}=s,F=mG(s,["visible"]);if(u&&o(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:O&&!!e,x:D,y:L,width:y,height:_}),"rect");M(null==p?void 0:p.panel)||(t.states=p.panel)}}}yG.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var _G=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);sf?H=f:Hde&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>ge&&deme&&pece&&feue&&ye=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wG=class{render(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;this.poptipComponent||(this.poptipComponent=new vG(t.attribute.poptip));let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};g=n,L(e,xG.poptip,g),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const s=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:s.e,y:s.f}));const r=h.stage.getLayer("_builtin_interactive");r&&r.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wG=SG([Xw()],wG);var AG=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kG=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kG=AG([Xw()],kG);let MG=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MG=AG([Xw()],MG);const CG=new Vw((t=>{t(wG).toSelf().inSingletonScope(),t(jE).toService(wG),t(kG).toSelf().inSingletonScope(),t(PL).toService(kG),t(MG).toSelf().inSingletonScope(),t(PL).toService(MG)}));class TG extends ZW{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EG extends TG{constructor(t){super(L({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PG extends TG{constructor(t){super(L({},PG.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})}}PG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RG extends TG{constructor(t){super(L({},RG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}RG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class BG extends TG{constructor(t){super(L({},BG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=hG,endAngle:n=cG}=this.attribute,s=n-i,r=Ut(Kt(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}BG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class IG extends TG{constructor(t){super(L({},IG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=$t(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}IG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const DG=new Uint32Array(33),LG=new Uint32Array(33);LG[0]=0,DG[0]=~LG[0];for(let t=1;t<=32;++t)LG[t]=LG[t-1]<<1|1,DG[t]=~LG[t];function OG(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.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:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&DG[31&n]&LG[1+(31&s)])return!0}else{if(i[r]&DG[31&n])return!0;if(i[a]&LG[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,DG[31&i]&LG[1+(31&s)]);else for(n(r,DG[31&i]),n(a,LG[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,LG[31&i]|DG[1+(31&n)]);else for(s(r,LG[31&i]),s(a,DG[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FG(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function zG(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=FG(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function HG(t,e){return!(!t||!e)&&e.encloses(t)}function jG(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return jG(t,e,s,h,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return jG(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}if("moveX"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return jG(t,e,s,r,null===(c=n.overlap)||void 0===c?void 0:c.clampForce)}return!1}const VG=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],WG=["top","inside-top","inside"];const GG={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UG(t,e){var i,n;return null!==(n=null===(i=GG[e])||void 0===i?void 0:i.call(GG,t))&&void 0!==n?n:{from:{},to:{}}}const YG="same-time",XG=300,$G="linear";class KG extends ZW{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||M(e.states)||(e.addState(uG.hover,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this,(t=>{M(t.states)||(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void QW(this,(t=>{M(t.states)||(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));M(e.states)||(e.addState(uG.selected,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!M(e)&&(t.states=e)}_createLabelText(t){const e=dB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if(l(s)&&(s=s({})),!s||0===s.length)return[];let r=[];l(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],h=this.getBaseMarkGroup(),c=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==h?void 0:h.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==h?void 0:h.AABBBounds.height())&&void 0!==s?s:0};if(0===c.width||0===c.height)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:p=!0,clampForce:g=!0}=e,f=this._bmpTool||OG(c.width,c.height),m=this._bitmap||f.bitmap(),y=u.some((t=>"bound"===t.type));d&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&m.setRange(FG(f,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:YG,h=null!==(n=a.duration)&&void 0!==n?n:XG,c=null!==(s=a.easing)&&void 0!==s?s:$G,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=UG(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&b(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new TC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(UG(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==MA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===MA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=iG(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=iG(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=iG(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class qG extends KG{constructor(t){super(L({},qG.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZG extends KG{constructor(t){super(L({},ZG.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}ZG.tag="rect-label",ZG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const JG={rect:ZG,symbol:qG};class QG extends ZW{constructor(t){super(L({},QG.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!b(n*i))return;this._componentMap||(this._componentMap=new Map);const s=OG(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function tU(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 eU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=jt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function iU(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=tU(t,!!s),o=tU(r,!!s);const h=jt.distancePP(n,l),c=jt.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=eU(e,t,!1,!!s),o=eU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=tU(t,!!s),o=tU(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}QG.defaultAttributes={pickable:!1};class nU extends ZW{constructor(t){super(L({},nU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!M(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let h="";if("line"===t||"polygon"===t)h=tU(o,!!n);else if("circle"===t){const{center:t}=this.attribute;h=eU(t,o,!1,!!n)}const c=lB(Object.assign({path:h,z:r},l(i)?L({},nU.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;o.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=tU(o,!!n),g=Ct(o[0].x-o[1].x),f=Ct(o[0].y-o[1].y),m=lB(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*wt/2:0,beta:gf?[o[0].x,0]:[0,o[0].y]},l(i)?L({},nU.defaultAttributes.style,i(t,e)):i));m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${s}`),this.add(m)})),e.length>1&&s)){const t=m(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=oB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),M(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=uB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),M(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var rU,aU;sU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(rU||(rU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(aU||(aU={}));const oU={[aU.selectedReverse]:{},[aU.selected]:{},[aU.hover]:{},[aU.hoverReverse]:{}},lU={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var hU=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.name&&!M(e.states)&&(e.addState(uG.hover,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(uG.selected))return this._lastSelect=null,void QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));e.name&&!M(e.states)&&(e.addState(uG.selected,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);L(this.attribute,t);const i=aB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=aB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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,grid:r,items:a,panel:o}=this.attribute,l=aB({x:0,y:0,zIndex:1});if(l.name=rU.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=aB({x:0,y:0,pickable:!1});t.name=rU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=hB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=rU.background,e.id=this._getNodeId("background"),M(o.state)||(e.states=L({},pG,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){const e=this.getTickLineItems(),i=aB({x:0,y:0,pickable:!1});i.name=rU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=oB(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=rU.tick,r.id=this._getNodeId(t.id),M(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=null;else{const t=this.data[n],e=L({},pG,this.attribute.tick.state);Object.keys(e).forEach((i=>{l(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(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=oB(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=rU.subTick,r.id=this._getNodeId(`${s}`),M(n.state))r.states=null;else{const i=L({},pG,n.state);Object.keys(i).forEach((n=>{l(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&&l(n)&&(e=n(e,i));const s=this._transformItems(e),r=aB({x:0,y:0,pickable:!1});r.name=`${rU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,o=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=dB(u);if(p.name=rU.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),M(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=null;else{const n=L({},pG,this.attribute.label.state);Object.keys(n).forEach((r=>{l(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),o=Math.max(o,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),o=Math.abs(o*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new yG(Object.assign({},e));i.name=rU.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return rt(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&l(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=wt/2*(l.x>e.x?1:-1):h=wt/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===_[1]?m+=(this.axisLabelLayerSize[n-1].height+C(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+C(this.attribute,"label.space",4))*n);const v=this.getVerticalCoord(t.point,m,p),b=this.getVerticalVector(m,p,v),x=g?g(t.label,t,e,i,n):t.label;let{style:S}=f;return S=l(S)?L({},lU.label.style,S(t,e,i,n)):S,S=L({textAlign:this.getTextAlign(b),textBaseline:this.getTextBaseline(b,p)},S),l(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},v),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new nU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${rU.grid}-sub`:`${rU.grid}`,n.id=this._getNodeId(t),e.add(n)}}const dU={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&&uU(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function uU(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function pU(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function fU(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ce(t,i),r=Ce(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Me(t),l=Me(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:ke(t.angle);let f=i?t.angle+At:ke(90-t.angle);const m=i?e.angle:ke(e.angle);let y=i?e.angle+At:ke(90-e.angle);f>Mt&&(f-=Mt),y>Mt&&(y-=Mt);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(we(s,i)+we(s,n))/2>we(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function mU(t,e){"bottom"!==t&&"top"!==t||function(t,e){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"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var yU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return oG([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:m}=l,y=yU(l,["position","space","textStyle","autoRotate","shape","background","state"]);let _=.5;"start"===c?_=0:"end"===c&&(_=1);const{verticalFactor:v=1}=this.attribute,b=-1*v,x=this.getTickCoord(_),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+C(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,T=this.getVerticalCoord(x,k,!1),E=this.getVerticalVector(k,!1);let P,R,{angle:B}=y;if(P="start"===c?"start":"end"===c?"end":"center",h(B)&&p){B=lG(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else P=this.getTextAlign(E),R=this.getTextBaseline(E,!1);const I=Object.assign(Object.assign(Object.assign({},T),y),{textStyle:Object.assign({textAlign:P,textBaseline:R},u),state:M(m)?null:{text:m.text,shape:m.shape,panel:m.background}});return I.angle=B,g&&g.visible&&(I.shape=Object.assign({visible:!0},g.style),g.space&&(I.space=g.space)),f&&f.visible&&(I.panel=Object.assign({visible:!0},f.style)),I}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=hG,endAngle:r=cG}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(M(t))return;const{verticalLimitSize:o,label:c,title:d,line:u,tick:p,orient:g}=this.attribute,f=null!==(s=c.space)&&void 0!==s?s:4;let m=o,y=0,_=0;const v=(null==u?void 0:u.visible)?null!==(r=u.style.lineWidth)&&void 0!==r?r:1:0,x=(null==p?void 0:p.visible)?null!==(a=p.length)&&void 0!==a?a:4:0;(null==d?void 0:d.visible)&&(y=fG(d.text,d.textStyle).height,_=d.space),m&&(m=(m-f-_-y-v-x)/n);const{layoutFunc:S,autoRotate:w,autoRotateAngle:A,autoLimit:k,limitEllipsis:C,autoHide:T,autoHideMethod:E,autoHideSeparation:P}=c;l(S)?S(t,e,i,this):(w&&function(t,e){if(M(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Gt(e)})),mU(i,t),!fU(t))break}}(t,{labelRotateAngle:A,orient:g}),k&&b(m)&&m>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!M(t)&&b(i)&&t.forEach((t=>{const e=0===t.attribute.angle||h(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:m,ellipsis:C,orient:g}),T&&function(t,e){if(M(t))return;const i=t.filter(gU);if(M(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=l(s)?s:dU[s]||dU.parity;if(n.length>=3&&pU(n,r)){do{n=a(n,r)}while(n.length>=3&&pU(n,r));n.length<3&&!V(i).attribute.opacity&&(n.length>1&&V(n).setAttribute("opacity",0),V(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:g,method:E,separation:P}))}}_U.defaultAttributes=lU;var vU,bU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=rB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=rU.line,c.id=this._getNodeId("line"),M(null==a?void 0:a.state)||(c.states=L({},oU,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=hG,endAngle:i=cG}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=hG,endAngle:i=cG,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return $t(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return oG(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:m,state:y}=u,_=bU(u,["space","textStyle","shape","background","state"]);let v=l,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=C(this.attribute.label,"style.fontSize",12)+C(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;h(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",v={x:l.x,y:l.y-S}):"end"===A&&(w="top",v={x:l.x,y:l.y+S});const k=Object.assign(Object.assign(Object.assign({},v),_),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:M(y)?null:{text:y.text,shape:y.shape,panel:y.background}}),{angle:T}=_;return k.angle=T,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}xU.defaultAttributes=lU;class SU extends lC{constructor(){super(...arguments),this.mode=TA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return QW(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},QW(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=b(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=_t.lastIndex=vt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=_t.exec(t))&&(n=vt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=vt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=vU.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=vU.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=vU.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===vU.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===vU.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=vU.endHandler):this.state.start=this.state.start+o:this._activeTag===vU.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===gj.env&&(gj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),gj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===vU.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ct(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ct(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=AU(t,["formatMethod"]),{formatMethod:s}=e,r=AU(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const m=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,y=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(m+y)/2,f={x:f.x+m/2,y:f.y}):(g-=(m+y)/2,f={x:f.x,y:f.y+m})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+P*I,y:B.y,width:(R-P)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+P*D,width:I,height:(R-P)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+P*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(P+R)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+P*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(P+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i}=this.attribute,{start:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new yG(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;c(t)&&c(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...N(a))}setUpdateStateCallback(t){l(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){l(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){l(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){l(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){l(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){l(t)&&(this._statePointToData=t)}};var MU,CU,TU;kU.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(MU||(MU={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(CU||(CU={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(TU||(TU={}));class EU extends ZW{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=aB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const PU={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:MU.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]}},RU={start:{textAlign:"right",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:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},BU={label:{position:CU.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}},IU={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"}},DU={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"}};let LU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},RU[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new sU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new yG(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};LU.defaultAttributes=PU;let OU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},IU[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=gB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new yG(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};OU.defaultAttributes=BU;let FU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=TU.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},DU[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=uB(Object.assign(Object.assign({},e),n)):"text"===i?o=new yG(Object.assign({},e)):"richText"===i?o=fB(Object.assign(Object.assign({},e),s)):"image"===i?o=pB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new sU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=oB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};FU.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const zU={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class HU extends ZW{getCurrent(){return this._current}constructor(t){super(L({},HU.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new UM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new UM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.hasState(WU.selected)?this._setLegendItemState(t,WU.selectedHover):this._setLegendItemState(t,WU.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(GU.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(GU.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=a.delegate;if(a.name===UU.focus){const e=t.hasState(WU.focus);t.toggleState(WU.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover,WU.focus]),this._setLegendItemState(t,WU.selected)})):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover,WU.focus]),this._setLegendItemState(e,WU.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(WU.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(WU.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(GU.legendItemClick,t);n?(this._removeLegendItemState(t,[WU.selected,WU.selectedHover]),this._setLegendItemState(t,WU.unSelected)):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]))}else this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}this._dispatchEvent(GU.legendItemClick,t)}}}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,WU.selected),this._removeLegendItemState(e,[WU.unSelected,WU.unSelectedHover])):(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||M(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=aB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=jU,spaceRow:f=NU,maxWidth:m,width:y,height:_}=t;c(m)?c(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:c(y)&&(this._itemWidthByUser=y),c(_)&&(this._itemHeightByUser=_);let v=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!M(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,c(l)&&(o>=l?(v=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,c(h)&&h0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;v&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:l=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:m={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),m=this._handleStyle(m,t,e,i,n);const y=Ge(l);let _;!1===m.visible?(_=aB({x:0,y:0,cursor:(null==m?void 0:m.style).cursor}),this._appendDataToShape(_,UU.item,t,_)):(_=aB(Object.assign({x:0,y:0},null==m?void 0:m.style)),this._appendDataToShape(_,UU.item,t,_,null==m?void 0:m.state)),_.addState(e?WU.selected:WU.unSelected);const v=aB({x:0,y:0,pickable:!1});_.add(v);let b=0;const x=C(p,"style.size",10),S=C(p,"space",8),w=uB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&h(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&h(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,UU.itemShape,t,_,null==p?void 0:p.state),w.addState(e?WU.selected:WU.unSelected),v.add(w);let k=0;if(d){const e=C(u,"size",10);A=uB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:y})),this._appendDataToShape(A,UU.focus,t,_),k=e}const M=dB(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,UU.itemLabel,t,_,null==g?void 0:g.state),M.addState(e?WU.selected:WU.unSelected),v.add(M);const T=C(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+T,c(a)){const n=C(f,"space",d?8:0),s=dB(Object.assign(Object.assign({x:b+T,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));this._appendDataToShape(s,UU.itemValue,t,_,null==f?void 0:f.state),s.addState(e?WU.selected:WU.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-M.AABBBounds.width()-T-k-n),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-y[1]-y[3]-k-n})),b=s.AABBBounds.x2+n,v.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-k);A&&(A.setAttribute("x",b),v.add(A));const E=v.AABBBounds,P=E.width(),R=E.height(),B=this._itemWidthByUser||P+y[1]+y[3],I=this._itemHeightByUser||R+y[0]+y[2];return _.attribute.width=B,_.attribute.height=I,v.translateTo(-E.x1+y[3],-E.y1+y[0]),_}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=jU,spaceRow:h=NU}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=VU}=o,f=XU(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new HU(Object.assign({layout:1===r?"horizontal":"vertical",total:99},L({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new HU(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=aB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(WU.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=L({},$U,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new UM(t,{item:e,data:e.data,selected:e.hasState(WU.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=L({},t);return t.style&&l(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&l(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var qU;function ZU(t){return m(t)?t:[t,t]}function JU(t){return t?"ew-resize":"ns-resize"}KU.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:jU,spaceRow:NU,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:VU,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"}(qU||(qU={}));let QU=class t extends ZW{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(L({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onHandlerPointerMove),gj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ct(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===gj.env)gj.removeEventListener("pointermove",this._onHandlerPointerMove),gj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onTrackPointerMove),gj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ct(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ct(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onTrackPointerMove),gj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,d;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,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(c(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=N(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;h(u)&&(u=[o,l]),this._currentValue={startValue:ZU(u)[0],endValue:ZU(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=aB({x:0,y:0});g.name=qU.innerView,this.add(g),this._innerView=g;let f,m=0;if(r&&r.visible){f=dB(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=qU.startText,g.add(f);const e=c(r.space)?r.space:0;m+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const y=aB({x:p?m:0,y:p?0:m});g.add(y);const _=aB({x:0,y:0});let v;if(_.name=qU.railContainer,this._railContainer=_,y.add(_),this._renderRail(_),m+=p?n:s,a&&a.visible){const t=c(a.space)?a.space:0;v=dB(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),v.name=qU.endText,g.add(v)}this._renderTrack(_),d&&(this._renderHandlers(y),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=hB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=qU.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:c}=this.attribute;let{value:d}=this.attribute;h(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?l:o,[f,m]=ZU(d),y=(f-i)/(n-i)*g,_=this._renderHandler(Object.assign({x:p?y:l/2,y:p?o/2:y,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(_.name=qU.startHandler,this._startHandler=_,t.add(_),this._currentValue.startPos=y,u){const e=this._renderHandlerText(f);e.name=qU.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(m-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(a.name=qU.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(m);e.name=qU.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:c}=this.attribute;h(c)&&(c=[i,n]);const u=this._isHorizontal,p=u?r:s;let[g,f]=ZU(c);e||(g=i);const m=aB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=qU.trackContainer;const y=d(e)&&!0===e.draggableTrack;let _;_=!1===l?"default":!1===e||!1===y?"pointer":JU(u);const v=(f-g)/(n-i)*p,b=hB(Object.assign({x:u?(g-i)/(n-i)*p:0,y:u?0:(g-i)/(n-i)*p,width:u?v:r,height:u?s:v,cursor:_},a));b.name=qU.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return uB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":JU(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),dB(f)}_bindEvents(){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),d(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===qU.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===qU.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===qU.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===qU.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new UM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};QU.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},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}}};class tY extends YU{constructor(t){super(L({},tY.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,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:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function eY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}tY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class iY extends YU{constructor(t){super(L({},iY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,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:y,sizeBackground:_}=this.attribute,v=aB({x:0,y:0});this._innerView.add(v);const b=new QU({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:eY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=lB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}iY.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)"}};let nY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,P,R,B,I,D,L,O,F,z,H,j,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:mt,minHeight:yt,maxHeight:_t,align:vt,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ge(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&c(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else c(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(h=null==ct?void 0:ct.maxLineWidth)&&void 0!==h?h:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&c(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(m=ut.y)&&void 0!==m?m:At,width:null!==(_=null!==(y=ut.width)&&void 0!==y?y:pt)&&void 0!==_?_:0,height:null!==(b=null!==(v=ut.height)&&void 0!==v?v:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else c(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(c(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),c(gt)&&(Et=gt),c(ft)&&Ttmt&&(Tt=mt)),c(yt)&&Et_t&&(Et=_t)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],c(vt)||c(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:vt,e=null!==(O=null==ct?void 0:ct.width)&&void 0!==O?O:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","left")):"center"===t?(null===(H=this._mainTitle)||void 0===H||H.setAttribute("x",e/2),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(c(vt)||c(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:vt,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};nY.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 sY={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"}}};let rY=class extends ZW{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(c(i))if(!1!==i.visible){const t=L({},C(sY,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:c(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&b(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&b(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(c(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=N(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=L({},C(sY,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:c(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&b(a)&&this._setAutoFit(a,d,e),e.autoLimit&&b(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;h+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=fG(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",c(i.style.lineHeight)?i.style.lineHeight:s)}}};class aY extends UP{constructor(t){super(t)}}var oY,lY;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oY||(oY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lY||(lY={}));class hY extends ZW{constructor(t){super(L({},hY.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style: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"},hY.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style: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"},hY.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{h(this._playController)&&(this._playController=new aY(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{h(this._backwardController)&&(this._backwardController=new aY(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{h(this._forwardController)&&(this._forwardController=new aY(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new UM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(oY.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(oY.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(oY.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(oY.OnBackward);this.dispatchEvent(t)},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()}}hY.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hY.defaultAttributes={visible:!0,[lY.Start]:{},[lY.Pause]:{},[lY.Backward]:{},[lY.Forward]:{}};const cY={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dY=[200,10];var uY,pY;!function(t){t.Default="default",t.Reverse="reverse"}(uY||(uY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(pY||(pY={}));const gY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},fY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},mY=t=>"top"===t||"bottom"===t;class yY extends ZW{constructor(t){super(L({},yY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;b(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Pt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:b(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(mY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:dY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:dY[1];s.layout="vertical",s.railWidth=e,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 QU(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return mY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},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 hY(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=mY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=v(i)?i:Pt(i[0],i[1]);return t+e.space+n}),0),l=(mY(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,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new UM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}yY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},cY),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cY),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cY),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cY),{key:"backward",position:"start"})}};class _Y extends yY{constructor(t){super(L({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:uY.Default,this._dataIndex=h(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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(pY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=gj.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(pY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(pY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=gj.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(),gj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var vY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class bY extends yY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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,n=i/this._maxIndex;this._elapsed=n*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(pY.OnChange))},this.play=()=>vY(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(pY.OnPlay),this._rafId=gj.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=gj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},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(pY.OnBackward)},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(pY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const xY={debounce:gt,throttle:ft};let SY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",xY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=gB(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return L(t,...i,{shape:s.every(h)?void 0:L({},...s),key:r.every(h)?void 0:L({},...r),value:a.every(h)?void 0:L({},...a)})},AY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},kY={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:dG,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Wt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},MY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let CY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=Ge(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",L({symbolType:"circle"},d.shape,{visible:tG(d)&&tG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:tG(d)&&tG(d.value)},AY(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:tG(d)&&tG(d.value)},d.value),"text");const u=tG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-h[3]-h[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const m=tG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+m);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!tG(l))return;const h=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let u=0;if(tG(l.shape)&&d.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),tG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},AY(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(tG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},AY(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";c(l.value.textAlign)?e=l.value.textAlign:tG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>MY.includes(t)))?(this._mergeAttributes(e,n),h(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&tG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=tG(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=gG(u),v=gG(p);let b=0;if(tG(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(tG(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&WP[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return wY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};CY.defaultAttributes=kY;const TY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class EY extends KW{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=f(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}LV(nV.lineAxis,((t,e)=>new _U(t,e))),LV(nV.circleAxis,(t=>new xU(t)));class PY extends EY{constructor(t,e,i){super(t,eV.axis,e),this.spec.componentType=eV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=L({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=DV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=mV(s,e,i,n);const c=FN(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=FN(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=FN(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case nV.lineAxis:return((t,e,i)=>{var n,s;const r=TY.axis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p);case nV.circleAxis:return((t,e,i)=>{var n,s;const r=TY.circleAxis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(h(e)){const i=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?nV.circleAxis:nV.lineAxis,this._axisComponentType}}LV(sV.discreteLegend,(t=>new KU(t))),LV(sV.colorLegend,(t=>new tY(t))),LV(sV.sizeLegend,(t=>new iY(t)));class RY extends EY{constructor(t,e){super(t,eV.legend,e),this.spec.componentType=eV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==sV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":GU.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=f(t)?this.view.getDataById(t):t,l=f(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,iV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=DV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=mV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case sV.discreteLegend:return((t,e)=>{const i=TY.discreteLegend;return t?L({},i,{items:Array.from(new Set(N(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=NN(n),r=s?Object.assign(Object.assign({},TY.discreteLegend.items[0].shape),{fill:s,stroke:s}):TY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):L({},i,null!=e?e:{})})(o,a);case sV.colorLegend:return((t,e)=>{const i=TY.colorLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{colors:t.range().slice(),min:n[0],max:V(n)},null!=e?e:{})})(o,a);case sV.sizeLegend:return((t,e)=>{const i=TY.sizeLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&zl(i)){const t=e.getScale().range();NN(null==t?void 0:t[0])?this._legendComponentType=sV.colorLegend:this._legendComponentType=sV.sizeLegend}else this._legendComponentType=sV.discreteLegend}return this._legendComponentType}}LV(rV.lineCrosshair,(t=>new EG(t))),LV(rV.rectCrosshair,(t=>new PG(t))),LV(rV.sectorCrosshair,(t=>new BG(t))),LV(rV.circleCrosshair,(t=>new RG(t))),LV(rV.polygonCrosshair,(t=>new IG(t)));const BY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(jl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Yt(Kt(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else zl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Kt(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class IY extends EY{constructor(t,e){super(t,eV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case rV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return L({},l,BY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case rV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=BY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=L({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case rV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(jl(e.type)){const i=Yt(Kt(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else zl(e.type)&&(f=Kt(u,t));return L({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=TY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(jl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else zl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return L({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(jl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else zl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return L({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=DV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?rV.sectorCrosshair:rV.rectCrosshair:"radius"===n?rV.circleCrosshair:"radius-polygon"===n?rV.polygonCrosshair:rV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}LV(eV.slider,(t=>new QU(t)));class DY extends KW{constructor(t,e){super(t,eV.slider,e),this.spec.componentType=eV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=f(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=f(t)?this.view.getDataById(t):t,a=f(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,iV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>L({},TY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(h(this.spec.min)?0:FN(this.spec.min,i,t,e),h(this.spec.max)?1:FN(this.spec.max,i,t,e),mV(n,t,e,i))}),e}),{});this._encoders=e}}LV(eV.label,(t=>new QG(t)));let LY=class extends KW{constructor(t,e){super(t,eV.label,e),this.spec.componentType=eV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=FN(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=TY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case tV.line:r=TY.lineLabel;break;case tV.rect:r=TY.rectLabel;break;case tV.symbol:r=TY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[vV],n=mV(i,e.getDatum(),e,s),o=L({},r.data[0],n);a.push(o)}}));const o=FN(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return L({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!h(t)));return L({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};LV(eV.datazoom,(t=>new kU(t)));class OY extends KW{constructor(t,e){super(t,eV.datazoom,e),this.spec.componentType=eV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!h(this.spec.preview)){const t=this.spec.preview.data,e=f(t)?this.view.getDataById(t):t;this.detach(e),this.detach(GN(this.spec.preview.x,this.view)),this.detach(GN(this.spec.preview.y,this.view)),this.detach(GN(this.spec.preview.x1,this.view)),this.detach(GN(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=f(t)?this.view.getDataById(t):t;this.attach(r),this.attach(GN(e,this.view)),this.attach(GN(i,this.view)),this.attach(GN(n,this.view)),this.attach(GN(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t,c=f(e)?(t,i)=>{if(h(i.start)||h(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,iV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},TY.datazoom,t),n=DV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=f(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=mV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=TY.datazoom;return t?L({},l,{previewData:t,previewXCallback:e?t=>mV({x:e},t,r,a).x:null,previewYCallback:i?t=>mV({y:i},t,r,a).y:null,previewX1Callback:n?t=>mV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>mV({y1:s},t,r,a).y1:null},null!=o?o:{}):L({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=f(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}LV(oV.continuousPlayer,(t=>new bY(t))),LV(oV.discretePlayer,(t=>new _Y(t)));let FY=class extends KW{constructor(t,e){super(t,eV.player,e),this.spec.componentType=eV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=m(t)?null:f(t)?this.view.getDataById(t):t;this.detach(e)}const r=m(e)?null:f(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=f(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(pY.OnChange,this._filterCallback),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t;return this._filterData(o,l,iV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(pY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=L({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:DV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=mV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=m(o)?null:f(o)?this.view.getDataById(o):o,h=m(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>L({},TY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>L({},TY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};LV(eV.tooltip,(t=>new CY(t)));let zY=class extends KW{constructor(t,e){super(t,eV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ft(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Wt).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>L({},TY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!h(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return N(t).reduce(((t,e)=>(t=t.concat(LN(e.visible,this.view)),WN(e.key)||(t=t.concat(LN(e.key,this.view))),WN(e.value)||(t=t.concat(LN(e.value,this.view))),WN(e.symbol)||(t=t.concat(LN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=FN(t.visible,n,e,i);return o=!!h(o)||!!o,s=WN(t.key)?ll(t.key.field)(e):FN(t.key,n,e,i),s=h(s)?void 0:u(s)?s:{text:s},r=WN(t.value)?ll(t.value.field)(e):FN(t.value,n,e,i),r=h(r)?void 0:u(r)?r:{text:r},a=WN(t.symbol)?ll(t.symbol.field)(e):FN(t.symbol,n,e,i),a=h(a)?void 0:u(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?N(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var HY=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 jY extends CW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],h(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=LN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];N(t.source).forEach((t=>{const i=HN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return HY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return h(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return h(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=N(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=PW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(N(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=N(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function NY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function VY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,NY(t,e,s,n)}class WY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}return this.nodes.push(t),NY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,VY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class GY{constructor(t){this.list=[],this.ids={},this.idFunc=t||hl}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var UY=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 YY{constructor(){this.grammars=[],this.logger=We.getInstance(),this._curRank=0,this._committed=new GY((t=>t.uid)),this._heap=new WY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return UY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>h(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new GY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return UY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const XY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===tV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class $Y{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(hV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return RT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gk.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(hV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Cj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(hV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(hV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(hV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new JM(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=d(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new eC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class KY extends CW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?FN(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(m(t)&&m(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function rX(t,e,i){FN(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=FN(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),h(null==n?void 0:n.clamp)||(l(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function aX(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i),rX(t,e,i)}function oX(t,e,i){t.round&&e.round(FN(t.round,i,e),!0),t.padding&&e.padding(FN(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(FN(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(FN(t.paddingOuter,i,e),!0),t.align&&e.align(FN(t.align,i,e),!0)}function lX(t,e,i,n){const s=t.field,r=zN(t.data,i),a=f(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),zl(e.type)?(n&&a.filter((t=>v(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function hX(t,e,i){if(ZY(t.domain)?e.domain(lX(t.domain,e,i,!0),!0):e.domain(FN(t.domain,i,e),!0),ZY(t.range))e.range(lX(t.range,e,i),!0);else if(JY(t.range)){const n=zN(t.range.coordinate,i);!function(t){switch(t){case Fl.Quantile:case Fl.Quantize:case Fl.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(FN(t.range,i,e),!0);switch(t.type){case"linear":aX(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){oX(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){aX(t,e,i);const n=FN(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i);const n=FN(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){aX(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){aX(t,e,i);const n=FN(t.constant,i,e);b(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class cX extends CW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=qY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=qY(this.spec.type)),hX(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return h(this.spec.domain)||this.detach(tX(this.spec.domain,this.view)),this.spec.domain=t,this.attach(tX(t,this.view)),this.commit(),this}range(t){return h(this.spec.range)||this.detach(tX(this.spec.range,this.view)),this.spec.range=t,this.attach(tX(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!h(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!h(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return h(e)?null:this.parameters()[e]}configure(t){return this.detach(eX(this.spec.type,t,this.view)),h(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(eX(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let dX=-1;const uX=[HW,jW,WW,NW,VW,GW,UW],pX=t=>{var e,i,n,s;return v(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},gX=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:RV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:TV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:CV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:PV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},fX=(t,e)=>(null==e?void 0:e.debounce)?gt(t,e.debounce):(null==e?void 0:e.throttle)?ft(t,e.throttle):t,mX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:OW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):zV[t]?(i.markType=t,i.source=e):i.source=t===LW?LW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},yX={},_X=()=>yX;let vX=class extends $W{constructor(t,e){super(t,tV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return dV.rect}evaluateJoin(t){return super.evaluateJoin(wV)}};function bX(t,e){if(b(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return b(t)?t*e:0}return 0}function xX(t,e){return Math.min(t<0?t+e:t-1,e)}function SX(t,e,i){let n=xX(t,i),s=xX(e,i);if(b(t)||b(e)?b(t)?b(e)||(n=xX(Math.max(0,s-1),i)):s=xX(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const wX=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>bX(t,i))),u=l.map((t=>bX(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=SX(e,i,r),{start:h,end:c}=SX(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},AX=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=ml(r.maxChildWidth,s.width()),o=ml(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=pX(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==tV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(l(r))r.call(null,t,s,a,e);else if(l(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=AX(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(NW,o),i.updateSignal(VW,l),i.updateSignal(WW,h)}else AX(t,s,a,e);else"grid"===r.display&&wX(t,s,a);kX(s,e,i)}))};class MX extends $W{constructor(t,e,i){super(t,tV.glyph,i),this.glyphType=e,this.glyphMeta=XN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=jV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let CX=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return h(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return h(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return m(t)?(i.x=t[0],i.y=t[1]):v(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new qt,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class TX extends CX{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=h(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=h(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=m(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class EX extends CX{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Yt(s);const r=rt(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function PX(t){switch(t){case"cartesian":default:return new TX;case"polar":return new EX}}class RX extends CW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=PX(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=PX(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,c;!h(t.start)&&e.start(null!==(n=FN(t.start,i))&&void 0!==n?n:[0,0]),!h(t.end)&&e.end(null!==(s=FN(t.end,i))&&void 0!==s?s:[0,0]),!h(t.origin)&&e.origin(null!==(r=FN(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!h(t.translate)){const e=FN(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!h(t.rotate)){const e=FN(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!h(t.scale)){const e=FN(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}h(t.transpose)||FN(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const BX=Symbol.for("key");class IX{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i[0]}):h(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=hW(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=hW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!h(e.morphElementKey)){const i=jN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i}):h(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:BX})),r=hW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:BX}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==BX){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=FN(i.animation.delay,s,o,l),d=FN(i.animation.duration,s,o,l),u=FN(i.animation.oneByOne,s,o,l),p=FN(i.animation.splitPath,s,o,l),g=b(u)&&u>0?t=>v(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(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);yT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>pT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>fT(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:MA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new mT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:fC,null!==(l=i.easing)&&void 0!==l?l:mC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:MA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new _T({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:fC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:mC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):yT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class DX{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=f(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),h(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),h(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),h(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),h(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class LX{constructor(t){this.view=t}stop(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.stop()})),this}pause(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.pause()})),this}resume(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.resume()})),this}enable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.enable()})),this}disable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.disable()})),this}enableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.enableAnimationState(t)})),this}disableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.disableAnimationState(t)})),this}animate(){return this.view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){}}class OX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=mV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===Fl.Band){if(!h(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===Fl.Band){if(!h(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:dV.rect}addGraphicItem(t,e){const i=HV(this,this.coord&&"polar"===this.coord.output().type?tV.arc:tV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class FX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=mV(e,t,i,s);if(h(r.size)){const t=n.x?yV(n.x):void 0,e=n.y?yV(n.y):void 0;h(t)&&h(e)?r.size=10:h(t)?r.size=e:h(e)&&(r.size=t),r.size=[t,e]}return h(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(v(i.padding)&&i.padding>0)t.size=m(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(m(i.padding)&&2===i.padding.length){const e=m(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(dV.symbol)}release(){super.release(),this._encoders=null}}var zX=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 HX extends r{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV],s=YW(0,t,n,e,OW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){f(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new KY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new jY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new cX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new RX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=f(e)?this.getMarkById(e):e;let s;switch(t){case tV.group:s=new vX(this,n);break;case tV.glyph:s=new MX(this,null==i?void 0:i.glyphType,n);break;case tV.component:s=((t,e,i,n)=>{switch(e){case eV.axis:return new PY(t,i,n);case eV.legend:return new RY(t,i);case eV.crosshair:return new IY(t,i);case eV.slider:return new DY(t,i);case eV.label:return new LY(t,i);case eV.datazoom:return new OY(t,i);case eV.player:return new FY(t,i);case eV.tooltip:return new zY(t,i)}return new KW(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case tV.interval:s=new OX(this,t,n);break;case tV.cell:s=new FX(this,t,n);break;default:s=new $W(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(tV.group,t)}glyph(t,e){return this.mark(tV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(tV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(tV.component,t,{componentType:eV.axis,mode:e})}legend(t){return this.mark(tV.component,t,{componentType:eV.legend})}crosshair(t){return this.mark(tV.component,t,{componentType:eV.crosshair})}slider(t){return this.mark(tV.component,t,{componentType:eV.slider})}label(t){return this.mark(tV.component,t,{componentType:eV.label})}datazoom(t){return this.mark(tV.component,t,{componentType:eV.datazoom})}player(t){return this.mark(tV.component,t,{componentType:eV.player})}tooltip(t){return this.mark(tV.component,t,{componentType:eV.tooltip})}customized(t,e){const i=(t=>yX[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=f(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&uX.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(hV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++dX;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(HW,t.width),this.updateSignal(jW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=_X();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(hV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=lV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:HW,value:null!==(i=t[HW])&&void 0!==i?i:0},{id:jW,value:null!==(n=t[jW])&&void 0!==n?n:0},{id:WW,value:pX(null!==(s=t[WW])&&void 0!==s?s:e[WW])},{id:NW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[HW]-i.left-i.right},dependency:[HW,WW]}},{id:VW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[jW]-i.top-i.bottom},dependency:[jW,WW]}},{id:GW,update:{callback:(t,e)=>{const i=pX(e[WW]);return(t||new Vt).setValue(i.left,i.top,i.left+e[NW],i.top+e[VW])},dependency:[NW,VW,WW]}},{id:UW,value:null!==(r=t[UW])&&void 0!==r?r:e[UW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===tV.glyph?{glyphType:t.glyphType}:t.type===tV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(HW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(NW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(VW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(WW);if(arguments.length){const i=pX(t);return this.updateSignal(e,i),i}return pX(e.output())}autoFit(t){const e=this.getSignalById(UW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(GW);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=lV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===tV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||kX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(hV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(hV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(hV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{XY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(hV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(hV.BEFORE_MARK_RENDER_END),XY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(hV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return zX(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return zX(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(hV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(hV.AFTER_DO_RENDER)}evaluate(t){var e,i;return zX(this,void 0,void 0,(function*(){const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!uX.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return XY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=en(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return zX(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(HW,t)),e!==this.height()&&(n=!0,this.updateSignal(jW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,c=mX(e);if(!c)return;const{source:u,type:p}=c,g=h((v=c).markId)?t=>t&&t.mark.id()===v.markId:h(v.markName)?t=>t&&t.mark.name()===v.markName:h(v.type)?t=>t&&t.mark.markType===v.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:f(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),y=DN(l,this),_=fX(((t,e)=>{const n=u===OW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===LW&&(t=YW(0,t,e,p,LW));let s=!1;if((!i||i(t))&&(!g||g(e))&&m.length){const e=y.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var v;if(u===OW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||d(n)&&!n[i])}(this._eventConfig,OW,p))return this.addEventListener(p,_,FW),()=>{this.removeEventListener(p,_)}}else if(u===LW)return gj.addEventListener(p,_),this._eventListeners.push({type:p,source:gj,handler:_}),()=>{gj.removeEventListener(p,_);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===gj&&t.handler===_));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);f(e)?i.type=e:d(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:zW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?f(r)?r:r.user:zW,o=r&&a===r.user&&(s===r.element||h(s)&&h(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==zW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!h(document)&&document.body:this.container;return e?h(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new $Y(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new DX((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new DX((t=>t.id())),this._options.logger&&We.setInstance(this._options.logger),this.logger=We.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new YY,this.animate=new LX(this),this._morph=new IX,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{m(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[OW,LW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&gj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=lV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==tV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=gj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&gj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),EN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const jX=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{TN(e,t[e],!0)}))}))};jX(_V);const NX=["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 VX,WX,GX;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(VX||(VX={})),function(t){t.chart="chart",t.window="window"}(WX||(WX={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(GX||(GX={}));const UX=`${Kj}_waterfall_default_seriesField`,YX=`${Kj}_DEFAULT_DATA_INDEX`,XX=`${Kj}_DEFAULT_DATA_KEY`,$X=`${Kj}_DEFAULT_DATA_SERIES_FIELD`,KX=`${Kj}_DEFAULT_SERIES_STYLE_NAME`;var qX;!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.Built_In=99]="Built_In"}(qX||(qX={}));const ZX=`${Kj}_STACK_START`,JX=`${Kj}_STACK_END`,QX=`${Kj}_STACK_START_PERCENT`,t$=`${Kj}_STACK_END_PERCENT`,e$=`${Kj}_STACK_START_OffsetSilhouette`,i$=`${Kj}_STACK_END_OffsetSilhouette`,n$=`${Kj}_SEGMENT_START`,s$=`${Kj}_SEGMENT_END`;var r$,a$;!function(t){t[t.Axis_Grid=100]="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"}(r$||(r$={})),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"}(a$||(a$={}));const o$=["linear","radial","conical"],l$={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}},h$={innerRadius:0,outerRadius:1,startAngle:wN,endAngle:AN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var c$,d$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(c$||(c$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(d$||(d$={}));const u$={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,tickSize:Ij,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Ij/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Rj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Rj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},p$={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},g$={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},f$={name:"light",padding:12,fontFamily:Pj,colorScheme:{default:{dataScheme:[{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"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Yj,line:Nj,area:Dj,bar:Lj,bar3d:Oj,pie:Wj,pie3d:Gj,map:Vj,radar:Uj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:Fj,funnel3d:zj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:Xj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:jj,treemap:$j,sunburst:h$,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Rj},minLabel:{position:d$.end},maxLabel:{position:d$.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Rj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...g$,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...g$,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...g$},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...g$}},axis:u$,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10},maxHeight:"30%"},axisY:{label:{space:20},title:{space:20,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Rj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Rj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!0,background:{size:6,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:4,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:p$,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Bj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Rj,lineHeight:Bj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:12,fontWeight:"bold",fill:"#4E5969"},contentStyle:{fontSize:12,fill:"#4E5969"},panel:{visible:!0,fill:"#fff",stroke:"#ffffff",lineWidth:0,cornerRadius:3,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:"rgba(0, 0, 0, 0.1)",size:0,space:12}}}},m$=new Map([[f$.name,f$]]),y$=f$.name;class _${static instances=new Map;static registerInstance(t){_$.instances.set(t.id,t)}static unregisterInstance(t){_$.instances.delete(t.id)}static getInstance(t){return _$.instances.get(t)}static instanceExist(t){return _$.instances.has(t)}static forEach(t,e=[],i){const n=N(e);return _$.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class v${static themes=new Map;static _currentThemeName=y$;static registerTheme(t,e){t&&v$.themes.set(t,L({},v$.getDefaultTheme(),e))}static getTheme(t){return v$.themes.get(t)||v$.getDefaultTheme()}static removeTheme(t){return v$.themes.delete(t)}static themeExist(t){return v$.themes.has(t)}static getDefaultTheme(){return v$.themes.get(y$)}static setCurrentTheme(t){v$.themeExist(t)&&(v$._currentThemeName=t,_$.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return v$.getTheme(v$._currentThemeName)}static getCurrentThemeName(){return v$._currentThemeName}}v$.registerTheme(y$,m$.get(y$)),m$.forEach(((t,e)=>{e!==y$&&v$.registerTheme(e,t)}));const b$=(t,e,i)=>new He({defaultFontParams:{fontFamily:Ej,fontSize:14},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),x$=fB({});function S$(t,e){for(let i=0;it.key===e))}function A$(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const k$=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sP$(t.style(e,i,n,s)):M(t.style)||(e.style=P$(t.style)),!M(t.state)){const i={};Object.keys(t.state).forEach((e=>{l(t.state[e])?i[e]=(i,n,s,r)=>P$(t.state[e](i,n,s,r)):M(t.state[e])||(i[e]=P$(t.state[e]))})),e.state=i}return e}function T$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e,n,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function E$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e.rawValue,n,e,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function P$(t){return M(t)||t.angle&&(t.angle=Gt(t.angle)),t}var R$;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.image="image",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(R$||(R$={}));class B${static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Qa,fields:io,filter:pn,fold:eo};static dataParser={csv:fo,dsv:go,tsv:mo};static _layout={};static registerChart(t,e){B$._charts[t]=e}static registerSeries(t,e){B$._series[t]=e}static registerComponent(t,e){B$._components[t]=e}static registerMark(t,e){B$._marks[t]=e}static registerRegion(t,e){B$._regions[t]=e}static registerTransform(t,e){B$.transforms[t]=e}static registerLayout(t,e){B$._layout[t]=e}static createChart(t,e,i){if(!B$._charts[t])return null;return new(0,B$._charts[t])(e,i)}static createRegion(t,e,i){if(!B$._regions[t])return null;return new(0,B$._regions[t])(e,i)}static createSeries(t,e,i){if(!B$._series[t])return null;return new(0,B$._series[t])(e,i)}static createMark(t,e,i){if(!B$._marks[t])return null;const n=new(0,B$._marks[t])(e,i);return n.type===R$.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(B$._components)}static getComponentInKey(t){return B$._components[t]}static getLayout(t){return B$._layout[t]}static getSeries(t){return B$._series[t]}}const I$=(t,e,i)=>{const n=t.getRegionsInIds(N(e.layoutBindRegionID));return 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})}))},D$=(t,e)=>t===e||!h(t)&&!h(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),L$=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},O$="monotone",F$="linearClosed";var z$;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(z$||(z$={}));var H$;function j$(t){return"bottom"===t||"top"===t}function N$(t){return"left"===t||"right"===t}function V$(t){return"z"===t}function W$(t,e){return Uh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(H$||(H$={}));const G$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&I$(t,n,i)));return n.length?n:null},U$=t=>t.fieldX[0],Y$=t=>t.fieldY[0],X$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=$$(t,n,"x",U$);e&&o.push(e)})),a&&a.forEach((t=>{const e=$$(t,s,"y",Y$);e&&o.push(e)})),o.length?o:null},$$=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return K$(t,a,n)},K$=(t,e,i)=>{const n=t.getScale();if(!n||!jl(n.type))return null;if(h(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=L$(e,t,"cartesian",i??(j$(t.orient)?U$:Y$));return{index:s,value:e,axis:t,data:r}},q$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&I$(t,n,i)));return n.length?n:null},Z$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&jl(e.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=Il({x:1,y:0},d);u=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(u,r);const p=Dl(d),g=a[0]?.getScale(),f=g?.range();if((u-r?.[0])*(u-r?.[1])>0||(p-f?.[0])*(p-f?.[1])>0)return;const m=Math.abs(r[0]-r[1])/i.length/2,y=e.invert(u+m);if(h(y))return;let _=e.domain().findIndex((t=>t?.toString()===y.toString()));_<0&&(_=void 0);const v=L$(y,t,"polar",l);o.push({index:_,value:y,axis:t,data:v})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&jl(e.type)){const a=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let d=Il({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const u=Dl(c),p=r[0]?.getScale(),g=p?.range();if((d-g?.[0])*(d-g?.[1])>0||(u-i?.[0])*(u-i?.[1])>0)return;const f=e.invert(u);if(h(f))return;let m=e.domain().findIndex((t=>t?.toString()===f.toString()));m<0&&(m=void 0);const y=L$(f,t,"polar",l);o.push({index:m,value:f,axis:t,data:y})}})),o.length?o:null};class J${_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=X$(this._chart,{x:t,y:e})??[],n=Z$(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!jl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=K$(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var Q$;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Q$||(Q$={}));const tK={[Q$.dimensionHover]:class extends J${_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:WX.chart},callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:WX.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!D$(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[Q$.dimensionClick]:class extends J${constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:WX.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let eK=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(tK[t]){const e=new tK[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(tK[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class iK{_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(GX.vchart,[]),this._levelNodes.set(GX.chart,[]),this._levelNodes.set(GX.model,[]),this._levelNodes.set(GX.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),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=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const nK={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 sK{globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||WX.chart),n=this.getEventListeners(e.filter?.source||WX.chart);i.get(t)||i.set(t,new iK);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||WX.chart),s=this.getEventListeners(e?.filter?.source||WX.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||WX.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||WX.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(GX.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(GX.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(WX.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(WX.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if(l(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&C(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return nK[n]&&(n=nK[n]),(!t.type||n===t.type)&&(!c(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=c(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=c(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&c(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();c(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:C(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:c(t.id)?GX.model:GX.vchart:GX.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ft(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=gt(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=WX.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==GX.model&&i!==GX.mark||(n=e.type),e?.source&&(s=e.source),c(e?.id)&&(o=e?.id,i=GX.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case WX.chart:return this._viewBubbles;case WX.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case WX.chart:return this._viewListeners;case WX.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return NX.includes(t)||Object.values(hV).includes(t)||Object.values(VX).includes(t)}}function rK(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function aK(t,e,i){t.getParser(e)||t.registerParser(e,i)}const oK=new Map;let lK;function hK(t,e,i={type:"geojson",centroid:!0}){oK.has(t)&&Yo(`map type of '${t}' already exists, will be overwritten.`),lK||(lK=new jo,aK(lK,"geojson",Do),aK(lK,"topojson",Oo),rK(lK,"simplify",Qa));const n=new Vo(lK),s=L({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),oK.set(t,n)}function cK(t,e=!1){let i=e;return t.latestData instanceof Vo&&(i=!1),i?R(t.latestData):t.latestData.slice()}const dK=(t,e)=>0===t.length?[]:1===t.length?cK(t[0],e?.deep):t.map((t=>cK(t,e?.deep)));function uK(t,e,i){rK(e=e instanceof jo?e:t.dataSet,"copyDataView",dK);const n=new Vo(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function pK(t,e,i=[]){if(t instanceof Vo)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new Vo(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!f(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Xo("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const gK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)}}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!f(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&gj.getCancelAnimationFrame()(this._rafId),this._rafId=gj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const n=function(n,s){const r=s?.mark?.context??{},a=c(r.modelId)?r.modelId:null,o=c(r.markId)?r.markId:null,l=c(r.modelUserId)?r.modelUserId:null,h=c(r.markUserId)?r.markUserId:null,d={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,d)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===WX.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();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===WX.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(h(e))return;const i=e.id(),n=t.grammarType;h(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(h(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];c(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return c(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return Zo(this._option.mode)?globalThis:this.getStage()?.window}}async function SK(t){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){console.error("getCanvasDataURL",t)}return t.toDataURL()}class wK{id=el();static useChart(t){t.forEach((t=>B$.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>B$.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>B$.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>B$.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>B$.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){B$.registerTransform(t,e)}static registerMap(t,e,i){hK(t,e,i)}static unregisterMap(t){!function(t){oK.has(t)?oK.delete(t):Yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,oK.get(e);var e}static hideTooltip(t=[]){_$.forEach((t=>t?.hideTooltip?.()),t)}static InstanceManager=_$;static ThemeManager=v$;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=L(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,poptip:a,...o}=this._option;i&&(this._container=f(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=v$.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new xK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,pluginList:!1!==a?["poptipForText"]:[],...o,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new sK(this,this._compiler),this._event=new eK(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!Zo(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(VX.initialized,{}),_$.registerInstance(this)):Xo("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=Jh(f(t)?JSON.parse(t):t))}_initData(){if(h(this._dataSet))return void Yo("dataSet is not initialized");const t=N(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Xo("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=gt(((...t)=>{const{width:e,height:i}=en(this._container,qj,Zj),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof jo?t:new jo,aK(this._dataSet,"dataview",Fo),aK(this._dataSet,"array",cn),rK(this._dataSet,"stackSplit",gK),rK(this._dataSet,"copyDataView",dK);for(const t in B$.transforms)rK(this._dataSet,t,B$.transforms[t]);for(const t in B$.dataParser)aK(this._dataSet,t,B$.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return c(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),oK.clear(),lK=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,_$.unregisterInstance(this)}async updateData(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):m(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(f(t)&&(t=JSON.parse(t)),e&&(t=L({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=Jh(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}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)}_updateCurrentTheme(){var t;f(this._spec?.theme)?(this._currentTheme=L({},v$.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=L({},v$.getTheme(this._currentThemeName),this._spec?.theme??{}),t=L({},this._currentTheme.component?.poptip),L(xG.poptip,bG,t)}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return v$.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===un.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(c(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await SK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!Zo(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await 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):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(c(this._container))return this._container;let t;return t=f(this._canvas)?document?.getElementById(this._canvas):this._canvas,c(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(M(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),Zh(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||h(t)||M(e))return null;if(!m(t)){const{axisId:n,axisIndex:s}=e;let r;if(c(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):c(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Yo("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?Zh(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!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"}(yK||(yK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(_K||(_K={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(vK||(vK={}));class AK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){h(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,L({},AK.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]}getMarksInType(t){const e=N(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]))))}}class kK{event;interaction;_option;_marks=new AK;_markReverse=new AK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){M(t.stateStyle[yK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),M(t.stateStyle[yK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Q$.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=m(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(yK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(yK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class MK{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class CK extends MK{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=a$.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Kh(qh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=h(t.minHeight)?null:$h(t.minHeight,e.height,e),this._maxHeight=h(t.maxHeight)?null:$h(t.maxHeight,e.height,e),this._minWidth=h(t.minWidth)?null:$h(t.minWidth,e.width,e),this._maxWidth=h(t.maxWidth)?null:$h(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:$h(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:$h(t.height,e.height,e)},{height:9}),h(t.offsetX)||(this.layoutOffsetX=$h(t.offsetX,e.width,e)),h(t.offsetY)||(this.layoutOffsetY=$h(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{h(this._spec[i])||(e[i]=$h(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};h(n)||(r.width-=n),h(s)||(r.width-=s),h(e)||(r.height-=e),h(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):(h(n)?h(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,h(e)?h(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){b(t)&&(this._layoutStartPoint.x=t),b(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){b(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),b(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}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={...t};return this._layoutRectLevelMap.width<9?(h(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),h(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(h(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),h(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class TK extends MK{grammarType;id=el();_product;getProduct(){if(c(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return c(e)&&c(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){c(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(c(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(c);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class EK extends TK{grammarType=mK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}c(this._value)&&this._product.value(this._value),c(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class PK extends MK{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new EK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class RK extends PK{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(L(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class BK extends RK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class IK extends CK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new AK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=el(),this._originalSpec=t,this._spec=Qh(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new eK(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new BK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Qh(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(h(t)||h(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=L({},e?.[N(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),m(t))return t.map((t=>d(t)&&!l(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];d(n)&&!l(n)&&(Fh(n)?e[i]=Oh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){c(t)&&c(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!c(t)||!c(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${Kj}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=B$.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const DK={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},LK={symbol:function(t,e){return"shape"===t?DK[e]??e:e}};const OK={};Object.values(yK).forEach((t=>{OK[t]=!0}));const FK={[yK.STATE_HOVER]:yK.STATE_HOVER_REVERSE,[yK.STATE_SELECTED]:yK.STATE_SELECTED_REVERSE,[yK.STATE_DIMENSION_HOVER]:yK.STATE_DIMENSION_HOVER_REVERSE};function zK(t){return FK[t]}class HK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!M(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=zK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=zK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=zK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=zK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class jK extends RK{id=el();stateKeyToSignalName=t=>`${Kj}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===fK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===fK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}}}}class NK extends IK{static type="region";modelType="region";type=NK.type;_series=[];layoutType="region";layoutZIndex=r$.Region;animate;interaction=new HK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler})),c(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:R$.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",qX.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",qX.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:R$.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:R$.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",qX.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(r$.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",qX.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",qX.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",qX.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):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=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||N(t.userId).includes(e.userId))&&(!c(t.specIndex)||!e.getSpecIndex||N(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||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(VX.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new kK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in _K)M(t.stateStyle[_K[e]])||this.interaction.registerMark(_K[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class VK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const WK=[R$.line,R$.area,"trail"];function GK(t){return WK.includes(t)}class UK extends RK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),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];c(n.domain)&&(s.domain=n.domain),c(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=o(GK)?n:!t.mark||GK(t.mark.markType);let s=!1,r=!1;if(c(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!OK[t])).map((t=>[t,10])),n=!t.mark||GK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(m(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Kj)));n=t.datums.some((t=>i&&m(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(d(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Kj)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(zl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class YK extends TK{grammarType=mK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();h(t)||(h(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class XK extends YK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return c(t)?t:`${Kj}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct(t)}}class $K extends TK{grammarType=mK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=r$.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){c(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){h(this._data)&&this.initMarkData({...this._option,mark:this}),c(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new UK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new eK(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new XK(t)}stateKeyToSignalName(t){return`${Kj}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(c(e)&&this.removeProduct());if(c(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),h(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(h(this._data))return;this._data.compile();const t=this._data.getProduct();c(this._product)&&c(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[yK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!l(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(hV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===fK.appear&&this.runAnimationByState(fK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),LK[a]?LK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class KK extends $K{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(c(t.id)&&(this._userId=t.id),o(t.interactive)&&(this._interactive=t.interactive),c(t.zIndex)&&this.setZIndex(t.zIndex),o(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(v(t))return Sl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Sl)),t}return"function"==typeof t?(e,i,n,s)=>Sl(t(e,i,n,s)):t}isUserLevel(t){return[qX.User_Mark,qX.User_Series,qX.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];h(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;c(r)&&r<=n&&L(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return f(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=Nh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;return s=this.stateStyle[i]?.[t]?this._computeStateAttribute(this.stateStyle[i][t],t,e,i,n):this._computeStateAttribute(this.stateStyle.normal[t],t,e,i,n),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,s):s}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):o$.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):Hl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",qX.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=l(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,qX.User_Mark,e)}else this.setStyle(i,t,qX.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let h=s,d=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(h=t),d||(d=e)}const u=Dh(Ih(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),p={},g={...l$[n],...a};return Object.keys(g).forEach((t=>{const n=g[t];"stops"===t?p.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??h?.scale(e[d]);return l(s)&&(a=s(e,this._attributeContext,i,o)),c(n)&&(a=Uo.SetOpacity(a,n)),{offset:l(r)?r(e,this._attributeContext,i,o):r,color:a||u[0]}})):l(n)?p[t]=n(e,this._attributeContext,i,o):p[t]=n})),p.gradient=n,p}_computeThresholdAttr(t){return(new Th).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class qK extends KK{static type=R$.group;type=qK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Yo("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?(Yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class ZK extends KK{static type=R$.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(tV.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}class JK extends KK{static type=R$.image;type=JK.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}wK.useMark([ZK,qK,JK]),B$.registerRegion("region",NK),B$.registerLayout("base",VK);var QK,tq,eq;We.getInstance(Ve.Error),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(QK||(QK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(tq||(tq={}));class iq{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Nh("colorOrdinal"):Nh(t.type)),e?(m(t.range)&&e.range(t.range),m(t.domain)&&(nl(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),nl(n.domain)?e.reRender=!0:z(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)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{nl(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{S$(e,[{key:t,operations:zl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&S$(e,[{key:i.field,operations:zl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!nl(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=zl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{zl(e.type)?(h(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),h(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;zl(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){if(!h(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(zl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(zl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));zl(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(h(t.field)||!h(t.changeDomain)&&"none"!==t.changeDomain&&!h(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class nq{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(VX.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][JX]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[JX],s>=0?(t[ZX]=e,e+=t[JX],t[JX]=e):(t[ZX]=i,i+=t[JX],t[JX]=i)})),t.values.forEach((t=>{s=t[JX];const r=s>=0?e:i;n=s>=0?1:-1,t[QX]=Math.min(1,t[ZX]/r)*n,t[t$]=Math.min(1,t[JX]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[JX]=function(t){if(b(t))return t;const e=+t;return b(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class sq extends MK{type="chart";id=el();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:qj,height:Zj};getLayoutRect(){return this._layoutRect}_viewRect={width:qj,height:Zj};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:qj,y2:Zj};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=qh(t.padding??this._theme?.padding),this._event=new eK(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new nq(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),E(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=B$.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=pK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),c(t.regionId)?i=this.getRegionsInUserId(t.regionId):c(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&N(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=B$.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(B$.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(VX.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(VX.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>N(t).some((t=>c(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof IK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof KK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof KK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(c(t)&&c(e))this._canvasRect={width:t,height:e};else{let i=qj,n=Zj;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=en(this._option.container,qj,Zj);i=t,n=e}else if(r&&Zo(this._option.mode)){let t;t=f(r)?document?.getElementById(r):r;const{width:e,height:s}=en(t,qj,Zj);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;if(m(t))e.range=t.map((t=>Oh(t,this._theme?.colorScheme)));else{const i=t;Object.prototype.hasOwnProperty.call(i,"type")&&(e.type=i.type),Object.prototype.hasOwnProperty.call(i,"domain")&&(e.domain=i.domain),Object.prototype.hasOwnProperty.call(i,"range")&&(e.range=i.range),Object.prototype.hasOwnProperty.call(i,"specified")&&(e.specified=i.specified)}}return e.range?.length||(e.range=Ih(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new iq(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Ih(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&N(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};m(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Kh(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}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(M(t[n]))continue;const s=t[n];let r={stateValue:n};r=l(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(yK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(yK.STATE_HOVER,!0,t,e,i)}initEvent(){[VX.dataZoomChange,VX.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(hV.AFTER_MARK_RENDER_END,e)};this._event.on(hV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||l(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===Q$.dimensionHover||s===Q$.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===un.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===un.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class rq extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}function aq(t){t.crosshair=N(t.crosshair||{}).map((e=>L({[t.direction===Gh.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(eq||(eq={}));const oq=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!h(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!h(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!h(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=c,(h(o)||o===UX)&&(t[UX]=c?l.total:+t[n]>=0?l.increase:l.decrease)})),f={...i,lastIndex:t},d.push(i)})),d},lq=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},hq=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:cq(t.map((t=>t.latestData)).flat(),e.fields,i)}};function cq(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>cq(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class dq{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new Vo(e instanceof jo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),rK(e,"dimensionTree",hq),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const uq=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},pq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class gq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new AK;_markReverse=new AK;constructor(t,e){this._spec=t,this._option=e,this.event=new eK(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(yK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(yK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(N(i).forEach((e=>{t.on(e,{level:GX.chart},this.onHover)})),n&&"none"!==n&&N(n).forEach((e=>{t.on(e,{level:GX.vchart,source:WX.chart},this.onUnHover)}))),s&&(N(r).forEach((e=>{t.on(e,{level:GX.mark},this.onSelect)})),a&&"none"!==a&&N(a).forEach((e=>{t.on(e,{level:GX.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=pq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;o(i)?this._hover.enable=i:d(i)&&(this._hover.enable=!0,this._hover=L(this._hover,i));const n=this._spec.select;o(n)?this._select.enable=n:d(n)&&(this._select.enable=!0,this._select=L(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,yK.STATE_HOVER)||this.interaction.getEventElement(yK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(yK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(yK.STATE_HOVER,t.item),this.interaction.reverseEventElement(yK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(yK.STATE_HOVER);this.interaction.clearEventElement(yK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(yK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,yK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(yK.STATE_SELECTED);this.interaction.clearEventElement(yK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(yK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(yK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(yK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(yK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(yK.STATE_SELECTED);const e=this.interaction.getEventElementData(yK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class fq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const mq=(t,e)=>c(e)?t.map((t=>e[t])):void 0,yq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),_q=t=>!h(t)&&(m(t)?t.length>0&&t.every(c):Object.keys(t).length>0);function vq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(c(s.regionId)?[s.regionId]:void 0,c(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=c(s)?t[s]:void 0,a=c(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=mq(i,t);let d=mq(n,t);const u=_q(d),p=!u&&c(s)&&h(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,c=i.map(((t,e)=>[t,e])).filter((([,t])=>h(l?.[t])));let g=[l??[]];c.length>0&&c.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];g.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),g=s})),g.forEach((l=>{if(p){const r=t.getViewData()?.latestData.filter(yq(i,l));a.forEach((a=>{const c=r.find((t=>t[s]===a));if(d=mq(n,c),!_q(d))return;const p=t.dataToPosition(c);h(p)||isNaN(p.x)||isNaN(p.y)||o.push({pos:p,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===tq.pie){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToCentralPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}else{const t=e;if(p){const c=t.getViewData()?.latestData.filter(yq(i,l)),p=c.find((t=>t[s]===r));a.forEach((r=>{if(d=mq(n,p),!_q(d))return;const a=t.dataToPosition(p);h(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),d=r.getLayoutStartPoint(),u=r.getLayoutRect(),p=n.globalInstance.getContainer(),g={x:0,y:0,...p?nn(p):{}},f=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>yq(e,i)(t)&&yq(n,s)(t)&&(h(r)||yq([r],[a])(t))));return o},m=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),u.width),y:Math.min(Math.max(t.y,0),u.height)}))(t),i=s.x??d.x+e.x,n=s.y??d.y+e.y;return{canvasX:i,canvasY:n,clientX:g.x+i,clientY:g.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>f(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:WX.chart,event:m({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...f(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:WX.chart,event:m(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),l}return"none"}const bq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return c(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function xq(t){return h(t.mark)&&h(t.model)&&h(t.datum)}class Sq extends fq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];c(i)&&(e[t]={...i,title:c(i.title)?l(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:c(i.content)?l(i.content)?i.content:N(i.content).map((t=>l(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=bq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:c(e)?N(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of N(e)){const e=this.series.getSeriesStyle(t)?.(i);if(c(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const wq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},Aq={min:t=>t===wq.min()?0:t,max:t=>t===wq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===wq.min()?0:t,"array-max":t=>t===wq.max()?0:t};const kq={min:function(t,e){return il(e)?Math.min(t,e):t},max:function(t,e){return il(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.max(t,...i)}},Mq=(t,e)=>{const i={};let n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;n=S$([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!h(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=wq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=kq[n](i[t.key][n],s)})),i[t.key][n]=Aq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},Cq=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>il(t[s])));else if("zero"===n)return t.forEach((t=>{il(t[s])||(t[s]=0)})),t;return t};class Tq extends YK{_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const Eq=`${Kj}_HIERARCHY_DEPTH`,Pq=`${Kj}_HIERARCHY_ROOT`,Rq=`${Kj}_HIERARCHY_ROOT_INDEX`,Bq=()=>({keyMap:new Map});function Iq(t,e,i){t&&(this._seriesField||(t[$X]=this.getSeriesKeys()[0]),t[YX]=e,t[XX]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function Dq(t,e,i,n=0,s,r){void 0===r&&(r=e),Iq.bind(this)(t,e,i),t[Eq]=n,t[Pq]=s||t[this.getCategoryField()],t[Rq]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>Dq.bind(this)(e,n,i,t[Eq]+1,t[Pq],r)))}class Lq extends IK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[QK.label]:{name:QK.label,type:R$.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(VX.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&c(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(VX.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(h(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),o(this._spec.stack)&&(this._stack=this._spec.stack),o(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),o(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),c(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=uK(this._rawData,this._dataSet,{name:`${Kj}_series_${this.id}_viewDataFilter`});const t=uK(this._viewDataFilter,this._dataSet,{name:`${Kj}_series_${this.id}_viewData`});this._data=new Tq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(rK(this._option.dataSet,"invalidTravel",Cq),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new dq(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${Kj}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){rK(this._dataSet,"dimensionStatistics",Mq);const n=new Vo(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=S$(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&S$(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${Kj}_series_${this.id}_viewStackData`;this._viewStackData=new Vo(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(h(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(f(t))return e[t];if(m(t)&&t.every((t=>f(t))))return t.map((t=>e[t])).join("-");if(l(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(VX.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(VX.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(VX.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(VX.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(VX.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||h(e)?[]:f(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:R$.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||h(t.dataId)&&h(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new gq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??$X;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:KX,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,KX)}))}afterInitMark(){this.event.emit(VX.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",qX.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new Sq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??$X,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??$X}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=L({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:l,dataProductId:d,parent:u,isSeriesMark:p,dataStatistics:g,depend:f,label:m,progressive:y,support3d:_=this._spec.support3d||!!this._spec.zField,morph:v=!1}=e,b=super._createMark(t,{key:i??this._getDataIdKey(),support3d:_,dataStatistics:g??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(c(b)){this._marks.addMark(b),p&&(this._seriesMark=b),h(u)?this._rootMark?.addMark(b):!1!==u&&u.addMark(b),h(l)?(b.setDataView(this.getViewData(),this.getViewDataProductId()),b.setSkipBeforeLayouted(!0)):!1!==l&&b.setDataView(l,d),o(s)&&b.setSkipBeforeLayouted(s),c(f)&&b.setDepend(...N(f)),c(m)&&b.setLabelSpec(m);const t=this.getSpec()||{};b.setMorph(v),b.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),b.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),h(y)||b.setProgressiveConfig(y),h(n)||b.setGroupKey(n),this.initMarkStyleWithSpec(b,L({},r,a||t[b.name]))}return b}_getDataIdKey(){return super._getDataIdKey()??XX}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==JX&&t!==t$&&t!==ZX&&t!==QX||(t=this.getStackValueField()),A$(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=B$.getSeries(this.type);return Object.values(t.mark??{})}return t}}class Oq extends Lq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=N(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=N(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&N(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=Gh.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((e=>{const i={key:e,operations:[]};zl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((e=>{const i={key:e,operations:[]};zl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};zl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===Gh.vertical?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction===Gh.vertical?(this.setFieldY(JX),this.setFieldY2(ZX)):(this.setFieldX(JX),this.setFieldX2(ZX))}setValueFieldToPercent(){this.direction===Gh.vertical?(this.setFieldY(t$),this.setFieldY2(QX)):(this.setFieldX(t$),this.setFieldX2(QX))}setValueFieldToStackOffsetSilhouette(){this.direction===Gh.vertical?(this.setFieldY(i$),this.setFieldY2(e$)):(this.setFieldX(i$),this.setFieldX2(e$))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Go(t.xField,i)&&Go(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),c(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(this._spec?.x2Field),this.setFieldY2(this._spec?.y2Field),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{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)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}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._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===Gh.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===Gh.vertical?N(this._spec.yField??this.fieldY):N(this._spec.xField??this.fieldX)}}const Fq=(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};const zq={type:"clipIn"},Hq={type:"fadeIn"};function jq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Hq;default:return zq}}function Nq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=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 Vq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:Nq(t,e)}),Wq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:Nq(t,e)}),Gq={type:"fadeIn"},Uq={type:"growCenterIn"};function Yq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Gq;case"scaleIn":return Uq;default:return Vq(t)}}const Xq={type:"clipIn"},$q={type:"fadeIn"};function Kq(t,e){switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return $q;default:return Xq}}function qq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Zq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:qq(t,!0,fK.appear)}),Jq={type:"fadeIn"},Qq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:qq(t,!0,fK.enter)}),tZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:qq(t,!0,fK.exit)}),eZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:qq(t,!0,fK.exit)});function iZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Jq;case"growRadius":return Zq({...t,growField:"radius"});default:return Zq({...t,growField:"angle"})}}const nZ={type:"fadeIn"};function sZ(t,e){return"fadeIn"===e?nZ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function rZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aZ=t=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:rZ(t)}),oZ={type:"fadeIn"};function lZ(t,e){return!1===e?{}:"fadeIn"===e?oZ:(t=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:rZ(t)}))(t)}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=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const uZ=(t,e)=>({custom:BC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class pZ extends lC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;l(r)&&l(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);b(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);b(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class gZ extends PC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Ht(d,u,p,g);return f.defined=e.defined,f}}const fZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},mZ={type:"fadeIn"},yZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),_Z=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),vZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function bZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mZ;case"growAngle":return fZ({...t,growField:"angle"});default:return fZ({...t,growField:"radius"})}}const xZ={type:"fadeIn"},SZ={type:"growCenterIn"};function wZ(t,e){switch(e){case"fadeIn":return xZ;case"scaleIn":return SZ;default:return Vq(t,!1)}}const AZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},kZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),MZ={type:"fadeIn"},CZ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function TZ(t,e){return"fadeIn"===e?MZ:kZ(t)}const EZ=t=>({custom:DC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),PZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},RZ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===QN.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},IZ=(t,e,i)=>{if(M(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},DZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),LZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},OZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),FZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},zZ={type:"fadeIn"};function HZ(t){return!1===t?{}:zZ}const jZ={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"}},NZ={bar:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),bar3d:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),line:(t,e)=>({appear:Kq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:PC,duration:jZ.update.duration,easing:jZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:jq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),pie3d:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),rose:(t,e)=>({appear:bZ(t,e),enter:yZ(t),exit:_Z(t),disappear:vZ(t)}),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:cZ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:gZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:dZ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:pZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarGroup:(t,e)=>({appear:uZ(t,"in"),disappear:uZ(t,"out")}),circularProgress:(t,e)=>({appear:sZ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:AZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:lZ(t,e),enter:{type:"grow"},disappear:aZ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:IC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:IC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:EZ(t)}),rangeColumn:(t,e)=>({appear:TZ(t,e),enter:kZ(t),exit:CZ(t),disappear:CZ(t)}),waterfall:(t,e)=>({appear:wZ(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:PZ(0,e),enter:DZ(t),exit:OZ(t),disappear:OZ(t)}),circlePacking:(t,e)=>({appear:FZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:HZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:wU},update:{custom:SU},exit:{custom:LC}})},VZ=["appear","enter","update","exit","disappear","normal"];function WZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=l(n)?n(t,s,r):b(n)?n:0;let h=l(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(o+h))},delete t.oneByOne,t}function YZ(t){return t?.[YX]}function XZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function $Z(t){return!function(t){return c(t.timeSlices)}(t)&&c(t.channel)}class KZ extends KK{static type=R$.rect;type=KZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class qZ extends KK{static type=R$.text;type=qZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}wK.useMark([KZ,qZ]);class ZZ extends Oq{static type=tq.bar;type=tq.bar;_barMarkName=QK.bar;_barMarkType=R$.rect;static mark={...Lq.mark,[QK.bar]:{name:QK.bar,type:R$.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...ZZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e)},"normal",qX.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.bar(t,e),GZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Fq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Fq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Fq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class JZ extends KK{static type=R$.rule;type=JZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}wK.useMark([JZ]);class QZ extends ZZ{static type=tq.waterfall;type=tq.waterfall;static mark={...ZZ.mark,[QK.leaderLine]:{name:QK.leaderLine,type:R$.rule},[QK.stackLabel]:{name:QK.stackLabel,type:R$.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],h(this._seriesField)&&(this._seriesField=UX)}getSeriesKeys(){return this._seriesField===UX?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),rK(this._dataSet,"waterfallFillTotal",lq),rK(this._dataSet,"waterfall",oq),(h(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=uK(this.getViewData(),this._dataSet,{name:`${Kj}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new Tq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:ZX,endAs:JX,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(WZ(NZ.waterfall(t,e),GZ(QK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:i}))}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(QZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(QZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===Gh.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):Vh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===Gh.vertical?Vh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===Gh.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",qX.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",qX.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===Gh.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const tJ=`${Kj}_BOX_PLOT_OUTLIER_VALUE`;var eJ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(eJ||(eJ={}));const iJ=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];m(e)||(e=[e]),i.push(...e.map((e=>{const i={[tJ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class nJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(eJ.OUTLIER),value:this.getContentValue(eJ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(eJ.MAX),value:this.getContentValue(eJ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q3),value:this.getContentValue(eJ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MEDIAN),value:this.getContentValue(eJ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q1),value:this.getContentValue(eJ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MIN),value:this.getContentValue(eJ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.SERIES_FIELD),value:this.getContentValue(eJ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return this.series.getOutliersField();if(t===eJ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case eJ.MIN:return this.series.getMinField();case eJ.MAX:return this.series.getMaxField();case eJ.MEDIAN:return this.series.getMedianField();case eJ.Q1:return this.series.getQ1Field();case eJ.Q3:return this.series.getQ3Field();case eJ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return e[tJ];if(t===eJ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case eJ.MIN:return e[this.series.getMinField()];case eJ.MAX:return e[this.series.getMaxField()];case eJ.MEDIAN:return e[this.series.getMedianField()];case eJ.Q1:return e[this.series.getQ1Field()];case eJ.Q3:return e[this.series.getQ3Field()];case eJ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>c(t[tJ])}class sJ extends KK{static type=R$.boxPlot;type=sJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?($N("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(iW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),qV("barBoxplotScaleIn",ZV(eW)),qV("barBoxplotScaleOut",JV(eW))):($N("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(tW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),qV("boxplotScaleIn",ZV(QV)),qV("boxplotScaleOut",JV(QV)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class rJ extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:z$.circle,fill:void 0,lineWidth:0}}}class aJ extends rJ{static type=R$.symbol;type=aJ.type}wK.useMark([sJ,aJ]);class oJ extends Oq{static type=tq.boxPlot;type=tq.boxPlot;static mark={...Lq.mark,[QK.boxPlot]:{name:QK.boxPlot,type:R$.boxPlot},[QK.outlier]:{name:QK.outlier,type:R$.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};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=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(oJ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(oJ.mark.outlier,{progressive:t,key:YX,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:v(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===Gh.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Vh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Vh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Vh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Vh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Vh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},yK.STATE_NORMAL,qX.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),y:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,yK.STATE_NORMAL,qX.Series)}}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"foldOutlierData",iJ),rK(this._dataSet,"addVChartProperty",uq);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===Gh.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._outlierDataView=new Tq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===Gh.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===Gh.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===Gh.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(NZ.boxPlot()),i=this._initAnimationSpec(GZ(QK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(WZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(WZ(NZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new nJ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class lJ{setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(hJ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",qX.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:F$},"normal",qX.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===O$?t===Gh.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",qX.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(hJ.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series))}}const hJ={[QK.point]:{name:QK.point,type:R$.symbol},[QK.line]:{name:QK.line,type:R$.line}};class cJ extends KK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((c=>{const d=t[c];if(h(d)||s.includes(c))return;a&&r.includes(c)&&(Hl(d?.type)||d?.scale||l(d))&&(o=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class dJ extends cJ{static type=R$.line;type=dJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===tq.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}wK.useMark([dJ,aJ,qZ]);class uJ extends Oq{static type=tq.line;type=tq.line;_invalidType="break";static mark={...Lq.mark,...hJ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}j(uJ,lJ);class pJ extends KK{static type=R$.rect3d;type=pJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}wK.useMark([pJ,qZ]);class gJ extends ZZ{static type=tq.bar3d;type=tq.bar3d;static mark={...Lq.mark,[QK.bar3d]:{name:QK.bar3d,type:R$.rect3d}};_barMarkName=QK.bar3d;_barMarkType=R$.rect3d}function fJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===Gh.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===Gh.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===Gh.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===Gh.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",qX.Series)}class mJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class yJ extends ZZ{static type=tq.rangeColumn;type=tq.rangeColumn;_barMarkType=R$.rect;_barName=tq.bar;static mark={...ZZ.mark,[QK.minLabel]:{name:QK.minLabel,type:R$.text},[QK.maxLabel]:{name:QK.maxLabel,type:R$.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(yJ.mark.bar,{morph:XZ(this._spec.animation,this._spec.morph,GZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===c$.bothEnd?void 0:L({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===c$.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(yJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(yJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});fJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});fJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===Gh.horizontal?(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.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===Gh.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.rangeColumn({direction:this.direction},e),GZ(QK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new mJ(this)}}wK.useMark([pJ]);class _J extends yJ{static type=tq.rangeColumn3d;type=tq.rangeColumn3d;_barMarkType=R$.rect3d;_barName=tq.bar3d}class vJ extends cJ{static type=R$.area;type=vJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}wK.useMark([dJ,vJ,qZ,aJ]);class bJ extends Oq{static type=tq.area;type=tq.area;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(bJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Vh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Vh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(WZ(NZ.area(t,e),GZ(QK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}}j(bJ,lJ);class xJ extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class SJ extends bJ{static type=tq.rangeArea;type=tq.rangeArea;static mark={...bJ.mark};initMark(){this._areaMark=this._createMark(SJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new xJ(this)}}Ar();const wJ={},AJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function kJ(t,e){t&&f(t)||al("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(wJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Ar().projection(n),n.copy=n.copy||function(){const t=i();return AJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),wJ[i]||null}const MJ={albers:Wr,albersusa:function(){var t,e,i,n,s,r,a=Wr(),o=Vr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Vr().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(MJ).forEach((t=>{kJ(t,MJ[t])}));const CJ="Feature",TJ="FeatureCollection";function EJ(t){const e=N(t);return 1===e.length?e[0]:{type:TJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===TJ?t.features:N(t).filter((t=>!h(t))).map((t=>t.type===CJ?t:{type:CJ,geometry:t}))}(e))),[])}}const PJ=AJ.concat(["pointRadius","fit","extent","size"]);function RJ(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{PJ.includes(n)&&(i=i.concat(LN(t[n],e)))})),i):i}const BJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(h(i))for(let i=0;i(l(t),t)))};class IJ extends Lq{type=tq.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;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){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(h(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(h(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return h(r)||isNaN(r.x)||isNaN(r.y)?null:r}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){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Kj}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const DJ=(t,e)=>(t.features&&t.features.forEach((t=>{e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class LJ extends Sq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class OJ extends KK{static type=R$.path;type=OJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var FJ,zJ,HJ;wK.useMark([OJ,qZ]),FJ="projection",zJ=class extends CW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return h(this.spec.pointRadius)||this.detach(LN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(LN(t,this.view)),this.commit(),this}size(t){return h(this.spec.size)||this.detach(LN(this.spec.size,this.view)),this.spec.size=t,this.attach(LN(t,this.view)),this.commit(),this}extent(t){return h(this.spec.extent)||this.detach(LN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(LN(t,this.view)),this.commit(),this}fit(t){return h(this.spec.fit)||this.detach(LN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(LN(t,this.view)),this.commit(),this}configure(t){return this.detach(RJ(this.spec,this.view)),h(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(RJ(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=kJ((t||"mercator").toLowerCase());return e||al("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),AJ.forEach((t=>{var i,n,s;h(this.spec[t])||(i=this.projection,n=t,s=FN(this.spec[t],e,kJ),l(i[n])&&i[n](s))})),h(this.spec.pointRadius)||this.projection.path.pointRadius(FN(this.spec.pointRadius,e,kJ)),!(h(this.spec.fit)||h(this.spec.extent)&&h(this.spec.size))){const t=EJ(FN(this.spec.fit,e,kJ));this.spec.extent?this.projection.fitExtent(FN(this.spec.extent,e,kJ),t):this.spec.size&&this.projection.fitSize(FN(this.spec.size,e,kJ),t)}return this.projection}output(){return this.projection}},HJ="projections",yX[FJ]={grammarClass:zJ,specKey:null!=HJ?HJ:FJ};class jJ extends IJ{static type=tq.map;type=tq.map;static mark={...Lq.mark,[QK.area]:{name:QK.area,type:R$.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(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.map)throw new Error(`map type '${this.map}' is not specified !`);if(!oK.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),rK(this._dataSet,"copyDataView",dK),rK(this._dataSet,"map",DJ),rK(this._dataSet,"lookup",BJ);const t=oK.get(this.map);if(!t)throw Error("no valid map data found!");const e=new Vo(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??$X,XX],as:[this.nameField,this.valueField,this._seriesField??$X,XX]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new Tq(this._option,e)}initMark(){this._pathMark=this._createMark(jJ.mark.area,{morph:XZ(this._spec.animation,this._spec.morph,GZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(jJ.mark.label,{skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>c(t[this._seriesField??$X])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??$X]):this._theme?.defaultFillColor,path:this.getPath.bind(this)},"normal",qX.Series),this.setMarkStyle(t,{smoothScale:!0},"normal",qX.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(WZ(NZ.path(),GZ(QK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initTooltip(){this._tooltipHelper=new LJ(this)}getPath(t){const e=this._areaCache.get(t?.properties?.[this._nameProperty]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t?.properties?.[this._nameProperty],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===R$.path?s.forEach((t=>{t.getGraphicItem().scale(e,e,i)})):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===R$.path?n.forEach((t=>{t.getGraphicItem().translate(e[0],e[1])})):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return b(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]??t.properties?.[this.nameField]??""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return t=>t?.properties?.[this._nameProperty]}}class NJ extends Lq{coordinate="polar";_outerRadius=kN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=c(t)?N(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=c(t)?N(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=N(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(h(t)||h(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(t)),n=this.radiusAxisHelper.dataToPosition(N(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};zl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};zl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),c(this._spec.radius)&&(this._outerRadius=this._spec.radius),c(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Go(t.angleField,i)&&Go(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const VJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=xl(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}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},WJ=(t,e)=>{const i=t[0].latestData;return new UJ(e.series,i).updateLabels()};class GJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class UJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=b$(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[eN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:c}=n;if("inside"!==t?.position){const t=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_HOVER),n.middleAngle),i=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_SELECTED),n.middleAngle),a=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_NORMAL),n.middleAngle);s[cN]=a.x,s[dN]=a.y,s[lN]=t.x,s[hN]=t.y,s[mN]=i.x,s[yN]=i.y,s[uN]=l.x,s[pN]=l.y,s[gN]=c.x,s[fN]=c.y,s[nN]=r.y-o.height/2}else s[nN]=r.y;return s[Qj]=this._computeAlign(n),s[Jj]=Math.max(a,0),s[eN]=n.labelVisible&&!h(n.labelText),s[iN]=r.x,s[tN]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=kl(e.x,e.y,f,t.middleAngle),t.labelLimit=p,at(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=Ml(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=Ml(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(ot(t.pointB.x,n+r)||at(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.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 r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?bl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=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}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?h(i)||"auto"===i?"edge"===n?Ml(t.quadrant)?"left":"right":Ml(t.quadrant)?"right":"left":i:h(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=h(n)||h(t[n])||h(t[s]);return l(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class YJ extends KK{type=XJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),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{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+Al({angle:e[_N],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class XJ extends YJ{static type=R$.arc;type=XJ.type}wK.useMark([OJ,qZ,XJ]);class $J extends NJ{_pieMarkName=QK.pie;_pieMarkType=R$.arc;static mark={...Lq.mark,[QK.pie]:{name:QK.pie,type:R$.arc},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=xN;_endAngle=SN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=c(t),r=c(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}}(c(this._spec?.startAngle)?Sl(this._spec.startAngle):this._startAngle,c(this._spec?.endAngle)?Sl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=c(this._spec?.padAngle)?Sl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;rK(this._dataSet,"pie",VJ),rK(this._dataSet,"arcLabel",WJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:rN,asEndAngle:aN,asRatio:sN,asMiddleAngle:_N,asRadian:bN,asQuadrant:vN,asK:oN}},!1);const e=new Vo(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${Kj}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new Tq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...$J.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark($J.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark($J.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Wh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Wh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this)},void 0,qX.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(VX.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){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}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${Kj}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${Kj}_ARC_LABEL_${e}_AY`])} L${Math.round(t[uN])},${Math.round(t[pN])} L${Math.round(t[gN])},${Math.round(t[fN])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(h(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=Al({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=Al({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===fK.appear)return this._startAngle;if(i===fK.disappear)return this._endAngle;const n=[fK.disappear,fK.exit],s=e.mark.elements,r=t,a=r?.[YX];if(void 0===s.find((t=>t.data[0]?.[YX]t.data[0]?.[YX]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[YX]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class KJ extends $J{static type=tq.pie;type=tq.pie}class qJ extends YJ{static type=R$.arc3d;type=qJ.type}wK.useMark([OJ,qZ,qJ]);class ZJ extends $J{static type=tq.pie3d;type=tq.pie3d;_pieMarkName=QK.pie3d;_pieMarkType=R$.arc3d;static mark={...Lq.mark,[QK.pie3d]:{name:QK.pie3d,type:R$.arc3d},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Ol(iN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Ol(nN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this),...n},void 0,qX.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const JJ=[10,20],QJ=Fl.Linear,tQ="circle",eQ=Fl.Ordinal,iQ=["circle","square","triangle","diamond","star"];wK.useMark([aJ,qZ]);class nQ extends Oq{static type=tq.scatter;type=tq.scatter;static mark={...Lq.mark,[QK.point]:{name:QK.point,type:R$.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if(l(e))return e;if(m(e)){if(h(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${Kj}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(d(e)){if(h(t))throw new Error(`${s}Field is required.`);const r={id:`${Kj}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return h(e)?10:v(e)?e:!f(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:QJ,defaultRange:JJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return h(e)?tQ:f(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:eQ,defaultRange:iQ},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(nQ.mark.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(WZ(NZ.scatter({},t),GZ(QK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:v(this._size)||l(this._size)?this._size:10,shape:f(this._shape)||l(this._shape)?this._shape:tQ},yK.STATE_NORMAL,qX.Series),(c(this._sizeField)||c(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},yK.STATE_NORMAL,qX.User_Mark),(c(this._shapeField)||c(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},yK.STATE_NORMAL,qX.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},yK.STATE_NORMAL,qX.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class sQ extends NJ{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(JX),this.setInnerRadiusField(ZX)}setValueFieldToPercent(){this.setRadiusField(t$),this.setInnerRadiusField(QX)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}wK.useMark([XJ,qZ]);class rQ extends sQ{static type=tq.rose;type=tq.rose;static mark={...ZZ.mark,[QK.rose]:{name:QK.rose,type:R$.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(rQ.mark.rose,{morph:XZ(this._spec.animation,this._spec.morph,GZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(rQ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Vh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(wl(e)??0)+90},void 0,qX.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(WZ(NZ.rose(e,t),GZ(QK.rose,this._spec)))}}}wK.useMark([vJ,dJ,aJ,qZ]);class aQ extends sQ{static type=tq.radar;type=tq.radar;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(aQ.mark.area,{progressive:t,isSeriesMark:e})}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._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:F$},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:Sl(this._spec.startAngle)??xN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.radarGroup(t,e),GZ(QK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(c(i)){const s=NZ[n];i.setAnimationConfig(WZ(s(t,e),GZ(i.name,this._spec)))}}))}}j(aQ,lJ);class oQ extends Sq{updateTooltipSpec(){super.updateTooltipSpec(),c(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>Wo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const lQ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},hQ={fill:"#bbb",fillOpacity:.2};wK.useMark([aJ,qZ,JZ,KZ]);class cQ extends Oq{static type=tq.dot;type=tq.dot;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.grid]:{name:QK.grid,type:R$.rule},[QK.gridBackground]:{name:QK.gridBackground,type:R$.rect},[QK.dot]:{name:QK.dot,type:R$.symbol},[QK.title]:{name:QK.title,type:R$.text},[QK.subTitle]:{name:QK.subTitle,type:R$.text},[QK.symbol]:{name:QK.symbol,type:R$.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){c(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){c(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){c(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){c(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){c(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),rK(this._option.dataSet,"objFlat",lQ),rK(this._option.dataSet,"copyDataView",dK),aK(this._option.dataSet,"dataview",Fo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){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(L(hQ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(cQ.mark.group),this._containerMark=this._createMark(cQ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cQ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cQ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cQ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cQ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cQ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cQ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",qX.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i));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",qX.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",qX.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(o))}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){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??$X}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new oQ(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class dQ extends Sq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>Wo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}wK.useMark([JZ,aJ]);class uQ extends Oq{static type=tq.link;type=tq.link;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.link]:{name:QK.link,type:R$.rule},[QK.arrow]:{name:QK.arrow,type:R$.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){c(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){c(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){c(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();rK(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(uQ.mark.group),this._containerMark=this._createMark(uQ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(uQ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(uQ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",qX.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?z$.triangleDown:z$.triangleUp},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new dQ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class pQ extends NJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=Sl(this._spec.startAngle)??Sl(t?.startAngle)??xN,this._endAngle=Sl(this._spec.endAngle)??Sl(t?.endAngle)??SN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||c(n?.startAngle)||c(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[ZX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[JX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class gQ extends YJ{static type=R$.arc;static constructorType=R$.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){c(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),c(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const h=c(t.innerPadding)&&c(a)||c(t.outerPadding)&&c(o),d=c(t.innerRadius)&&s||c(t.outerRadius)&&r;if(h||d){const e=Object.assign({},t);return s&&c(a)&&(l(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+(l(s)?s(t,e,i,n):s):l(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&c(o)&&(l(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-(l(r)?r(t,e,i,n):r):l(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}wK.useMark([XJ,gQ]);class fQ extends pQ{static type=tq.circularProgress;type=tq.circularProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.progressArc},[QK.progress]:{name:QK.progress,type:R$.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(fQ.mark.track),this._progressMark=this._createMark(fQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}}class mQ extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}wK.useMark([KZ]);class yQ extends Oq{static type=tq.linearProgress;type=tq.linearProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.rect},[QK.progress]:{name:QK.progress,type:R$.rect},[QK.group]:{name:QK.group,type:R$.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(yQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(yQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(yQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Vh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(hB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Vh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(hB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",qX.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.linearProgress(t,e),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}initTooltip(){this._tooltipHelper=new mQ(this)}}const _Q=[0],vQ=[20,40],bQ=[200,500],xQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},SQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],wQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:AQ,triangle:AQ,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 AQ(){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 kQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const MQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function CQ(t){return l(t)?t:function(){return t}}class TQ{constructor(t){var e,i;switch(this.options=Object.assign({},TQ.defaultOptions,t),l(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>wQ[t]?wQ[t]():wQ.circle())(this.options.shape),this.getText=null!==(e=CQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=CQ(this.options.fontWeight),this.getTextFontSize=CQ(this.options.fontSize),this.getTextFontStyle=CQ(this.options.fontStyle),this.getTextFontFamily=CQ(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=CQ(this.options.color)}if(h(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=l(this.options.rotate)?t=>{var e;return Gt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Gt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!h(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class PQ extends TQ{constructor(t){var e;super(Object.assign({},PQ.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.spiral=f(this.options.spiral)?null!==(e=EQ[this.options.spiral])&&void 0!==e?e:EQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=CQ(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:n}=kQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));for(this.data=r;s>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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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>=n)s&&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(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(IQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}DQ(p,this._size)&&(p=LQ(p,this._size))}else if(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||BQ(p,i))&&(!i||!RQ(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function RQ(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function BQ(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,DQ=(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 LQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),U(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:n}=kQ(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}FQ.defaultOptions={enlarge:!1};const HQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?NQ(t.fontFamily):"sans-serif",u=t.fontStyle?NQ(t.fontStyle):"normal",p=t.fontWeight?NQ(t.fontWeight):"normal",g=t.rotate?NQ(t.rotate):0,f=NQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?NQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",b=null!==(r=t.shrink)&&void 0!==r&&r,x=null!==(a=t.enlarge)&&void 0!==a&&a,S=null!==(o=t.clip)&&void 0!==o&&o,w=null!==(l=t.minFontSize)&&void 0!==l?l:0,A=t.randomVisible,k=t.as||HQ,M=t.depth_3d,C=t.postProjection;let T=t.fontSize?NQ(t.fontSize):14;const E=t.fontSizeRange;if(E&&!v(T)){const t=T;T=e=>VQ(t(e),WQ(t,h),E)}let P=PQ;"fast"===t.layoutType?P=FQ:"grid"===t.layoutType&&(P=OQ);const R=new P({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:T,shrink:b,clip:S,enlarge:x,minFontSize:w,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},NQ=t=>f(t)||v(t)||l(t)?t:e=>e[t.field],VQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],WQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function GQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),XQ=(t,e)=>{let i=0;for(const e of t)YQ(e)?i+=1:i+=.53;return i};function $Q(t){return x(t)?new Promise(((e,i)=>{const n=pB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{We.getInstance().error("image 加载失败!",t)}})):null}var KQ=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 qQ(t){return KQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield $Q(e);r&&(a=yield function(t,e,i){return KQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&JQ(s,n,a-1);)--a;for(;oo&&QQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield $Q(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||ZQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function ZQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function JQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||n0(e,t,r)))return i0(e,t,r),!0}return!1}function i0(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function n0(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function s0(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,m;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(d=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function r0(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?t0(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=r0(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return t0(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){s0(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!n0(i,y,_)&&(i0(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var l0=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())}))};const h0={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},c0=(t,e,i,n)=>l0(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||al("WordcloudShape shape must be specified."),t.text||al("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(UQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||h0;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=gj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield qQ(l),p=t.colorMode||"ordinal",g={getText:f0(t.text),getFontSize:f0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?f0(t.colorField):f0(t.text),getFillingColor:f0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:f0(t.colorHexField),getFontFamily:f0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:f0(t.padding||1),getFontStyle:f0(t.fontStyle||"normal"),getFontWeight:f0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?f0(t.fontOpacity):()=>1};u0(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:f0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:f0(t.fillingFontStyle||"normal"),getFillingFontWeight:f0(t.fillingFontWeight||"normal"),getFillingPadding:f0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=XQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,P=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),R=Math.max(...P.map((t=>t.fontSize)));P.forEach((t=>t.weight=t.fontSize/R)),P.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield o0(P,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(UQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),d0=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new Wl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Wl).domain(e).range(f).scale(t)}}else(new _h).domain(g0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new _h).domain(g0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},u0=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new Mh).domain(g0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&l(s)&&!n){const e=.5,[o,l]=(i.shapeArea,g0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=p0(h,i,!0);n=[~~(e*c),~~c];const d=(new Mh).domain(g0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=p0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},p0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=XQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},f0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:l(t)?t:e=>e[t.field]:null,m0=`${Kj}_WORD_CLOUD_ANGLE`,y0=`${Kj}_WORD_CLOUD_FILLING_ANGLE`,_0=`${Kj}_WORD_CLOUD_WEIGHT`,v0=`${Kj}_WORD_CLOUD_TEXT`;wK.useMark([qZ]),TN("wordcloud",{transform:jQ,markPhase:"beforeJoin"},!0),TN("wordcloudShape",{transform:c0,markPhase:"beforeJoin"},!0);class b0 extends Lq{static mark={...Lq.mark,[QK.word]:{name:QK.word,type:R$.text},[QK.fillingWord]:{name:QK.fillingWord,type:R$.text}};_nameField;_valueField;setValueField(t){c(t)&&(this._valueField=t,this.setFontSizeRange(vQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){c(t)&&c(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??bQ,this._rotateAngles=this._spec.rotateAngles??_Q,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:xQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:_Q,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!SQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(b0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?v0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud(),GZ(QK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??$X};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:XX,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?v0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:Zo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class x0 extends b0{static type=tq.wordCloud;type=tq.wordCloud}class S0 extends b0{static type=tq.wordCloud3d;type=tq.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(b0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.fillingWord,this._spec)))}}const w0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=b(y*f)?y/f:null,x=b(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:x),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},A0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},k0=`${Kj}_FUNNEL_TRANSFORM_RATIO`,M0=`${Kj}_FUNNEL_REACH_RATIO`,C0=`${Kj}_FUNNEL_HEIGHT_RATIO`,T0=`${Kj}_FUNNEL_VALUE_RATIO`,E0=`${Kj}_FUNNEL_LAST_VALUE_RATIO`,P0=`${Kj}_FUNNEL_NEXT_VALUE_RATIO`,R0=`${Kj}_FUNNEL_LAST_VALUE`,B0=`${Kj}_FUNNEL_CURRENT_VALUE`,I0=`${Kj}_FUNNEL_NEXT_VALUE`,D0=`${Kj}_FUNNEL_TRANSFORM_LEVEL`,L0=20;class O0 extends Sq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===QK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===QK.transform){const e=t?.[M0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===QK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])?t?.[n[0]]:t?.[s]}}class F0 extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class z0 extends F0{static type=R$.polygon;type=z0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}wK.useMark([z0,qZ,JZ]);class H0 extends Lq{static type=tq.funnel;type=tq.funnel;_funnelMarkName=QK.funnel;_funnelMarkType=R$.polygon;_transformMarkName=QK.transform;_transformMarkType=R$.polygon;static mark={...Lq.mark,[QK.funnel]:{name:QK.funnel,type:R$.polygon},[QK.transform]:{name:QK.transform,type:R$.polygon},[QK.transformLabel]:{name:QK.transformLabel,type:R$.text},[QK.outerLabel]:{name:QK.outerLabel,type:R$.text},[QK.outerLabelLine]:{name:QK.outerLabelLine,type:R$.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"funnel",w0),rK(this._dataSet,"funnelTransform",A0);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new Tq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:B0,asTransformRatio:k0,asReachRatio:M0,asHeightRatio:C0,asValueRatio:T0,asNextValueRatio:P0,asLastValueRatio:E0,asLastValue:R0,asNextValue:I0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:D0}})}initMark(){if(this._funnelMark=this._createMark({...H0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...H0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(H0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(H0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(H0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(H0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new O0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>c(t[this._valueField]),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Ol(M0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",qX.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",qX.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),GZ(QK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(WZ(NZ.funnel({},t),GZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(WZ(NZ.label(),GZ(QK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[E0])/2:this._getSecondaryAxisLength(t[T0])/2,s=this._getSecondaryAxisLength(t[T0])/2):(n=this._getSecondaryAxisLength(t[T0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[P0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[D0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return c(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!c(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(v(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-L0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series)}}function V0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=U0(t.children,u.children,i+1,o,u,r);u.value=h(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else u.isLeaf=!0,u.value=h(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:l,flattenIndex:o}},Y0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=Y0(t.children,e,t,s))})),n},X0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=X0(t.children,e,t,s)),s=e(t,n,i,s)})),s},$0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:V0,slice:W0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?W0:V0)(t,e,i,n,s)}};class K0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=m(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=m(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=m(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=m(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},K0.defaultOpionts,t);const i=this.options.nodeKey,n=l(i)?i:i?ll(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?G0(this.options.aspectRatio):null!==(e=$0[this.options.splitType])&&void 0!==e?e:$0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=U0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(v(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(v(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)}))}}K0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const q0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class Z0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];V0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),q0);const n=m(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],n)return this._layoutLabel(t,o(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},Z0.defaultOpionts,t):Object.assign({},Z0.defaultOpionts);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+ml(this.options.center[0],t.width),n=t.y0+ml(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=m(r),l=o?r.map((t=>ml(t,s))):ml(r,s),c=m(a),d=this.options.gapRadius,u=c?a.map((t=>ml(t,s))):ml(a,s),p=Y(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return h(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:ih(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(m(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=ml(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(m(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=U0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("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=$t({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}Z0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const J0=4294967296;function Q0(t,e){let i,n;if(i1(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function i1(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function a1(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function o1(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function l1(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function h1(t){return{_:t,next:null,prev:null}}function c1(t,e){const i=(t=N(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];a1(s,n,r);let a,o,l,h,c,d,u,p=h1(n),g=h1(s),f=h1(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:m(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="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 h=[],c=U0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%J0)/J0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=l(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:g1.defaultOpionts.nodeSort;Y0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)Y0([u],d1(this.options.setRadius)),X0([u],u1(this._getPadding,.5,d)),Y0([u],p1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);Y0([u],d1(g1.defaultOpionts.setRadius)),X0([u],u1(cl,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&X0([u],u1(this._getPadding,u.radius/t,d)),Y0([u],p1(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}g1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const f1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):f1(t.children,e,i)))})),e},m1=(t,e={})=>{if(!t)return[];const i=[];return f1(t,i,e),i},y1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new Z0(i).layout(t,{width:n,height:s})};class _1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var v1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(v1||(v1={}));const b1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(h(s))return t;if(i.type===v1.DrillDown){return N(k$(t,s,n,"children"))}if(i.type===v1.DrillUp){const e=M$(t,s,n,"children");if(e)return N(e)}return t};class x1{pointerId;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(){}parserDragEvent(){return!0}}class S1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const w1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1}};class A1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return w1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===un.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;rK(t,"drillFilter",b1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(h(t.datum)||h(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!m(t)||M(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:v1.DrillDown},e().reRunAllTransform(),i.emit(VX.drill,{value:{path:t,type:v1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!m(i)||M(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:v1.DrillUp},t().reRunAllTransform(),e.emit(VX.drill,{value:{path:i,type:v1.DrillUp},model:this}),i}}wK.useMark([XJ,qZ]);class k1 extends NJ{static type=tq.sunburst;type=tq.sunburst;static mark={...Lq.mark,[QK.sunburst]:{name:QK.sunburst,type:R$.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),this._startAngle=Gt(this._spec.startAngle),this._endAngle=Gt(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),rK(this._dataSet,"sunburstLayout",y1),rK(this._dataSet,"flatten",m1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[c(this._centerX)?this._centerX:this.getLayoutRect().width/2,c(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(k1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){h(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.y+(c(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(k1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return d(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(c(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},yK.STATE_NORMAL,qX.Series)}initTooltip(){this._tooltipHelper=new _1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((i=>{i.setAnimationConfig(WZ(NZ.sunburst(t,e),GZ(i.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(m(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}j(k1,A1);const M1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new g1(i).layout(t,{width:n,height:s})};class C1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}wK.useMark([XJ,qZ]);class T1 extends Oq{static type=tq.circlePacking;type=tq.circlePacking;static mark={...Lq.mark,[QK.circlePacking]:{name:QK.circlePacking,type:R$.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,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();h(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"circlePackingLayout",M1),rK(this._dataSet,"flatten",m1),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(T1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){h(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},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(T1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},yK.STATE_NORMAL,qX.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new C1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((e=>{e.setAnimationConfig(WZ(NZ.circlePacking({},t),GZ(e.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}j(T1,A1);const E1=t=>{let e=0;return t.forEach(((t,i)=>{var n;h(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=E1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function P1(t){return t.depth}function R1(t,e){return e-1-t.endDepth}const B1=(t,e)=>t.y0-e.y0,I1={left:P1,right:R1,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?W(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:P1,end:R1};class D1{constructor(t){this._ascendingSourceBreadth=(t,e)=>B1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D1.defaultOptions,t);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._alignFunc=l(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I1[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];E1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(h(s.source)||h(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(f(e)){const t=ct(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(v(e)){if(r=e,v(i))a=i;else if(h(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else l(e)&&v(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}h(this.options.nodeSortBy)&&s.sort(B1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},O1=(t,e)=>{if(!t||!e?.view||!m(t))return t;const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new D1(e),s=[];return s.push(n.layout(t,i)),s},F1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],z1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class H1 extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(v(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class j1 extends KK{static type=R$.linkPath;type=j1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){$N("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),qV("linkPathGrowIn",aW),qV("linkPathGrowOut",oW),qV("linkPathUpdate",lW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}wK.useMark([KZ,j1,qZ]),TN("sankey",{transform:L1,markPhase:"beforeJoin"},!0);class N1 extends Oq{static type=tq.sankey;type=tq.sankey;static mark={...ZZ.mark,[QK.node]:{name:QK.node,type:R$.rect},[QK.link]:{name:QK.link,type:R$.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=r$.Node;_labelLayoutZIndex=r$.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Vt;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){rK(this._dataSet,"sankey",O1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new jo;aK(t,"dataview",Fo),rK(t,"sankeyNodes",F1),rK(t,"addVChartProperty",uq);const e=new Vo(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._nodesSeriesData=new Tq(this._option,e);const i=new jo;aK(i,"dataview",Fo),rK(i,"sankeyLinks",z1),rK(i,"addVChartProperty",uq);const n=new Vo(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._linksSeriesData=new Tq(this._option,n)}}initMark(){const t=this._createMark(N1.mark.node,{isSeriesMark:!0,key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(N1.mark.link,{key:YX,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(N1.mark.label,{key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},yK.STATE_NORMAL,qX.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},yK.STATE_NORMAL,qX.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(WZ(NZ.sankeyNode(t,e),GZ(QK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(WZ(NZ.sankeyLinkPath(),GZ(QK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:GX.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:GX.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(N(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||N(s[r]).includes(e.source)&&N(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(N(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new H1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Ih(this._option.getTheme().colorScheme,this.type),n=new Hh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const V1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new K0(e).layout(t,i)},W1=(t,e)=>{let i={},n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=m1(s);return i=Mq([{latestData:r}],e),i};class G1 extends Sq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class U1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,w1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return w1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;h(s)||Yh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){w1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){w1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;h(s)&&h(r)||Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:GX.chart},(t=>{if(!t.event)return;const{event:n}=t;Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:GX.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){w1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:GX.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:GX.chart,source:WX.chart},l),this._eventObj.off(n,{level:GX.chart,source:WX.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:GX.chart,source:WX.chart},l),this._eventObj.on(n,{level:GX.chart,source:WX.chart},o)}}wK.useMark([KZ,qZ]);class Y1 extends Oq{static type=tq.treemap;type=tq.treemap;static mark={...Lq.mark,[QK.nonLeaf]:{name:QK.nonLeaf,type:R$.rect},[QK.leaf]:{name:QK.leaf,type:R$.rect},[QK.nonLeafLabel]:{name:QK.nonLeafLabel,type:R$.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Vt;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qt),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),b(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"treemap",V1),rK(this._dataSet,"flatten",m1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){rK(this._dataSet,"hierarchyDimensionStatistics",W1),rK(this._dataSet,"flatten",m1);const i=new Vo(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initMark(){const t=this._createMark(Y1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(Y1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(Y1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(Y1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},yK.STATE_NORMAL,qX.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()},yK.STATE_NORMAL,qX.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}initAnimation(){this.getMarksInType(R$.rect).forEach((t=>{t.setAnimationConfig(WZ(NZ.treemap(),GZ(t.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}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 G1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(hV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(hV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}j(Y1,U1),j(Y1,A1),wK.useMark([OJ,KZ]);class X1 extends pQ{static type=tq.gaugePointer;type=tq.gaugePointer;static mark={...Lq.mark,[QK.pin]:{name:QK.pin,type:R$.path},[QK.pinBackground]:{name:QK.pinBackground,type:R$.path},[QK.pointer]:{name:QK.pointer,type:[R$.path,R$.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?R$.rect:R$.path}initMark(){this._pinBackgroundMark=this._createMark(X1.mark.pinBackground),this._pointerMark=this._createMark({...X1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(X1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===R$.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return c(this.radiusAxisHelper)&&c(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.pointer,this._spec)))}}wK.useMark([gQ]);class $1 extends pQ{static type=tq.gauge;type=tq.gauge;static mark={...Lq.mark,[QK.segment]:{name:QK.segment,type:R$.progressArc},[QK.track]:{name:QK.track,type:R$.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=Sl(this._spec.padAngle??0)}initData(){super.initData();rK(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[s$]=t[this._angleField[0]],t[n$]=e>0?i[e-1][s$]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark($1.mark.track),this._segmentMark=this._createMark($1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(c(t[n$])?this.angleAxisHelper.dataToPosition([t[n$]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[s$]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.segment,this._spec)))}}class K1 extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return c(i)&&"dimension"===t&&(i.visible=!1),i}}class q1 extends rJ{static type=R$.cell;type=q1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}wK.useMark([q1,qZ]);class Z1 extends Oq{static type=tq.heatmap;type=tq.heatmap;static mark={...Lq.mark,[QK.cell]:{name:QK.cell,type:R$.cell},[QK.cellBackground]:{name:QK.cellBackground,type:R$.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=N(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(Z1.mark.cell,{morph:XZ(this._spec.animation,this._spec.morph,GZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(Z1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=Ge(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",qX.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(WZ(NZ.heatmap(t),GZ(QK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new K1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}wK.useSeries([bJ]);class J1 extends rq{static type=eq.area;static view="singleDefault";type=eq.area;seriesType=tq.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([ZZ]);class Q1 extends rq{static type=eq.bar;static view="singleDefault";type=eq.bar;seriesType=tq.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class t2 extends rq{static type=eq.bar3d;static view="singleDefault";type=eq.bar3d;seriesType=tq.bar3d}wK.useSeries([oJ]);class e2 extends rq{static type=eq.boxPlot;static view="singleDefault";type=eq.boxPlot;seriesType=tq.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??Gh.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===Gh.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),aq(t)}}wK.useSeries([T1]);class i2 extends sq{static type=eq.circlePacking;static view="singleDefault";type=eq.circlePacking;seriesType=tq.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=tq.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class n2 extends sq{static type=eq.common;static view="singleDefault";type=eq.common}class s2 extends sq{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([H0]);class r2 extends s2{static type=eq.funnel;static view="singleDefault";type=eq.funnel;seriesType=tq.funnel}wK.useSeries([N0]);class a2 extends s2{static type=eq.funnel3d;static view="singleDefault";type=eq.funnel3d;seriesType=tq.funnel3d}const o2={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function l2(t){let e=0;return C(t,"tick.visible")&&(e+=C(t,"tick.tickSize")),C(t,"label.visible")&&(e+=C(t,"label.space")),e}function h2(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function c2(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function d2(t){const e=t?.orient;return"angle"===e||"radius"===e}const u2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},j$(t)?r:a)},p2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class g2 extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=N(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return c(i)&&e.forEach((t=>{h(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));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],c(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class f2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),h(n.angle.type)&&(n.angle.type="linear"),h(n.radius.type)&&(n.radius.type="band");const s=h2(n.angle,{min:0,max:1});h(n.angle.min)&&(n.angle.min=s.min),h(n.angle.max)&&(n.angle.max=s.max)}}wK.useSeries([X1,$1]);class m2 extends f2{static type=eq.gauge;static view="singleDefault";type=eq.gauge;seriesType=tq.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:tq.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===tq.gauge||t.type===tq.circularProgress));h(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&h(e.radiusField)&&h(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===tq.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),h(e.angle.type)&&(e.angle.type="linear"),h(e.radius.type)&&(e.radius.type="linear")}}wK.useSeries([Z1]);class y2 extends rq{static type=eq.heatmap;static view="singleDefault";type=eq.heatmap;seriesType=tq.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class _2 extends rq{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}wK.useSeries([ZZ]);class v2 extends _2{static type=eq.histogram;static view="singleDefault";type=eq.histogram;seriesType=tq.bar;transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class b2 extends _2{static type=eq.histogram3d;static view="singleDefault";type=eq.histogram3d;seriesType=tq.bar3d}wK.useSeries([uJ]);class x2 extends rq{static type=eq.line;static view="singleDefault";type=eq.line;seriesType=tq.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([jJ]);class S2 extends sq{static type=eq.map;static view="singleDefault";type=eq.map;seriesType=tq.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area}}isValidSeries(t){return t===tq.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class w2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}wK.useSeries([KJ]);class A2 extends w2{static type=eq.pie;static view="singleDefault";type=eq.pie;seriesType=tq.pie}wK.useSeries([ZJ]);class k2 extends w2{static type=eq.pie3d;static view="singleDefault";type=eq.pie3d;seriesType=tq.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}wK.useSeries([fQ]);class M2 extends f2{static type=eq.circularProgress;static view="singleDefault";type=eq.circularProgress;seriesType=tq.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}wK.useSeries([yQ]);class C2 extends rq{static type=eq.linearProgress;static view="singleDefault";type=eq.linearProgress;seriesType=tq.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="band"),h(e.type)&&(e.type="linear");const n=h2(e,{min:0,max:1});h(e.min)&&(e.min=n.min),h(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="linear"),h(e.type)&&(e.type="band");const n=h2(i,{min:0,max:1});h(i.min)&&(i.min=n.min),h(i.max)&&(i.max=n.max)}}}class T2 extends g2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}wK.useSeries([aQ]);class E2 extends T2{static type=eq.radar;static view="singleDefault";type=eq.radar;seriesType=tq.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:L({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}wK.useSeries([SJ]);class P2 extends rq{static type=eq.rangeArea;static view="singleDefault";type=eq.rangeArea;seriesType=tq.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([yJ]);class R2 extends rq{static type=eq.rangeColumn;static view="singleDefault";type=eq.rangeColumn;seriesType=tq.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([_J]);class B2 extends rq{static type=eq.rangeColumn3d;static view="singleDefault";type=eq.rangeColumn3d;seriesType=tq.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}wK.useSeries([rQ]);class I2 extends T2{static type=eq.rose;static view="singleDefault";type=eq.rose;seriesType=tq.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??kN,outerRadius:t.outerRadius??kN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}wK.useSeries([N1]);class D2 extends sq{static type=eq.sankey;static view="singleDefault";type=eq.sankey;seriesType=tq.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([nQ]);class L2 extends rq{static type=eq.scatter;static view="singleDefault";type=eq.scatter;seriesType=tq.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}wK.useSeries([cQ,uQ]);class O2 extends sq{static type=eq.sequence;static view="singleDefault";type=eq.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==tq.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[tq.bar,tq.line,tq.area,tq.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===tq.dot?"band":"linear",visible:t.type!==tq.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===tq.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===tq.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=pK(t.data,this._dataSet,this._spec.data),t.type===tq.link&&(t.dataDot=pK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===tq.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===tq.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}wK.useSeries([k1]);class F2 extends sq{static type=eq.sunburst;static view="singleDefault";type=eq.sunburst;seriesType=tq.sunburst;getDefaultSeriesSpec(t){const e=c(t.startAngle)?t.startAngle:wN,i=c(t.endAngle)?t.endAngle:e+Ut(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=tq.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([Y1]);class z2 extends sq{static type=eq.treemap;static view="singleDefault";type=eq.treemap;seriesType=tq.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([QZ]);class H2 extends Q1{static type=eq.waterfall;static view="singleDefault";type=eq.waterfall;seriesType=tq.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&N(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),aq(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class j2 extends sq{type=eq.wordCloud;seriesType=tq.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([x0]);class N2 extends j2{static type=eq.wordCloud;static view="singleDefault";type=eq.wordCloud;seriesType=tq.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}wK.useSeries([S0]);class V2 extends j2{static type=eq.wordCloud3d;static view="singleDefault";type=eq.wordCloud3d;seriesType=tq.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class W2{plugins;id=el();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function G2(t){const e={...t};return M(t.style)||(e.textStyle=P$(t.style)),M(t.textStyle)||L(e.textStyle,P$(t.textStyle)),t.shape?.style&&P$(e.shape.style),t.background?.style&&P$(e.background.style),e}function U2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class Y2 extends IK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new W2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case un.cartesianBandAxis:return u2(W$(i),"band",e);case un.cartesianLinearAxis:return u2(W$(i),"linear",e);case un.cartesianAxis:case un.cartesianTimeAxis:return u2(W$(i),void 0,e);case un.polarBandAxis:return p2(i.orient,"band",e);case un.polarLinearAxis:return p2(i.orient,"linear",e);case un.polarAxis:return p2(i.orient,void 0,e);case un.cartesianCrosshair:case un.polarCrosshair:return e.component?.crosshair;case un.colorLegend:return e.component?.colorLegend[U2(i)];case un.sizeLegend:return e.component?.sizeLegend[U2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),m(this._originalSpec)?this._spec=this._originalSpec.map((t=>L({},this._theme,t))):this._spec=L({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:WX.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const X2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(h(a)||h(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},$2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{h(i[e])||t.latestData.forEach((t=>{N(i[e]).forEach((i=>{h(t[i])||(h(o[t[i]])&&(o[t[i]]=0),h(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class K2 extends Y2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=W$(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?Gh.horizontal:Gh.vertical)===Gh.horizontal,c(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(c(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):c(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),h(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(c(t)&&(c(t.userId)&&(this._seriesUserId=N(t.userId)),c(t.specIndex)&&(this._seriesIndex=N(t.specIndex))),c(this._spec.seriesId)){const t=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(c(this._spec.seriesIndex)){const t=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(c(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(c(this._spec.regionId)){const t=N(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(zl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};Ll(this._regions,(s=>{const r="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,a="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!r||!a)return;const o=r.getAxisId()===this._relatedAxisComponent.id?r:a.getAxisId()===this._relatedAxisComponent.id?a:this._isHorizontal?r:a,l=o===r?a:r,h=zl(l.getScale(0).type);t.push(s.getRawData());const c=s.getSpec(),d=N(c.xField),u=N(c.yField),p="cartesian"===s.coordinate?d[0]:c.angleField??c.categoryField,g="cartesian"===s.coordinate?u[0]:c.radiusField??c.valueField;if(n[s.id]="link"===s.type?"from_xField":o===r?p:g,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":l===r?p:g;i.push(h?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else h(this._spec.valueField),Ll(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;aK(n,"dataview",Fo),rK(n,"dataFilterComputeDomain",$2);const s=new Vo(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new YK(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&zl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&zl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new ah,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(rK(this._option.dataSet,"dataFilterWithNewDomain",X2),Ll(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>zl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ct(this._start-s,0,1),a=ct(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}j(K2,U1);class q2 extends K2{static type=un.scrollBar;type=un.scrollBar;name=un.scrollBar;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(h(i))return;if(!m(i))return new q2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new q2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new JW({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return h(i)||(n.padding=i),M(t?.style)||(n.railStyle=P$(t.style)),M(e?.style)||(n.sliderStyle=P$(e.style)),n}}class Z2 extends K2{static type=un.dataZoom;type=un.dataZoom;name=un.dataZoom;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;_startHandlerSize;_endHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(h(i))return;if(!m(i))return new Z2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new Z2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const t=this._spec.startHandler.style.visible??!0,e=this._spec.endHandler.style.visible??!0;this._startHandlerSize=t?this._spec.startHandler.style.size:0,this._endHandlerSize=e?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new _h;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e+i};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e+i};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new kU({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:P$(this._spec.background?.style),startHandlerStyle:P$(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:P$(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:P$(this._spec.middleHandler.background?.style)}},endHandlerStyle:P$(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:P$(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:P$(this._spec.endText?.style)},selectedBackgroundStyle:P$(this._spec.selectedBackground.style),dragMaskStyle:P$(this._spec.dragMask?.style),backgroundChartStyle:{line:L(P$(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:L(P$(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class J2 extends Y2{static type=un.customMark;type=un.customMark;layoutType="absolute";layoutZIndex=r$.CustomMark;layoutLevel=a$.CustomMark;static createComponent(t,e){return t.customMark?[new J2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`});if(s&&(h(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),c(t.dataId)||b(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class Q2 extends Y2{layoutType="absolute";static type=un.brush;type=un.brush;name=un.brush;layoutZIndex=r$.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!h(i)&&!1!==i.visible)return[new Q2(i,{...e,specKey:Q2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new SY({zIndex:this.layoutZIndex,brushStyle:P$(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=VX.brushChange;r="brushStart"===n||"brushDown"===n?VX.brushStart:"brushEnd"===n||"brushMaskUp"===n?VX.brushEnd:VX.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{...P$(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&Le(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&De(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){c(this._spec.regionId)&&c(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){c(this._spec.brushLinkSeriesId)&&c(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&N(t).includes(s.userId)||e&&N(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var t3;function e3(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function i3(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function n3(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:i3(t.rect),anchorCandidates:h3(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>e3(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;te3(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function s3(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=Be(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=o3(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=hn(r,n,i);if(!o3(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],r3(a3(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=r3(a3(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=l3(t.rect,a,0),t}));return n3(h)}function r3(t){return t>180?t-360:t}function a3(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function o3(t,e){for(let i=0;i{const{x:r,y:a}=l3({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(t3||(t3={}));class c3 extends Y2{static type=un.mapLabel;type=un.mapLabel;name=un.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=r$.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!c(i.series)?new c3(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new Vo(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new YK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new FU({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=qh(this._spec.background?.padding),d=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const u={},p=this.dataToPosition(t),g=aB({});if(g.name=`${this.name}_marker_itemContainer_${e}`,u.container=g,this._spec.background?.visible){const t=hB(P$({...this._spec.background.style}));t.setAttributes(p),u.labelBackground=t,g.appendChild(t)}if(this._spec.icon?.visible){const t=uB(P$({...this._spec.icon.style}));t.setAttributes(p),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;u.icon=t,g.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=dB(P$({...this._spec.nameLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.nameLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&c(t[this.valueField])){const e=dB(P$({...this._spec.valueLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.valueLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}const f=Object.values(u).find((t=>!!t&&"group"!==t.type)),m={x:f?.getComputedAttribute("x"),y:f?.getComputedAttribute("y")},y={x:m.x,y:m.y,width:0,height:0};y.width=n+r+(i-1)*d,y.height=s+a;const _={rect:y,point:m,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));_.rect=l3(y,o,l),_.anchors=t,_.offset=l}else _.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:_,contentMarks:u}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:P$({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):n3(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class d3{id;name;service;static Name;constructor(t=d3.Name){this.id=el(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function u3(t,e){const i=e.getSpec?.();M(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=j$(e.layoutOrient),r=t[0],a=V(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);u3(n?n.getChildren():[],t.component),u3(s?s.getChildren():[],t.component)}}function g3(t){return 2===t.length&&b(t[0])&&b(t[1])&&t[1]>=t[0]}function f3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!b(a.min),extendable_max:!b(a.max)}}function m3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function y3(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 _3(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 v3(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 b3=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),x3=(t,e,i=0)=>{const n=new Wt(t).expand(i/2),s=new Wt(e).expand(i/2);return n.intersects(s)},S3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function A3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=Sl(-90));const u=b$(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Wt).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},M3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return b3(p,r.options)};class C3 extends d3{Name="AxisSyncPlugin";constructor(){super(C3.Name)}_checkEnableSync(t){if(!zl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(VX.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!zl(i.type)||!zl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!g3(s)||!g3(r))return;const a=f3(t,s),o=f3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!y3(a,o))return}else if(0===p&&0===g){if(!y3(o,a))return}else if(u||y)if(u&&!y){if(!m3(a,o))return}else if(y&&!u){if(!m3(o,a))return}else{if(h===g)return;if(h>g){if(!_3(a,o))return}else if(!_3(o,a))return}else{if(0===h&&0===p){if(!v3(a,o))return}else if(0===g&&0===l&&!v3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){rK(e.getOption().dataSet,"tickAlign",M3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var T3={AxisLabelOverlapPlugin:p3,AxisSyncPlugin:C3};const E3=t=>t,P3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!w3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},R3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?S3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return b3(t.domain());let h;if(c(s))h=t.stepTicks(s);else if(c(n))h=t.forceTicks(n);else if(c(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=l2(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=l2(r),c=b$(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Bl(u),{x:m,y:y}=$t({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Wt).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=I3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}else h=t.domain();return b3(h)},I3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&x3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},D3=(t,e)=>{if(zl(t.type))return((t,e)=>{if(!zl(t.type))return b3(t.domain());const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=c(s)?t.stepTicks(s):c(n)?t.forceTicks(n):t.ticks(i??5),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=k3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&A3(s,i);)s=P3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),V(a)!==V(r)&&a.push(V(r))),r=a}return b3(r)})(t,e);if(jl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(c(s))l=t.stepTicks(s);else if(c(n))l=t.forceTicks(n);else if(c(i))l=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=k3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=R3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}else l=t.domain();return b3(l)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return B3(t,e)}return b3(t.domain())};class L3 extends Y2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),c(this._spec.id)&&t.setUserId(this._spec.id),o(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==C(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=WZ(NZ.axis(),{appear:this._spec.animationAppear??C(this._option.getChart().getSpec(),"animationAppear.axis")??C(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??C(this._option.getChart().getSpec(),"animationDisappear.axis")??C(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??C(this._option.getChart().getSpec(),"animationEnter.axis")??C(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??C(this._option.getChart().getSpec(),"animationExit.axis")??C(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??C(this._option.getChart().getSpec(),"animationUpdate.axis")??C(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return Ll(this._regions,(e=>{m(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;c(t)&&(this._seriesUserId=N(t)),c(i)&&(this._regionUserId=N(i)),c(e)&&(this._seriesIndex=N(e)),c(n)&&(this._regionIndex=N(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(Ll(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!zl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=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));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(Ll(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===rU.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&h(t.title.angle)&&(i="left"===t.orient?-90:90,e=o2[t.orient]),{orient:this.orient,select:t.select,hover:t.hover,line:(n=t.domainLine,(n=C$(n)).startSymbol=C$(n.startSymbol),n.endSymbol=C$(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:l(t.label.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.label.style(e.rawValue,i,e,n,s));return P$(this._preprocessSpec(L({},this._theme.label?.style,r)))}:P$(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:E$(t.label.state),autoRotate:!!t.label.autoRotate,autoHide:!!t.label.autoHide,autoLimit:!!t.label.autoLimit,autoRotateAngle:t.label.autoRotateAngle,autoHideMethod:t.label.autoHideMethod,autoHideSeparation:t.label.autoHideSeparation,limitEllipsis:t.label.limitEllipsis,layoutFunc:t.label.layoutFunc},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:l(t.tick.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.tick.style(e,i,n,s));return P$(this._preprocessSpec(L({},this._theme.tick?.style,r)))}:P$(t.tick.style),state:T$(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:l(t.subTick.style)?(e,i,n,s)=>{const r=t.subTick.style(e,i,n,s);return P$(L({},this._theme.subTick?.style,r))}:P$(t.subTick.style),state:T$(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:l(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return P$(this._preprocessSpec(L({},this._theme.grid?.style,n)))}:P$(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:P$(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Gt(i):null,textStyle:L({},e,P$(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:P$(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:P$(t.title.background?.style)},state:{text:T$(t.title.state),shape:T$(t.title.shape?.state),background:T$(t.title.background?.state)}},panel:{visible:t.background?.visible,style:P$(t.background?.style),state:T$(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const O3=[T3.AxisLabelOverlapPlugin,T3.AxisSyncPlugin];class F3 extends L3{static type=un.cartesianAxis;type=un.cartesianAxis;name=un.cartesianAxis;layoutType="region-relative";layoutZIndex=r$.Axis;layoutLevel=a$.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;_verticalLimitSize;constructor(t,e){super(t,{...e}),this._orient=W$(t,["z"]),V$(this._orient)&&(this.layoutType="absolute"),c(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?j$(t)?"linear":"band":j$(t)?"band":"linear"}(t.orient,i),s=`${F3.type}-${n}`,r=B$.getComponentInKey(s);if(r){let n=t.inverse;return i&&!j$(t.orient)&&(n=!c(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(F3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[F3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===Gh.horizontal;if(!m(i))return c2(i)?F3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>N$(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{c2(t)&&a.push(F3.createAxis(t,{...e,specIndex:i,specKey:F3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):N$(this.orient)?t.setYAxisHelper(this.axisHelper()):V$(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];j$(this.orient)?b(e)&&(s=n?[e,0]:[0,e]):V$(this.orient)?b(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):b(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(O3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();j$(this.orient)?h(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):h(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=j$(this.orient)?t.fieldX:V$(this.orient)?t.fieldZ:t.fieldY,zl(this._scale.type)?e:[e[0]]}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(hV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(j$(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(VX.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Ll(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:j$(this.orient)?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:V$(this.orient)?i.fieldZ:i.fieldY,n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{j$(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):N$(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):V$(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;b(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),b(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=j$(this.orient)?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=j$(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(L({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=L({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&h(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{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=j$(this.orient),s=t=>(n?!j$(t.orient):j$(t.orient))&&zl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(c(t))a=r.find((e=>e.id===t));else if(c(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const z3=Math.sqrt(50),H3=Math.sqrt(10),j3=Math.sqrt(2);class N3{_extend={};setExtraAttrFromSpec(){c(this._spec.nice)&&(this._nice=this._spec.nice),c(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=h2(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];c(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),c(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(W(t)-function(t){if(t&&m(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=z3?10:s>=H3?5:s>=j3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(VX.scaleUpdate,{model:this})}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{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._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}j(G3,W3);class U3 extends V3{static type=un.cartesianTimeAxis;type=un.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=L({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new YK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=Wo.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return m(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&m(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class Y3 extends L3{static type=un.polarAxis;type=un.polarAxis;name=un.polarAxis;layoutType="absolute";layoutZIndex=r$.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=xN;get startAngle(){return this._startAngle}_endAngle=SN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${Y3.type}-${i}`,s=B$.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(Y3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!m(i))return d2(i)?(i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),Y3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!d2(i))return;i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),i.outerRadius=i.radius??t.outerRadius??t.radius??kN;const o=Y3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Sl(this._spec.startAngle??wN),this._endAngle=Sl(this._spec.endAngle??(c(this._spec.startAngle)?this._spec.startAngle+360:AN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(VX.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._spec.tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return zl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=Al({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=jt.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=kN,e=0;const i=this.getChart().getSpec();return Ll(this.getRegions(),(n=>{const s=n;if(function(t){return[tq.rose,tq.radar,tq.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;b(n)&&(t=n),b(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(L({},this._axisStyle,t))}}class X3 extends Y3{static type=un.polarLinearAxis;type=un.polarLinearAxis;_zero=!0;_nice=!0;_scale=new _h;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}j(X3,N3);class $3 extends Y3{static type=un.polarBandAxis;type=un.polarBandAxis;_scale=new ah;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function K3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:p,regionId:g,regionIndex:f,seriesIndex:m,seriesId:y,padding:_,...v}=L({},t),b=v;return i.visible&&(b.title=G2(i)),M(n.focusIconStyle)||P$(n.focusIconStyle),n.shape=C$(n.shape),n.label=C$(n.label),n.value=C$(n.value),n.background=C$(n.background),Xh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),Xh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),Xh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),b.item=n,M(s.textStyle)||P$(s.textStyle),C$(s.handler),b.pager=s,r.visible&&!M(r.style)&&(L(b,r.style),c(r.padding)&&(b.padding=r.padding)),b}j($3,W3);const q3=(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},Z3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return c(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class J3 extends Y2{layoutType="normal";layoutZIndex=r$.Legend;layoutLevel=a$.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Uh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;c(i)&&(this._seriesUserId=N(i)),c(t)&&(this._regionUserId=N(t)),c(n)&&(this._seriesIndex=N(n)),c(e)&&(this._regionUserIndex=N(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new YK(this._option,t),this._initSelectedData(),Ll(this._regions,(t=>{t.event.on(VX.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;h(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(VX.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;b(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(L({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(L({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),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,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class Q3 extends J3{static type=un.discreteLegend;type=un.discreteLegend;name=un.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return i.type&&"discrete"!==i.type?void 0:new Q3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new Q3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){rK(this._option.dataSet,"discreteLegendFilter",Z3),rK(this._option.dataSet,"discreteLegendDataMake",q3);const t=new Vo(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!nl(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=A$(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...K3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return KU}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(GU.legendItemClick,(e=>{const i=C(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(VX.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(GU.legendItemHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(GU.legendItemUnHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:b(r)?r:1,strokeOpacity:b(a)?a:1,opacity:b(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return l(this._spec.data)?this._spec.data(t):t}}const t5=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;b(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},e5=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!M(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function i5(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:d,id:u,visible:p,orient:g,position:f,data:m,defaultSelected:y,field:_,filter:v,regionId:b,regionIndex:x,seriesIndex:S,seriesId:w,padding:A,...k}=L({},t),C=k;return e.visible&&(C.title=G2(e)),C.showHandler=!1!==i.visible,M(i.style)||(C.handlerStyle=P$(i.style)),c(n.width)&&(C.railWidth=n.width),c(n.height)&&(C.railHeight=n.height),M(n.style)||(C.railStyle=P$(n.style)),M(s.style)||(C.trackStyle=P$(s.style)),C.startText=C$(r),C.endText=C$(a),C.handlerText=C$(o),M(l)||(C.sizeBackground=P$(l)),h.visible&&!M(h.style)&&(L(C,h.style),c(h.padding)&&(C.padding=h.padding)),C}function n5(t){return"color"===t||"size"===t}const s5={color:tY,size:iY},r5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],a5=[2,10];class o5 extends J3{static type=un.continuousLegend;type=un.colorLegend;name=un.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return n5(i.type)?new o5(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{n5(t.type)&&n.push(new o5(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?un.colorLegend:un.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){rK(this._option.dataSet,"continuousLegendFilter",e5),rK(this._option.dataSet,"continuousLegendDataMake",t5);const t=new Vo(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=A$(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!nl(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=A$(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),M(n)&&(n="color"===this._legendType?r5:a5);const r={...i5(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return s5[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",gt((e=>{const i=C(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(VX.legendFilter,{model:this,value:i,event:e})}),30))}}}const l5=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),N(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class h5 extends Y2{static type=un.indicator;type=un.indicator;name=un.indicator;layoutType="absolute";layoutZIndex=r$.Indicator;layoutLevel=a$.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==h5.type)return null;const i=N(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map((t=>new h5(t,e)));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){rK(this._option.dataSet,"indicatorFilter",l5);const t=new Vo(this._option.dataSet);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 YK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return N(this._spec.content).forEach((t=>{const e=L({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{...P$(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!c(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{...P$(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rY(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":l(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return Ll(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){super.clear(),this._indicatorComponent=null,this._cacheAttrs=null}}class c5 extends Y2{static type=un.title;type=un.title;layoutType="normal";layoutZIndex=r$.Title;layoutLevel=a$.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Uh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!m(i))return new c5(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new c5(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;b(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),b(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:b(t.width())?t.width():0,height:this._spec.height?this._spec.height:b(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new nY(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class d5{projection;constructor(t){if(this.projection=kJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function u5(t,e){return`${Kj}_${e}_${t}`}class p5 extends Y2{static type=un.geoCoordinate;type=un.geoCoordinate;name=un.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:u5(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(h(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new p5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=L(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(VX.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new d5(this._projectionSpec)}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===tq.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===tq.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(tq.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==tq.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}j(p5,U1);const g5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},f5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class m5 extends Y2{layoutType="absolute";gridZIndex=r$.CrossHair_Grid;labelZIndex=r$.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach(((t,i)=>this._registerEvent(t,m(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:WX.chart},this._handleEvent),this.event.on(e,{level:GX.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ft((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(g5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(m(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(g5[e][t]),s=s.concat(g5[e][i(t)])})),{in:n,out:s}}return{in:g5[e][t],out:g5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=C(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{f5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),m(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function _5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var v5,b5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(v5||(v5={}));class x5 extends m5{static type=un.cartesianCrosshair;type=un.cartesianCrosshair;name=un.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.xField||i.yField?new x5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new x5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,v5.VERTICAL,!0),this.layoutByValue(v5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,v5.HORIZONTAL,!1),this.layoutByValue(v5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return zl(t.getScale().type)&&b(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){j$(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(v5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=v5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,d;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(jl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(zl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=_5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=l2(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(jl(s.type)){const t=s._step;d=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(zl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=_5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(d=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):d=1,a=r}}if(this.yHair.label?.visible){const e=l2(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(v5.HORIZONTAL&&this._layoutHorizontal(n,d??0),v5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EG({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new PG({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new yG(e)),n.add(t)),y5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(b5||(b5={}));class S5 extends m5{static type=un.polarCrosshair;type=un.polarCrosshair;name=un.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.categoryField||i.valueField?new S5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new S5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});zl(s.getScale().type)&&b(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:jt.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(b5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",L(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=l2(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=l2(t.getSpec())),n.angle=i.angle,n.axis=t,L(n,s)}))),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(b5.HORIZONTAL&&this._layoutHorizontal(n),b5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:$t(l,n,i),end:$t(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new EG({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new BG({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Bl(i),e={...$t(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Kt(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=$t(t,s,p),m=$t(t,s,g),y=ve([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=ct(jt.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new IG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new RG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=xl(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}}(i),n={...$t(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new yG(e),n.add(t),i(t)),y5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const w5=t=>P$({...t}),A5=t=>({...t,style:{...P$(t.style)}}),k5=t=>{const e=w5(t?.slider?.trackStyle??{}),i=w5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},P$({...s}));var s;const r=A5(t?.controller?.start??{}),a=A5(t?.controller?.pause??{}),o=A5(t?.controller?.backward??{}),l=A5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},M5=(t,e)=>({...k5(t),data:e,type:"continuous"}),C5=(t,e)=>({...k5(t),data:e,type:"discrete"}),T5=t=>"left"===t||"right"===t,E5=t=>"top"===t||"bottom"===t;class P5 extends Y2{layoutZIndex=r$.Player;layoutLevel=a$.Player;static type=un.player;type=un.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return h(i)||!1===i.visible?null:new P5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),b(t.x)){const e=T5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(b(t.y)){const e=E5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{...C5(this._spec,this._specs),...e}:{...M5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new _Y(t):this._playerComponent=new bY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 v(this._spec.width)?Math.min(t.width,Number(this._spec.width)):T5(this._orient)?this._maxSize():t.width}_computeHeight(t){return v(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):E5(this._orient)?this._maxSize():t.height}_computeDx(t){return T5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return E5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size),(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(VX.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnEnd,(()=>{this.event.emit(VX.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];N(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(VX.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const R5=(t,e)=>Tl(t[0].latestData,e.field),B5=(t,e)=>El(t[0].latestData,e.field);function I5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function D5(t,e){return Pl(t[0].latestData,e.field)}function L5(t,e){return Rl(t[0].latestData,e.field)}function O5(t,e){return function(t,e){return Math.sqrt(Rl(t,e))}(t[0].latestData,e.field)}function F5(t,e){return function(t,e){return Z(t.map((t=>t[e])))}(t[0].latestData,e.field)}function z5(t,e){const i={min:R5,max:B5,sum:I5,average:D5,variance:L5,standardDeviation:O5,median:F5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(c(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(c(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function H5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.x)){v(t.x)&&V5(u,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function j5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.y)){v(t.y)&&V5(u,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function N5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();v(t.x)&&V5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),v(t.y)&&V5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function V5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const W5=["sum","average","min","max","variance","standardDeviation","median"];class G5 extends Y2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||W5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??N(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(N(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Tl(t,e),r=El(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Y5 extends G5{static type=un.markLine;type=un.markLine;name=un.markLine;layoutZIndex=r$.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new Y5(i,{...e,specKey:Y5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new Y5(t,{...e,specIndex:i,specKey:Y5.speckey}))})),n}_createMarkerComponent(){const t=new LU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:P$(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:P$(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:P$(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)||c(t.coordinates)&&c(t.process)&&c(t.process.x),a=c(t.y)||c(t.coordinates)&&c(t.process)&&c(t.process.y),o=c(t.coordinates)&&(!c(t.process)||"process"in t&&"xy"in t.process),l=c(t.positions),h=t?.autoRange??!1;let d=[];r?d=H5(e,i,n,s,h)[0]:a?d=j5(e,i,n,s,h)[0]:o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new Vo(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new Vo(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class X5 extends G5{static type=un.markArea;type=un.markArea;name=un.markArea;layoutZIndex=r$.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new X5(i,{...e,specKey:X5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new X5(t,{...e,specIndex:i,specKey:X5.speckey}))})),n}_createMarkerComponent(){const t=new OU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:P$(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)&&c(t.x1),a=c(t.y)&&c(t.y1),o=c(t.coordinates),l=c(t.positions),h=t?.autoRange??!1;let d=[],u=[];r?(u=H5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):a?(u=j5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=c(t.x)&&c(t.x1),n=c(t.y)&&c(t.y1),s=c(t.coordinates);if(!i&&!n&&!s)return null;let r;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new Vo(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class $5 extends G5{static type=un.markPoint;type=un.markPoint;name=un.markPoint;layoutZIndex=r$.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new $5(i,{...e,specKey:$5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new $5(t,{...e,specIndex:i,specKey:$5.speckey}))})),n}_createMarkerComponent(){const t=new FU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:P$(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:P$(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{...P$(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{...P$(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:P$(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=N5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!c(t.coordinate))return;rK(this._option.dataSet,"markerAggregation",z5);const i=this._processSpecCoo(t),n=new Vo(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const K5=(t,e,i)=>h(t)?t:l(t)?t(e,i):t,q5=(t,e,i)=>{if(h(t))return t;if(m(t)){const n=[];return t.forEach((t=>{if(l(t)){const s=t(e,i);c(s)&&n.push(s)}else n.push(t)})),n}return l(t)?t(e,i):t};const Z5=(t,e)=>(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight),J5="vchart-tooltip-container",Q5=20,t4={key:"其他",value:"..."},e4={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class i4{static dom=`${Kj}_TOOLTIP_HANDLER_DOM`;static canvas=`${Kj}_TOOLTIP_HANDLER_CANVAS`}const n4=(t,e,i)=>{const n=K5(e.key,t,i),s=K5(e.value,t,i),r=!1!==K5(e.visible,t,i)&&(c(n)||c(s)),a=K5(e.isKeyAdaptive,t,i),o=K5(e.shapeType,t,i),l=K5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},s4=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,r4=(t,e)=>{let i;if(c(t))if(v(t))i=t;else if(l(t)){const n=t(e);v(n)&&(i=n)}return i},a4=(t,e)=>{const i=b$(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function o4(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Ej,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var l4;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(l4||(l4={}));class h4{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),l4.success):(this._updateTooltip(!1,e),l4.success)}if(h(n)||h(s))return l4.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(c(t.visible)||c(t.activeType)?s.visible=bq(t).includes("mark"):c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=s4(i,"mark")??{},a=L({},R(e.mark),R(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(c))),[]);if(t.every((t=>!bq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=s4(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{l(t)?o.push(t):o.push(...N(t))})),r={...i[0],content:o};let d={};const u=t.filter((t=>{const e=t.tooltipHelper?.spec;return c(e?.dimension)&&bq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(u.length){let t=[];u.every((({content:t})=>h(t)))?t=void 0:u.forEach((({content:e})=>{h(e)||(l(e)?t?.push(e):t?.push(...N(e)))})),d={...u[0],content:t}}a=L({},R(e.dimension),d)}const o=r.title,d={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(c(a.title))if(l(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...d,...n}}}else a.title={...r.title,...d,...a.title};else a.title={...r.title,...d};const u=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),p=N(r.content);if(c(a.content))if(l(a.content)){const t=a.content;a.content=(e,i)=>{const n=N(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...u(p[0]),...t}})),n}}else{const t=N(a.content);t.forEach(((e,i)=>{t[i]={...u(p[0]),...e}}))}else a.content=p.map((t=>({...t,...u(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return l4.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??l4.success;const a=r[n];if(!a)return l4.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),h(o.title?.key)&&h(o.title?.value)&&!o.content?.length?l4.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??l4.success;const o=i[n];if(!o)return l4.failed;const l=this._getActualTooltipPosition(e,q5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),l4.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=v(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...e4,offsetX:t?.x??e4.offsetX,offsetY:t?.y??e4.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=q5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=q5(t.title,e,i),s=N(q5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=Q5}=t,o=!1!==K5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,c(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=K5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=n4(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...t4});break}if(!(r.content.lengthh(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=n4(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...t4});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(h(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),h(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!c(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,u=this._component.getSpec(),p="canvas"===u.renderMode,g=i?.chart?.getCanvasRect(),f=g?.width??qj,m=g?.height??Zj;let y,_,v,x,S,w,A=!1;if(d(e)){const{left:t,right:i,top:n,bottom:s}=e;y=r4(t,r),_=r4(n,r),v=r4(i,r),x=r4(s,r)}else if(c(e)&&"mark"===t.activeType){A=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case H$.left:y=t-a-l,_=(i+c)/2-o/2;break;case H$.right:y=n+l,_=(i+c)/2-o/2;break;case H$.top:y=(t+n)/2-a/2,_=i-o-h;break;case H$.bottom:y=(t+n)/2-a/2,_=c+h;break;case H$.inside:y=(t+n)/2-a/2,_=(i+c)/2-o/2}}}const k={width:0,height:0},M=(t=0)=>({x:t,y:t});let C=M(),T=M(),E=1,P=1;if(Zo(this._env)&&!u.confine){if(k.width=window.innerWidth,k.height=window.innerHeight,!p){T=n.getBoundingClientRect();const t=this._compiler.getCanvas()??this._chartContainer,e=t.getBoundingClientRect();C={x:e.x-T.x,y:e.y-T.y},E=Z5(t,e),P=Z5(n,T)}}else k.width=f,k.height=m;const{canvasX:R,canvasY:B}=r;S=b(y)?y:b(v)?f-a-v:R+l,w=b(_)?_:b(x)?m-o-x:B+h,S*=E,w*=E,Zo(this._env)&&(S+=C.x,w+=C.y),S/=P,w/=P;const{width:I,height:D}=k;return(S+a)*P+T.x>I&&(A?S=(I-T.x)/P-a:S-=2*l+a),(w+o)*P+T.y>D&&(A?w=(D-T.y)/P-o:w-=2*h+o),S*P+T.x<0&&(S=0-T.x/P),w*P+T.y<0&&(w=0-T.y/P),{x:S,y:w}};_getTooltipBoxSize(t,e){return e&&!h(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:m="",hasShape:y,shapeType:_="",shapeHollow:v,shapeColor:b}=h;if(l.title.visible=f,f){const{text:t,width:e,height:i}=a4(m,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},u=e,g=i,y&&WP[_]){const t={symbolType:_};v?t.stroke=b:t.fill=b,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],h=[],d=[];l.content=t.map(((l,u)=>{const g={height:0,spaceRow:i};let f=0;const{hasShape:m,key:y,shapeColor:_,shapeHollow:v,shapeType:b="",value:x,isKeyAdaptive:S}=l;if(c(y)){const{width:t,height:e,text:i}=a4(y,a);g.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},S?h.push(t):n.push(t),f=Math.max(f,e)}if(c(x)){const{width:t,height:e,text:i}=a4(x,o);g.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},d.push(t),f=Math.max(f,e)}if(m&&WP[b]){e=!0;const t={visible:!0,symbolType:b};v?t.stroke=_:t.fill=_,f=Math.max(r.size,f),g.shape=t}else g.shape={visible:!1};return g.height=f,p+=f,uc(t)?m(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function d4(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=L({},e,t),d={};return d.fontFamily=i,d.fontSize=c4(n),d.color=s,d.textAlign=r,d.lineHeight=c4(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=c4(c),d}function u4(t,e){if(!t)return;const{size:i}=L({},e,t),n={};return n.width=c4(i),n}class p4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===p4.type}type=p4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return p4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=qo?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(p4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const g4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},f4={boxSizing:"border-box"},m4={display:"flex",whiteSpace:"nowrap"},y4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},_4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},v4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},b4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},x4={lineHeight:"normal"};class S4 extends p4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!WP[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=WP[e].pathStr;let o="currentColor";if(!n||f(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(d(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class w4 extends p4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class A4 extends p4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=$(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=$(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},y4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=L({},a?v4:_4,{height:c4(i[n].height),...t.keyColumn.item});f(r)&&""!==r?.trim?.()||v(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=L({},b4,{height:c4(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=L({},x4,{height:c4(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class k4 extends p4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new A4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new A4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new A4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(L({},m4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class M4 extends p4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new S4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new w4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(L({},g4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class C4 extends p4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&c(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new M4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new k4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},f4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class T4 extends h4{type=i4.dom;_tooltipContainer=qo?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(qo&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:d,lineWidth:u=0},padding:p,key:g,value:f,title:m,shape:y,enterable:_,spaceRow:v,transitionDuration:b}=t,x=i,S={panel:{width:c4((e?.panel?.width??0)+2*u),height:c4((e?.panel?.height??0)+2*u),paddingBottom:c4(p.bottom),paddingLeft:c4(p.left),paddingRight:c4(p.right),paddingTop:c4(p.top),borderColor:d,borderWidth:c4(u),borderRadius:c4(h),backgroundColor:x?`${x}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:_?"auto":"none",transitionDuration:b?`${b}ms`:"initial",transitionProperty:b?"transform":"initial",transitionTimingFunction:b?"ease-out":"initial"},title:d4(m),content:{},shapeColumn:{item:u4(y),width:c4(y.size),marginRight:c4(y.spacing??8)},keyColumn:{item:d4(g),width:c4(e?.keyWidth),marginRight:c4(g.spacing??26)},valueColumn:{item:d4(f),width:c4(e?.valueWidth),marginRight:c4(f.spacing??0)},spaceRow:c4(v)};if(c(v)){const t=v/2;[S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((e=>{e.marginTop=c4(t),e.marginBottom=e.marginTop})),S.content.marginTop=c4(-t),S.content.marginBottom=S.content.marginTop}else[S.content,S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return S}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class E4 extends h4{type=i4.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new CY({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?c(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class P4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&c(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??l4.success:l4.failed}class R4 extends P4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!xq(t)&&!h(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...X$(r,a)??[],...Z$(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(c(i))break}return c(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class B4 extends P4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const I4=t=>c(t)&&!m(t),D4=t=>c(t)&&m(t);class L4 extends Y2{static type=un.tooltip;type=un.tooltip;name=un.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!m(i))return new L4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new L4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?E4:T4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new B4(this),dimension:new R4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:GX.chart},this._handleMouseMove),(Jo(e)||Qo(e))&&(this._mountEvent("pointerdown",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;Zo(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||xq(t)||(n&&I4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&D4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):c(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!h(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),r};_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};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=L({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!c(t.visible)||t.visible,activeType:bq(t),renderMode:"html",trigger:c(t.trigger)?t.trigger:"hover",className:c(t.className)?t.className:"vchart-tooltip-element",enterable:!!c(t.enterable)&&t.enterable,transitionDuration:c(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=c(t.triggerOff)?t.triggerOff:this._spec.trigger,c(t.renderMode)?this._spec.renderMode=t.renderMode:Qo(this._option.mode)&&(this._spec.renderMode="canvas"),c(t.mark)&&(this._spec.mark={...R(t.mark),activeType:"mark"}),c(t.dimension)&&(this._spec.dimension={...R(t.dimension),activeType:"dimension"}),c(t.parentElement)?f(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Zo(this._option.mode)&&(this._spec.parentElement=qo?.body),c(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=vq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:WX.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(h(this._cacheInfo)||h(t))return!1;if(D4(t)){if(I4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>D$(t,e[i])))}if(D4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(c(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(c(n)&&c(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function O4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function F4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const z4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??O4(e)};let o=!1;return f(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??F4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class H4 extends Y2{static type=un.label;type=un.label;name=un.label;layoutType="absolute";layoutZIndex=r$.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new H4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(VX.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(hV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(hV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Ll(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:R$.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:R$.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{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}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=z4[s.type]??z4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return L({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class j4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(b(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:l(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&c(t.modelId)){if(c(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&c(t.modelKey)&&"modelIndex"in t&&c(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>N4(t))),a=s.filter((t=>!N4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>N4(t))),h=o.filter((t=>!N4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);b(o.width)||(o.width=a.width),b(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function N4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class V4 extends VK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&j$(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&N$(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var W4;W4={},L(xG.poptip,W4),Wk.load(CG),wK.useChart([J1,x2,Q1,t2,L2,S2,A2,k2,I2,E2,n2,O2,v2,b2,M2,N2,V2,r2,a2,C2,R2,B2,F2,i2,z2,H2,e2,D2,m2,P2,y2]),wK.useComponent([V3,G3,U3,$3,X3,Q3,o5,L4,x5,S5,Z2,q2,h5,p5,Y5,c5,X5,P5,H4,$5,Q2,J2,c3]),B$.registerLayout("grid",j4),B$.registerLayout("layout3d",V4),t.Arc3dMark=qJ,t.ArcMark=XJ,t.AreaChart=J1,t.AreaMark=vJ,t.AreaSeries=bJ,t.Bar3dChart=t2,t.Bar3dSeries=gJ,t.BarChart=Q1,t.BarSeries=ZZ,t.BaseChart=sq,t.BaseMark=KK,t.BaseSeries=Lq,t.BoxPlotChart=e2,t.BoxPlotMark=sJ,t.BoxPlotSeries=oJ,t.Brush=Q2,t.CartesianAxis=F3,t.CartesianBandAxis=G3,t.CartesianChart=rq,t.CartesianCrossHair=x5,t.CartesianLinearAxis=V3,t.CartesianSeries=Oq,t.CartesianTimeAxis=U3,t.CellMark=q1,t.CirclePackingChart=i2,t.CirclePackingSeries=T1,t.CircularProgressChart=M2,t.CircularProgressSeries=fQ,t.CommonChart=n2,t.ComponentMark=ZK,t.ContinuousLegend=o5,t.CustomMark=J2,t.DataZoom=Z2,t.DiscreteLegend=Q3,t.DotSeries=cQ,t.Factory=B$,t.Funnel3dChart=a2,t.Funnel3dSeries=N0,t.FunnelChart=r2,t.FunnelSeries=H0,t.GaugeChart=m2,t.GaugePointerSeries=X1,t.GaugeSeries=$1,t.GeoCoordinate=p5,t.GridLayout=j4,t.GroupMark=qK,t.HeatmapChart=y2,t.HeatmapSeries=Z1,t.Histogram3dChart=b2,t.HistogramChart=v2,t.Indicator=h5,t.Label=H4,t.Layout=VK,t.Layout3d=V4,t.LineChart=x2,t.LineMark=dJ,t.LineSeries=uJ,t.LinearProgressChart=C2,t.LinearProgressSeries=yQ,t.LinkPathMark=j1,t.LinkSeries=uQ,t.MapChart=S2,t.MapLabelComponent=c3,t.MapSeries=jJ,t.MarkArea=X5,t.MarkLine=Y5,t.MarkPoint=$5,t.PathMark=OJ,t.Pie3dChart=k2,t.Pie3dSeries=ZJ,t.PieChart=A2,t.PieSeries=KJ,t.Player=P5,t.PolarAxis=Y3,t.PolarBandAxis=$3,t.PolarChart=g2,t.PolarCrossHair=S5,t.PolarLinearAxis=X3,t.PolarSeries=NJ,t.PolygonMark=z0,t.ProgressArcMark=gQ,t.ProgressLikeChart=f2,t.ProgressLikeSeries=pQ,t.Pyramid3dMark=j0,t.RadarChart=E2,t.RadarSeries=aQ,t.RangeAreaChart=P2,t.RangeAreaSeries=SJ,t.RangeColumn3dChart=B2,t.RangeColumn3dSeries=_J,t.RangeColumnChart=R2,t.RangeColumnSeries=yJ,t.Rect3dMark=pJ,t.RectMark=KZ,t.RoseChart=I2,t.RoseLikeChart=T2,t.RoseLikeSeries=sQ,t.RoseSeries=rQ,t.RuleMark=JZ,t.SankeyChart=D2,t.SankeySeries=N1,t.ScatterChart=L2,t.ScatterSeries=nQ,t.ScrollBar=q2,t.SequenceChart=O2,t.SunburstChart=F2,t.SunburstSeries=k1,t.SymbolMark=aJ,t.TextMark=qZ,t.ThemeManager=v$,t.Title=c5,t.Tooltip=L4,t.TreeMapChart=z2,t.TreeMapSeries=Y1,t.VChart=wK,t.WaterfallChart=H2,t.WaterfallSeries=QZ,t.WordCloud3dChart=V2,t.WordCloud3dSeries=S0,t.WordCloudChart=N2,t.WordCloudSeries=x0,t.default=wK,t.version="1.1.0",Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var s={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}]`,o=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||a(t,"Boolean")},l=t=>"function"==typeof t,h=t=>null==t,c=t=>null!=t,d=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},u=t=>"object"==typeof t&&null!==t,p=function(t){if(!u(t)||!a(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},g=t=>void 0===t,f=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||a(t,"String")},m=t=>Array.isArray?Array.isArray(t):a(t,"Array"),y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},_=t=>a(t,"Date"),v=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||a(t,"Number")},b=t=>v(t)&&Number.isFinite(t),x=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),S=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),w=Object.prototype,A=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)},k=Object.prototype.hasOwnProperty;function M(t){if(h(t))return!0;if(y(t))return!t.length;const e=S(t);if("Map"===e||"Set"===e)return!t.size;if(A(t))return!Object.keys(t).length;for(const e in t)if(k.call(t,e))return!1;return!0}const C=(t,e,i)=>{const n=f(e)?e.split("."):e;for(let e=0;enull!=t&&T.call(t,e);function P(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,o){if(null===i)return null;if(0===o)return i;let l;if("object"!=typeof i)return i;if(m(i)?l=[]:a(i,"RegExp")?(l=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(l.lastIndex=i.lastIndex)):l=_(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(l)}for(const e in i)l[e]=t(i[e],o-1);return l}(t,i)}function R(t){let e;if(!c(t)||"object"!=typeof t)return t;const i=m(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:o(t)||v(t)||f(t)?t:_(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=R(n)}return e}function B(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(c(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];c(n[r])&&"object"==typeof n[r]?I(t,e,r,i):D(t,r,n[r])}}}}function I(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(m(r)){if(n)a=[];else if(m(s))a=s;else if(y(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!z(t[i],e[i]))return!1;return!0}if(!p(t))return!1;const i=F(t),n=F(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!z(t[s],e[s]))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;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function G(t,e){if(!m(t)||!m(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Y(t,e,i){c(e)||(e=t,t=0),c(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function $(t){return Number(t)}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function q(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(h(n)&&(n=t.length);i>>1;X(t[s],e)>0?n=s:i=s+1}return i}const Z=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(X)),K(i,.5)},J=Math.sqrt(50),Q=Math.sqrt(10),et=Math.sqrt(2);function it(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=J?s*=10:r>=Q?s*=5:r>=et&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:nt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function at(t,e,i,n){return t>e&&!rt(t,e,i,n)}function ot(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},ht=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?lt(n,r)+s:"center"===i?lt(n,Math.floor(r/2))+s+lt(n,Math.ceil(r/2)):s+lt(n,r)},ct=function(t,e,i){return ti?i:t},dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,p=!0;const g=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function y(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function _(){const t=Date.now();if(y(t))return v(t);o=m(_,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function v(t){return o=void 0,p&&n?f(t):(n=s=void 0,a)}function x(){const t=Date.now(),i=y(t);for(var r=arguments.length,d=new Array(r),p=0;pt*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const _t=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vt=new RegExp(_t.source,"g");const bt=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function xt(t){if(t instanceof Date)return t;if(f(t)){const e=bt.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return h(t)?new Date(NaN):new Date(Math.round(t))}const St=1e-12,wt=Math.PI,At=wt/2,kt=2*wt,Mt=2*Math.PI,Ct=Math.abs,Tt=Math.atan2,Et=Math.cos,Pt=Math.max,Rt=Math.min,Bt=Math.sin,It=Math.sqrt,Dt=Math.pow;function Lt(t){return t>1?0:t<-1?wt:Math.acos(t)}function Ot(t){return t>=1?At:t<=-1?-At:Math.asin(t)}function Ft(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function zt(t,e){return t[0]*e[1]-t[1]*e[0]}class Ht{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ht(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 v(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return v(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 jt{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Ht((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return m(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Nt(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 Wt extends Vt{}function Gt(t){return t*(Math.PI/180)}function Ut(t){return 180*t/Math.PI}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-kt;)t+=kt;else if(t>0)for(;t>kt;)t-=kt;return t},Xt=Yt;function $t(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Kt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new qt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new qt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new qt(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=Ut(r.rotateDeg),r}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return v(t)?new re(t>>16,t>>8&255,255&t,1):m(t)?new re(t[0],t[1],t[2]):new re(255,255,255)}let se=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(c(te[t]))return function(t){return v(t)?new re(t>>>24,t>>>16&255,t>>>8&255,255&t):m(t)?new re(t[0],t[1],t[2],t[3]):new re(255,255,255,1)}(te[t]);if(c(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new re((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new re(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new re(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new re(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new re(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}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}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=Zt(h(t)?s.h:ct(t,0,360),h(e)?s.s:e>=0&&e<=1?100*e:e,h(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new re(r.r,r.g,r.b,n),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}};class re{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)),c(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ae(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new re(e,c,d,l*(1-t)+h*t)}},rgbToHex:oe,rgbToHsl:Jt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ye;function _e(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}function be(t,e,i){return null===t?e:null===e?t:(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,i&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>=fe||de<=ge||ue>=ye||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ye)})}var xe;function Se(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me]),ce>fe||deye||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function ke(t){return t/180*Math.PI}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?t.angle:ke(t.angle),n=Me(t);return[Ae({x:t.x1,y:t.y1},i,n),Ae({x:t.x2,y:t.y1},i,n),Ae({x:t.x2,y:t.y2},i,n),Ae({x:t.x1,y:t.y2},i,n)]}let Te,Ee,Pe,Re;function Be(t){return Te=1/0,Ee=1/0,Pe=-1/0,Re=-1/0,t.forEach((t=>{Te>t.x&&(Te=t.x),Pet.y&&(Ee=t.y),Ree&&r>n||rs?o:0}function Fe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class He{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(),c(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=c(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(h(this._canvas)&&(c(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),h(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&c(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),h(this._context)&&c(this._canvas)){const t=this._canvas.getContext("2d");c(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!h(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(h(t))return{width:0,height:0};if(h(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 c;try{const h=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});c={width:h.width(),height:h.height()}}catch(e){this._notSupportVRender=!0,c=this.measureWithNaiveCanvas(t)}return c}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}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===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(h(this._numberCharSize)){const t=this._standardMethod(He.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/He.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return h(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(He.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(h(this._letterCharSize)){const t=this._standardMethod(He.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/He.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return c(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){c(this._canvas)&&(this._canvas=null),c(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}He.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",He.NUMBERS_CHAR_SET="0123456789",He.FULL_SIZE_CHAR="字";const je="undefined"!=typeof console;function Ne(t,e,i){const n=[e].concat([].slice.call(i));je&&console[t].apply(console,n)}var Ve;!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"}(Ve||(Ve={}));class We{static getInstance(t,e){return We._instance&&v(t)?We._instance.level(t):We._instance||(We._instance=new We(t,e)),We._instance}static setInstance(t){return We._instance=t}static setInstanceLevel(t){We._instance?We._instance.level(t):We._instance=new We(t)}static clearInstance(){We._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Ve.Info}canLogDebug(){return this._level>=Ve.Debug}canLogError(){return this._level>=Ve.Error}canLogWarn(){return this._level>=Ve.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Ve.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):Ne(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Warn&&Ne(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Info&&Ne(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Debug&&Ne(this._method||"log","DEBUG",e),this}}function Ge(t){if(b(t))return[t,t,t,t];if(m(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(d(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 Ue(t){return t?"getUTCFullYear":"getFullYear"}function Ye(t){return t?"getUTCMonth":"getMonth"}function Xe(t){return t?"getUTCDate":"getDate"}function $e(t){return t?"getUTCHours":"getHours"}function Ke(t){return t?"getUTCMinutes":"getMinutes"}function qe(t){return t?"getUTCSeconds":"getSeconds"}function Ze(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Je(t){return t?"setUTCFullYear":"setFullYear"}We._instance=null;const Qe=1e3,ti=6e4,ei=36e5,ii=24*ei,ni=31*ii,si=365*ii,ri=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),ai=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),oi=(t,e)=>e.getFullYear()-t.getFullYear(),li=t=>t.getFullYear(),hi=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),ci=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),di=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),ui=t=>t.getUTCFullYear(),pi=t=>(t.setDate(1),t.setHours(0,0,0,0),t),gi=(t,e)=>(t.setMonth(t.getMonth()+e),t),fi=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),mi=t=>t.getMonth(),yi=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),_i=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),vi=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),bi=t=>t.getUTCMonth(),xi=t=>(t.setHours(0,0,0,0),t),Si=(t,e)=>(t.setDate(t.getDate()+e),t),wi=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ii,Ai=t=>t.getDate()-1,ki=t=>(t.setUTCHours(0,0,0,0),t),Mi=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Ci=(t,e)=>(+e-+t)/ii,Ti=t=>t.getUTCDate()-1,Ei=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),Pi=(t,e)=>(t.setHours(t.getHours()+e),t),Ri=(t,e)=>(+e-+t)/ei,Bi=t=>t.getHours(),Ii=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),Di=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Li=t=>t.getUTCHours(),Oi=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),Fi=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),zi=(t,e)=>(+e-+t)/6e4,Hi=t=>t.getMinutes(),ji=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),Ni=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Vi=t=>t.getUTCMinutes(),Wi=t=>(t.setTime(+t-t.getMilliseconds()),t),Gi=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ui=(t,e)=>(+e-+t)/1e3,Yi=t=>t.getSeconds(),Xi=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),$i=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ki=t=>t.getUTCSeconds(),qi=t=>t,Zi=(t,e)=>(t.setTime(+t+e),t),Ji=(t,e)=>+e-+t,Qi=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},tn=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Qi(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Qi(h,c)}};function en(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function nn(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var sn=6371008.8,rn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*sn,kilometers:6371.0088,kilometres:6371.0088,meters:sn,metres:sn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:sn/1852,radians:1,yards:6967335.223679999};function an(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function on(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ln(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function hn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Gt(t[0]),r=Gt(t[1]),a=Gt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=rn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Ut(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Ut(l)}}const cn=t=>t;var dn,un;t.RenderModeEnum=void 0,(dn=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",dn["mobile-browser"]="mobile-browser",dn.node="node",dn.worker="worker",dn.miniApp="miniApp",dn["desktop-miniApp"]="desktop-miniApp",dn.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(un||(un={}));for(let t=0;t<256;t++)t.toString(16);const pn=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};function gn(){return new fn}function fn(){this.reset()}fn.prototype={constructor:fn,reset:function(){this.s=this.t=0},add:function(t){yn(mn,t,this.t),yn(this,mn.s,this.s),this.s?this.t+=mn.t:this.s=mn.t},valueOf:function(){return this.s}};var mn=new fn;function yn(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var _n=1e-6,vn=Math.PI,bn=vn/2,xn=vn/4,Sn=2*vn,wn=180/vn,An=vn/180,kn=Math.abs,Mn=Math.atan,Cn=Math.atan2,Tn=Math.cos,En=Math.exp,Pn=Math.log,Rn=Math.pow,Bn=Math.sin,In=Math.sign||function(t){return t>0?1:t<0?-1:0},Dn=Math.sqrt,Ln=Math.tan;function On(t){return t>1?0:t<-1?vn:Math.acos(t)}function Fn(t){return t>1?bn:t<-1?-bn:Math.asin(t)}function zn(){}function Hn(t,e){t&&Nn.hasOwnProperty(t.type)&&Nn[t.type](t,e)}var jn={Feature:function(t,e){Hn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nvn?t+Math.round(-t/Sn)*Sn:t,e]}function ts(t,e,i){return(t%=Sn)?e||i?Jn(is(t),ns(e,i)):is(t):e||i?ns(e,i):Qn}function es(t){return function(e,i){return[(e+=t)>vn?e-Sn:e<-vn?e+Sn:e,i]}}function is(t){var e=es(t);return e.invert=es(-t),e}function ns(t,e){var i=Tn(t),n=Bn(t),s=Tn(e),r=Bn(e);function a(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*i+o*n;return[Cn(l*s-c*r,o*i-h*n),Fn(c*s+l*r)]}return a.invert=function(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*s-l*r;return[Cn(l*s+h*r,o*i+c*n),Fn(c*i-o*n)]},a}function ss(t,e){(e=Yn(e))[0]-=t,Zn(e);var i=On(-e[1]);return((-e[2]<0?-i:i)+Sn-_n)%Sn}function rs(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:zn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function as(t,e){return kn(t[0]-e[0])<_n&&kn(t[1]-e[1])<_n}function os(t,e,i,n){this.x=t,this.z=e,this.o=i,this.e=n,this.v=!1,this.n=this.p=null}function ls(t,e,i,n,s){var r,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,i,n=t[0],a=t[e];if(as(n,a)){if(!n[2]&&!a[2]){for(s.lineStart(),r=0;r=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function hs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function ps(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function gs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=rs(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=y,u.lineStart=_,u.lineEnd=v,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=ps(a);var t=function(t,e){var i=ds(e),n=e[1],s=Bn(n),r=[Bn(i),-Tn(i),0],a=0,o=0;cs.reset(),1===s?n=bn+_n:-1===s&&(n=-bn-_n);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>vn,C=f*x;if(cs.add(Cn(C*A*Bn(k),m*S+C*Tn(k))),a+=M?w+A*Sn:w,M^p>=i^v>=i){var T=$n(Yn(u),Yn(_));Zn(T);var E=$n(r,T);Zn(E);var P=(M^w>=0?-1:1)*Fn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-_n||a<_n&&cs<-_n)^1&o}(r,n);a.length?(d||(s.polygonStart(),d=!0),ls(a,ms,t,i,s)):t&&(d||(s.polygonStart(),d=!0),s.lineStart(),i(null,null,1,s),s.lineEnd()),d&&(s.polygonEnd(),d=!1),a=r=null},sphere:function(){s.polygonStart(),s.lineStart(),i(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function p(e,i){t(e,i)&&s.point(e,i)}function g(t,e){l.point(t,e)}function f(){u.point=g,l.lineStart()}function m(){u.point=p,l.lineEnd()}function y(t,e){o.push([t,e]),c.point(t,e)}function _(){c.lineStart(),o=[]}function v(){y(o[0][0],o[0][1]),c.lineEnd();var t,e,i,n,l=c.clean(),u=h.result(),p=u.length;if(o.pop(),r.push(o),o=null,p)if(1&l){if((e=(i=u[0]).length-1)>0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(fs))}return u}}function fs(t){return t.length>1}function ms(t,e){return((t=t.x)[0]<0?t[1]-bn-_n:bn-t[1])-((e=e.x)[0]<0?e[1]-bn-_n:bn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return us(e(t),i)})}(us);var ys=gs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?vn:-vn,l=kn(r-i);kn(l-vn)<_n?(t.point(i,n=(n+a)/2>0?bn:-bn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=vn&&(kn(i-s)<_n&&(i-=s*_n),kn(r-o)<_n&&(r-=o*_n),n=function(t,e,i,n){var s,r,a=Bn(t-i);return kn(a)>_n?Mn((Bn(e)*(r=Tn(n))*Bn(i)-Bn(n)*(s=Tn(e))*Bn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*bn,n.point(-vn,s),n.point(0,s),n.point(vn,s),n.point(vn,0),n.point(vn,-s),n.point(0,-s),n.point(-vn,-s),n.point(-vn,0),n.point(-vn,s);else if(kn(t[0]-e[0])>_n){var r=t[0]0,s=kn(e)>_n;function r(t,i){return Tn(t)*Tn(i)>e}function a(t,i,n){var s=[1,0,0],r=$n(Yn(t),Yn(i)),a=Xn(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=$n(s,r),u=qn(s,h);Kn(u,qn(r,c));var p=d,g=Xn(u,p),f=Xn(p,p),m=g*g-f*(Xn(u,u)-1);if(!(m<0)){var y=Dn(m),_=qn(p,(-g-y)/f);if(Kn(_,u),_=Un(_),!n)return _;var v,b=t[0],x=i[0],S=t[1],w=i[1];x0^_[1]<(kn(_[0]-b)<_n?S:w):S<=_[1]&&_[1]<=w:A>vn^(b<=_[0]&&_[0]<=x)){var M=qn(p,(-g+y)/f);return Kn(M,u),[_,Un(M)]}}}function o(e,i){var s=n?t:vn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return gs(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=n?f?0:o(d,u):f?o(d+(d<0?vn:-vn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||as(e,p)||as(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(s&&e&&n^f){var y;m&i||!(y=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!f||e&&as(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Tn(e),o=Bn(e),l=n*i;null==s?(s=e+n*Sn,r=e-l/2):(s=ss(a,s),r=ss(a,r),(n>0?sr)&&(s+=n*Sn));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return kn(n[0]-t)<_n?s>0?0:3:kn(n[0]-i)<_n?s>0?2:1:kn(n[1]-e)<_n?s>0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,y,_,v=a,b=rs(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);y=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,s=(l=ps(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&ls(l,o,e,r,a),a.polygonEnd());v=a,l=h=c=null}};function S(t,e){s(t,e)&&v.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),y)d=r,u=a,p=o,y=!1,o&&(v.lineStart(),v.point(r,a));else if(o&&m)v.point(r,a);else{var l=[g=Math.max(bs,Math.min(vs,g)),f=Math.max(bs,Math.min(vs,f))],b=[r=Math.max(bs,Math.min(vs,r)),a=Math.max(bs,Math.min(vs,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(v.lineStart(),v.point(r,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),o||v.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ss(t){return t}var ws,As,ks,Ms,Cs=gn(),Ts=gn(),Es={point:zn,lineStart:zn,lineEnd:zn,polygonStart:function(){Es.lineStart=Ps,Es.lineEnd=Is},polygonEnd:function(){Es.lineStart=Es.lineEnd=Es.point=zn,Cs.add(kn(Ts)),Ts.reset()},result:function(){var t=Cs/2;return Cs.reset(),t}};function Ps(){Es.point=Rs}function Rs(t,e){Es.point=Bs,ws=ks=t,As=Ms=e}function Bs(t,e){Ts.add(Ms*t-ks*e),ks=t,Ms=e}function Is(){Bs(ws,As)}var Ds=Es,Ls=1/0,Os=Ls,Fs=-Ls,zs=Fs,Hs={point:function(t,e){tFs&&(Fs=t);ezs&&(zs=e)},lineStart:zn,lineEnd:zn,polygonStart:zn,polygonEnd:zn,result:function(){var t=[[Ls,Os],[Fs,zs]];return Fs=zs=-(Os=Ls=1/0),t}};var js,Ns,Vs,Ws,Gs=Hs,Us=0,Ys=0,Xs=0,$s=0,Ks=0,qs=0,Zs=0,Js=0,Qs=0,tr={point:er,lineStart:ir,lineEnd:rr,polygonStart:function(){tr.lineStart=ar,tr.lineEnd=or},polygonEnd:function(){tr.point=er,tr.lineStart=ir,tr.lineEnd=rr},result:function(){var t=Qs?[Zs/Qs,Js/Qs]:qs?[$s/qs,Ks/qs]:Xs?[Us/Xs,Ys/Xs]:[NaN,NaN];return Us=Ys=Xs=$s=Ks=qs=Zs=Js=Qs=0,t}};function er(t,e){Us+=t,Ys+=e,++Xs}function ir(){tr.point=nr}function nr(t,e){tr.point=sr,er(Vs=t,Ws=e)}function sr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,er(Vs=t,Ws=e)}function rr(){tr.point=er}function ar(){tr.point=lr}function or(){hr(js,Ns)}function lr(t,e){tr.point=hr,er(js=Vs=t,Ns=Ws=e)}function hr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,Zs+=(s=Ws*t-Vs*e)*(Vs+t),Js+=s*(Ws+e),Qs+=3*s,er(Vs=t,Ws=e)}var cr=tr;function dr(t){this._context=t}dr.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,Sn)}},result:zn};var ur,pr,gr,fr,mr,yr=gn(),_r={point:zn,lineStart:function(){_r.point=vr},lineEnd:function(){ur&&br(pr,gr),_r.point=zn},polygonStart:function(){ur=!0},polygonEnd:function(){ur=null},result:function(){var t=+yr;return yr.reset(),t}};function vr(t,e){_r.point=br,pr=fr=t,gr=mr=e}function br(t,e){fr-=t,mr-=e,yr.add(Dn(fr*fr+mr*mr)),fr=t,mr=e}var xr=_r;function Sr(){this._string=[]}function wr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ar(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Gn(t,i(n))),n.result()}return r.area=function(t){return Gn(t,i(Ds)),Ds.result()},r.measure=function(t){return Gn(t,i(xr)),xr.result()},r.bounds=function(t){return Gn(t,i(Gs)),Gs.result()},r.centroid=function(t){return Gn(t,i(cr)),cr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ss):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Sr):new dr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function kr(t){return function(e){var i=new Mr;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Mr(){}function Cr(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Gn(i,t.stream(Gs)),e(Gs.result()),null!=n&&t.clipExtent(n),t}function Tr(t,e,i){return Cr(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Er(t,e,i){return Tr(t,[[0,0],e],i)}function Pr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Rr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Sr.prototype={_radius:4.5,_circle:wr(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=wr(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}},Mr.prototype={constructor:Mr,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 Br=16,Ir=Tn(30*An);function Dr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,m){var y=h-n,_=c-s,v=y*y+_*_;if(v>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Dn(b*b+x*x+S*S),A=Fn(S/=w),k=kn(kn(S)-1)<_n||kn(r-d)<_n?(r+d)/2:Cn(x,b),M=t(k,A),C=M[0],T=M[1],E=C-n,P=T-s,R=_*E-y*P;(R*R/v>e||kn((y*E+_*P)/v-.5)>.3||a*u+o*p+l*g2?t[2]%360*An:0,E()):[m*wn,y*wn,_*wn]},C.angle=function(t){return arguments.length?(v=t%360*An,E()):v*wn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Dr(o,M=t*t),P()):Dn(M)},C.fitExtent=function(t,e){return Tr(C,t,e)},C.fitSize=function(t,e){return Er(C,t,e)},C.fitWidth=function(t,e){return Pr(C,t,e)},C.fitHeight=function(t,e){return Rr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function jr(t){var e=0,i=vn/3,n=Hr(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*An,i=t[1]*An):[e*wn,i*wn]},s}function Nr(t,e){var i=Bn(t),n=(i+Bn(e))/2;if(kn(n)<_n)return function(t){var e=Tn(t);function i(t,i){return[t*e,Bn(i)/e]}return i.invert=function(t,i){return[t/e,Fn(i*e)]},i}(t);var s=1+i*(2*n-i),r=Dn(s)/n;function a(t,e){var i=Dn(s-2*n*Bn(e))/n;return[i*Bn(t*=n),r-i*Tn(t)]}return a.invert=function(t,e){var i=r-e,a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,Fn((s-(t*t+i*i)*n*n)/(2*n))]},a}function Vr(){return jr(Nr).scale(155.424).center([0,33.6442])}function Wr(){return Vr().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Gr(t){return function(e,i){var n=Tn(e),s=Tn(i),r=t(n*s);return[r*s*Bn(e),r*Bn(i)]}}function Ur(t){return function(e,i){var n=Dn(e*e+i*i),s=t(n),r=Bn(s),a=Tn(s);return[Cn(e*r,n*a),Fn(n&&i*r/n)]}}var Yr=Gr((function(t){return Dn(2/(1+t))}));Yr.invert=Ur((function(t){return 2*Fn(t/2)}));var Xr=Gr((function(t){return(t=On(t))&&t/Bn(t)}));function $r(t,e){return[t,Pn(Ln((bn+e)/2))]}function Kr(){return qr($r).scale(961/Sn)}function qr(t){var e,i,n,s=zr(t),r=s.center,a=s.scale,o=s.translate,l=s.clipExtent,h=null;function c(){var r=vn*a(),o=s(function(t){function e(e){return(e=t(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e}return t=ts(t[0]*An,t[1]*An,t.length>2?t[2]*An:0),e.invert=function(e){return(e=t.invert(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e},e}(s.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),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function Zr(t){return Ln((bn+t)/2)}function Jr(t,e){var i=Tn(t),n=t===e?Bn(t):Pn(i/Tn(e))/Pn(Zr(e)/Zr(t)),s=i*Rn(Zr(t),n)/n;if(!n)return $r;function r(t,e){s>0?e<-bn+_n&&(e=-bn+_n):e>bn-_n&&(e=bn-_n);var i=s/Rn(Zr(e),n);return[i*Bn(n*t),s-i*Tn(n*t)]}return r.invert=function(t,e){var i=s-e,r=In(n)*Dn(t*t+i*i),a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,2*Mn(Rn(s/r,1/n))-bn]},r}function Qr(t,e){return[t,e]}function ta(t,e){var i=Tn(t),n=t===e?Bn(t):(i-Tn(e))/(e-t),s=i/n+t;if(kn(n)<_n)return Qr;function r(t,e){var i=s-e,r=n*t;return[i*Bn(r),s-i*Tn(r)]}return r.invert=function(t,e){var i=s-e,r=Cn(t,kn(i))*In(i);return i*n<0&&(r-=vn*In(t)*In(i)),[r/n,s-In(n)*Dn(t*t+i*i)]},r}Xr.invert=Ur((function(t){return t})),$r.invert=function(t,e){return[t,2*Mn(En(e))-bn]},Qr.invert=Qr;var ea=1.340264,ia=-.081106,na=893e-6,sa=.003796,ra=Dn(3)/2;function aa(t,e){var i=Fn(ra*Bn(e)),n=i*i,s=n*n*n;return[t*Tn(i)/(ra*(ea+3*ia*n+s*(7*na+9*sa*n))),i*(ea+ia*n+s*(na+sa*n))]}function oa(t,e){var i=Tn(e),n=Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function la(t,e){var i=e*e,n=i*i;return[t*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791)),e*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))]}function ha(t,e){return[Tn(e)*Bn(t),Bn(e)]}function ca(t,e){var i=Tn(e),n=1+Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function da(t,e){return[Pn(Ln((bn+e)/2)),-t]}aa.invert=function(t,e){for(var i,n=e,s=n*n,r=s*s*s,a=0;a<12&&(r=(s=(n-=i=(n*(ea+ia*s+r*(na+sa*s))-e)/(ea+3*ia*s+r*(7*na+9*sa*s)))*n)*s*s,!(kn(i)<1e-12));++a);return[ra*t*(ea+3*ia*s+r*(7*na+9*sa*s))/Tn(n),Fn(Bn(n)/ra)]},oa.invert=Ur(Mn),la.invert=function(t,e){var i,n=e,s=25;do{var r=n*n,a=r*r;n-=i=(n*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))-e)/(1.007226+r*(.045255+a*(.259866*r-.311325-.005916*11*a)))}while(kn(i)>_n&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ha.invert=Ur(Fn),ca.invert=Ur((function(t){return 2*Mn(t)})),da.invert=function(t,e){return[-e,2*Mn(En(t))-bn]},Kr().translate([0,0]).center([0,0]).scale(63781);var ua=Object.prototype.hasOwnProperty;function pa(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^ya[2]^ya[3])}function va(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=pa(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return _a(r[t])}function S(t,e){return ga(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=Sa(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ia(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Da(t,e)}))}:Da(t,e)}function Da(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=La(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function La(t,e){var i=Ra(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function Ha(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Ba(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=ja(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=Ya(t.slice(0,n),e),o=Ya(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Xa=Ya;!function(t){var e=Xa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=Ka(Ja,e),{tolerance:n}=i;return $a(t,n)};var to;!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"}(to||(to={}));const eo=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},io=(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.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?"+"+oo(e,6):oo(e,4))+"-"+oo(t.getUTCMonth()+1,2)+"-"+oo(t.getUTCDate(),2)+(r?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"."+oo(r,3)+"Z":s?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"Z":n||i?"T"+oo(i,2)+":"+oo(n,2)+"Z":"")}function ho(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 so;if(h)return h=!1,no;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.DSV;const i=Ka(po,e),{delimiter:n}=i;if(!f(n))throw new TypeError("Invalid delimiter: must be a string!");return ho(n).parse(t)},fo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,co(t)},mo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,uo(t)};function yo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return _o(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 _o(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return bo(t);default:throw new Error("unknown GeoJSON type")}}function _o(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=vo(t.properties),e.geometry=bo(t.geometry),e}function vo(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=vo(n):e[i]=n})),e):e}function bo(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return bo(t)})),e):(e.coordinates=xo(t.coordinates),e)}function xo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return xo(t)}))}function So(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 wo(t){for(var e,i,n=So(t),s=0,r=1;r0}function Ao(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=yo(t));var r=[];switch(t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,n)})),t;case"FeatureCollection":return Ao(t,(function(t){Ao(Co(t,n),(function(t){r.push(t)}))})),on(r)}return Co(t,n)}function Co(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,e)})),t;case"LineString":return To(So(t),e),t;case"Polygon":return Eo(So(t),e),t;case"MultiLineString":return So(t).forEach((function(t){To(t,e)})),t;case"MultiPolygon":return So(t).forEach((function(t){Eo(t,e)})),t;case"Point":case"MultiPoint":return t}}function To(t,e){wo(t)===e&&t.reverse()}function Eo(t,e){wo(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Po(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Do=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.GEO;const i=Ka(Bo,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Io(t))})):e.push(Io(t))})),e})(t);let o=t.features;return a&&(o=Mo(t,{reverse:!d(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Ro.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Ro.bounds(t);t.bbox=e}})),t.features=o,t},Lo={},Oo=(t,e,i)=>{i.type=to.GEO;const n=Ka(Bo,Lo,e),{object:s}=n;if(!f(s))throw new TypeError("Invalid object: must be a string!");const r=Ia(t,t.objects[s]);return Do(r,n,i)},Fo=(t,e,i)=>{const n=!o(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!m(t))throw new TypeError("Invalid data: must be DataView array!");return m(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 zo=0;function Ho(){return zo>1e8&&(zo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+zo++}class jo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new r,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Ho("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){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){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const No="_data-view-diff-rank";class Vo{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new r,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Ho("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",io),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=R(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[No]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[No]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[No][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);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};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};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};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};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};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};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};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};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};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};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};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};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};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};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};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=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));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Go(t,e){const i=new Set(N(t)),n=new Set(N(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Uo}=le,Yo=(t,e)=>(l($o.warnHandler)&&$o.warnHandler.call(null,t,e),e?We.getInstance().warn(`[VChart warn]: ${t}`,e):We.getInstance().warn(`[VChart warn]: ${t}`)),Xo=(t,e,i)=>{const n=new Error(t);return We.getInstance().error(`[VChart error]: ${n}`,e)},$o={silent:!1,warnHandler:!1,errorHandler:!1},Ko="undefined"!=typeof window&&void 0!==window.document,qo=Ko&&globalThis.document;function Zo(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ko}function Jo(t){return"miniApp"===t||"mobile-browser"===t}function Qo(t){return t.includes("miniApp")||"lynx"===t}let tl=0;function el(){return tl>=9999999&&(tl=0),tl++}function il(t){return!h(t)&&(!!v(t)||+t==+t)}function nl(t){return!(!t||0===t.length)&&(!h(t[0])&&!h(t[0].dataId)&&m(t[0].fields))}const sl=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const rl=t=>e=>C(e,t),al=t=>{We.getInstance().error(t)},ol=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||al("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&al("Access path missing closing bracket: "+t),a&&al("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return sl((i&&i.get||rl)(n),[s],e||s)},ll=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m(t)){const n=t.map((t=>ol(t,e,i)));return t=>n.map((e=>e(t)))}return ol(t,e,i)};ll("id");const hl=sl((function(t){return t}),[],"identity"),cl=sl((function(){return 0}),[],"zero");sl((function(){return 1}),[],"one"),sl((function(){return!0}),[],"true"),sl((function(){return!1}),[],"false"),sl((function(){return{}}),[],"emptyObject");const dl=(t,e)=>{if((te||h(e))&&!h(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},ul=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>dl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=N(e)||[],s=[],r=[],a={},o=i.comparator||ul;return N(t).forEach(((t,e)=>{if(h(t))return;s.push("desc"===n[e]?-1:1);const o=l(t)?t:ll(t,null,i);var c;r.push(o),(c=o,(h(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:sl(o(r,s),Object.keys(a))},gl=(t,e)=>{const i=l(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(h(e)||h(i))return h(e)&&h(i);if(!u(e)&&!u(i))return e===i;const s=m(e)?e:e[t],r=m(i)?i:i[t];return s===r||!1!==n&&(m(r)?!(!m(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!d(r)&&!(!d(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>fl(t,r,s)))))},ml=(t,e)=>h(t)?e:Math.min(f(t)?e*parseFloat(t)/100:t,e);function yl(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!h(s)&&(s=+s)>=s&&!h(r)&&(r=+r)>=r&&n(s,r,++a)}))}function _l(t,e,i,n,s){let r=0,a=0;return yl(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function vl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;yl(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:_l(t,e,i,s,h)}}const bl=rt;function xl(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Sl=t=>b(t)?Gt(t):null,wl=t=>b(t)?Ut(t):null;function Al(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function kl(t,e,i,n){const s=Al({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function Ml(t){return 3===t||4===t}function Cl(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)}function Tl(t,e){const i=e?+t[0][e]:+t[0];if(!b(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&n{const n=e?+i[e]:+i;return b(n)&&n>t&&(t=n),t}),i)}function Pl(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;b(s)&&(i+=s,n++)}));return i/n}function Rl(t,e){const i=Pl(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Bl(t){let e="center",i="middle";return e=(t=xl(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}}function Il(t,e){const i=Dl(t),n=Dl(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 Dl(t,e={x:0,y:0}){return jt.distancePP(t,e)}function Ll(t,e,i){let n=!1;if(e&&l(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 Ol(t){return function(e){let i;return i=m(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var Fl;function zl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:return!0;default:return!1}}function Hl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}function jl(t){switch(t){case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}!function(t){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"}(Fl||(Fl={}));class Nl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Vl=Symbol("implicit");class Wl extends Nl{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=Fl.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Vl}clone(){return(new Wl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}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!==Vl)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Yl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),Xl=t=>t<0?-t*t:t*t,$l=t=>-Math.log(-t),Kl=t=>-Math.exp(-t),ql=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Zl=t=>10===t?ql:t===Math.E?Math.exp:e=>Math.pow(t,e),Jl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Ql=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),th=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function eh(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 ih(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function nh(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class ah extends Wl{constructor(t){super(),this.type=Fl.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Y(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&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=[$(t[0]),$(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[$(t[0]),$(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:rh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}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()}clone(){return new ah(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:oh}=le;function lh(t,e){const i=typeof e;let n;if(h(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=se.parseColorString(e)){const e=oh(se.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof re?oh(t,e):e instanceof se?oh(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class hh extends Nl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Gl,this._piecewise=ih,this._interpolate=lh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,$);return this._domain=i,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){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=ut(this._domain[0],this._domain[n-1])),this._piecewise=n>2?nh:ih,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Gl),this.rescale(i)):this._clamp!==Gl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ch=Math.sqrt(50),dh=Math.sqrt(10),uh=Math.sqrt(2);function ph(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=ch?a=10:r>=dh?a=5:r>=uh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function fh(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=gh(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class _h extends hh{constructor(){super(...arguments),this.type=Fl.Linear}clone(){return(new _h).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function vh(t){return e=>-t(-e)}class bh extends hh{constructor(){super(Jl(10),Zl(10)),this.type=Fl.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new bh).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){if(t)return this;super.rescale();const e=Jl(this._base),i=Zl(this._base);return this._domain[0]<0?(this._logs=vh(e),this._pows=vh(i),this.transformer=$l,this.untransformer=Kl):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Gl}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.length0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}nice(){return this.domain(sh(this.domain(),{floor:t=>this._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=R(this._domain);return this._domain&&(e[e.length-1]=t,this.domain(e)),this}niceMax(){const t=this._domain[0];this.nice();const e=R(this._domain);return this._domain&&(e[0]=t,this.domain(e)),this}}class xh extends ah{constructor(t){super(!1),this.type=Fl.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class Sh extends _h{constructor(){super(),this.type=Fl.Pow,this._exponent=1}clone(){return(new Sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=Gl,this.untransformer=Gl):.5===this._exponent?(this.transformer=Yl,this.untransformer=Xl):(this.transformer=Ul(this._exponent),this.untransformer=Ul(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function wh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class Ah{constructor(){this.type=Fl.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return wh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new kh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class Mh extends _h{constructor(){super(Yl,Xl),this.type=Fl.Sqrt}clone(){return(new Mh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Ch extends _h{constructor(){super(Ql(1),th(1)),this.type=Fl.Symlog,this._const=1}clone(){return(new Ch).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=Ql(t),this.untransformer=th(t),this.rescale(e)):this._const}}class Th{constructor(){this.type=Fl.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!h(t)&&b(+t)?this._range[q(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 Th).domain(this._domain).range(this._range).unknown(this._unknown)}}const Eh=[["second",1,Qe],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,ti],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,ei],["hour",3,3*ei],["hour",6,6*ei],["hour",12,12*ei],["day",1,ii],["day",2,2*ii],["day",7,7*ii],["month",1,ni],["month",3,3*ni],["month",6,6*ni],["year",1,365*ii]];function Ph(t){return+xt(t)}function Rh(t,e,i,n){const s=(+e-+t)/i,r=q(Eh.map((t=>t[2])),s);if(r===Eh.length){const s=Math.max(it(+t/si,+e/si,i),1),r=t=>(t[Je(n)](Math.floor(t[Ue(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Je(n)](t[Ue(n)]()+e*s),t);return{floor:r,offset:a,ceil:Qi(r,a)}}if(0===r){const n=Math.max(it(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Qi(s,r)}}const[a,o]=Eh[s/Eh[r-1][2]"year"===t&&e?{floor:hi,offset:ci,count:di,field:ui}:"month"===t&&e?{floor:yi,offset:_i,count:vi,field:bi}:"day"===t&&e?{floor:ki,offset:Mi,count:Ci,field:Ti}:"hour"===t&&e?{floor:Ii,offset:Di,count:Ri,field:Li}:"minute"===t&&e?{floor:ji,offset:Ni,count:zi,field:Vi}:"second"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"year"===t?{floor:ri,offset:ai,count:oi,field:li}:"month"===t?{floor:pi,offset:gi,count:fi,field:mi}:"day"===t?{floor:xi,offset:Si,count:wi,field:Ai}:"hour"===t?{floor:Ei,offset:Pi,count:Ri,field:Bi}:"minute"===t?{floor:Oi,offset:Fi,count:zi,field:Hi}:"second"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:{floor:qi,offset:Zi,count:Ji})(a,n);return tn(o,l)}class Bh extends hh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=Fl.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(xt);const i=Array.from(t,Ph);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=xt(t),s=e[Ue(n)](),r=e[Ye(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Xe(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[$e(n)](),c=(h-1)%12+1,d=e[Ke(n)](),u=e[qe(n)](),p=e[Ze(n)]();return(i||"").replace(/YYYY/g,ht(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,ht(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,ht(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,ht(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,ht(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,ht(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,ht(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,ht(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Bh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(v(t)||h(t))&&(i=Rh(e[0],e[e.length-1],h(t)?10:t,this._isUtc)),i&&this.domain(sh(e,i)),this}utc(){return this._isUtc}}function Ih(t,e){const i=c(e)?t?.[e]??t?.default:t?.default;if(!i||m(i))return i;if(d(i)){const{dataScheme:n}=i;return n?zh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c)}))):n.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c):[]}return[]}function Dh(t,e){return zh(t)?t.find((t=>c(t.isAvailable)?l(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!c(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function Lh(t,e,i){const n=c(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!c(e.a)&&!c(e.l)||!f(s))return s;let r=new Uo(s);if(c(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Jt(t,i,n),o=Zt(s,a,e.l),l=new Uo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return c(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Oh=(t,e,i)=>{if(Fh(t)&&e){const n=Lh(e,t,i);if(n)return n}return t};function Fh(t){return d(t)&&"palette"===t.type&&!!t.key}function zh(t){return!!m(t)&&t.every((t=>c(t.scheme)))}class Hh extends Wl{_range;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(!zh(this._range))return void super.range(this._range);const t=Dh(this._range,this._domain);super.range(t)}}const jh={linear:_h,band:ah,point:xh,ordinal:Wl,threshold:Th,colorOrdinal:Hh};function Nh(t){const e=jh[t];return e?new e:null}function Vh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Wh(t){return c(t?.field)&&c(t?.scale)}var Gh;function Uh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Yh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Xh(t){return!!f(t)&&(!!t.endsWith("%")&&il(t.substring(0,t.length-1)))}function $h(t,e,i){return v(t)?t:Xh(t)?Number(t.substring(0,t.length-1))*e/100:l(t)?t(i):0}function Kh(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>v(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=$h(t[s],e.size,i)}))})),n}function qh(t){let e={};return m(t)?(h(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),h(t[1])||(e.left=e.right=t[1]),h(t[2])||(e.bottom=t[2]),h(t[3])||(e.left=t[3]),e):v(t)||Xh(t)||l(t)?(e.top=e.left=e.bottom=e.right=t,e):(d(t)&&(e={...t}),e)}function Zh(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function Jh(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]=Jh(t[n],e)}return i}return m(t)?t.map((t=>Jh(t,e))):t}function Qh(t){const e=t;let i;if(!c(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof Vo||e.every((t=>i.includes(t)))}(e))return e;const n=m(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:o(e)||v(e)||f(e)?e:_(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=Qh(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(Gh||(Gh={}));var tc=function(t){return t&&t.Math==Math&&t},ec=tc("object"==typeof globalThis&&globalThis)||tc("object"==typeof window&&window)||tc("object"==typeof self&&self)||tc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),ic={},nc=function(t){try{return!!t()}catch(t){return!0}},sc=!nc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),rc=!nc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),ac=rc,oc=Function.prototype.call,lc=ac?oc.bind(oc):function(){return oc.apply(oc,arguments)},hc={},cc={}.propertyIsEnumerable,dc=Object.getOwnPropertyDescriptor,uc=dc&&!cc.call({1:2},1);hc.f=uc?function(t){var e=dc(this,t);return!!e&&e.enumerable}:cc;var pc,gc,fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},mc=rc,yc=Function.prototype,_c=yc.call,vc=mc&&yc.bind.bind(_c,_c),bc=mc?vc:function(t){return function(){return _c.apply(t,arguments)}},xc=bc,Sc=xc({}.toString),wc=xc("".slice),Ac=function(t){return wc(Sc(t),8,-1)},kc=nc,Mc=Ac,Cc=Object,Tc=bc("".split),Ec=kc((function(){return!Cc("z").propertyIsEnumerable(0)}))?function(t){return"String"==Mc(t)?Tc(t,""):Cc(t)}:Cc,Pc=function(t){return null==t},Rc=Pc,Bc=TypeError,Ic=function(t){if(Rc(t))throw Bc("Can't call method on "+t);return t},Dc=Ec,Lc=Ic,Oc=function(t){return Dc(Lc(t))},Fc="object"==typeof document&&document.all,zc={all:Fc,IS_HTMLDDA:void 0===Fc&&void 0!==Fc},Hc=zc.all,jc=zc.IS_HTMLDDA?function(t){return"function"==typeof t||t===Hc}:function(t){return"function"==typeof t},Nc=jc,Vc=zc.all,Wc=zc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Nc(t)||t===Vc}:function(t){return"object"==typeof t?null!==t:Nc(t)},Gc=ec,Uc=jc,Yc=function(t,e){return arguments.length<2?(i=Gc[t],Uc(i)?i:void 0):Gc[t]&&Gc[t][e];var i},Xc=bc({}.isPrototypeOf),$c=ec,Kc="undefined"!=typeof navigator&&String(navigator.userAgent)||"",qc=$c.process,Zc=$c.Deno,Jc=qc&&qc.versions||Zc&&Zc.version,Qc=Jc&&Jc.v8;Qc&&(gc=(pc=Qc.split("."))[0]>0&&pc[0]<4?1:+(pc[0]+pc[1])),!gc&&Kc&&(!(pc=Kc.match(/Edge\/(\d+)/))||pc[1]>=74)&&(pc=Kc.match(/Chrome\/(\d+)/))&&(gc=+pc[1]);var td=gc,ed=nc,id=ec.String,nd=!!Object.getOwnPropertySymbols&&!ed((function(){var t=Symbol();return!id(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&td&&td<41})),sd=nd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rd=Yc,ad=jc,od=Xc,ld=Object,hd=sd?function(t){return"symbol"==typeof t}:function(t){var e=rd("Symbol");return ad(e)&&od(e.prototype,ld(t))},cd=String,dd=function(t){try{return cd(t)}catch(t){return"Object"}},ud=jc,pd=dd,gd=TypeError,fd=function(t){if(ud(t))return t;throw gd(pd(t)+" is not a function")},md=fd,yd=Pc,_d=function(t,e){var i=t[e];return yd(i)?void 0:md(i)},vd=lc,bd=jc,xd=Wc,Sd=TypeError,wd={exports:{}},Ad=ec,kd=Object.defineProperty,Md=function(t,e){try{kd(Ad,t,{value:e,configurable:!0,writable:!0})}catch(i){Ad[t]=e}return e},Cd=Md,Td="__core-js_shared__",Ed=ec[Td]||Cd(Td,{}),Pd=Ed;(wd.exports=function(t,e){return Pd[t]||(Pd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Rd=wd.exports,Bd=Ic,Id=Object,Dd=function(t){return Id(Bd(t))},Ld=Dd,Od=bc({}.hasOwnProperty),Fd=Object.hasOwn||function(t,e){return Od(Ld(t),e)},zd=bc,Hd=0,jd=Math.random(),Nd=zd(1..toString),Vd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Nd(++Hd+jd,36)},Wd=Rd,Gd=Fd,Ud=Vd,Yd=nd,Xd=sd,$d=ec.Symbol,Kd=Wd("wks"),qd=Xd?$d.for||$d:$d&&$d.withoutSetter||Ud,Zd=function(t){return Gd(Kd,t)||(Kd[t]=Yd&&Gd($d,t)?$d[t]:qd("Symbol."+t)),Kd[t]},Jd=lc,Qd=Wc,tu=hd,eu=_d,iu=function(t,e){var i,n;if("string"===e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;if(bd(i=t.valueOf)&&!xd(n=vd(i,t)))return n;if("string"!==e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;throw Sd("Can't convert object to primitive value")},nu=TypeError,su=Zd("toPrimitive"),ru=function(t,e){if(!Qd(t)||tu(t))return t;var i,n=eu(t,su);if(n){if(void 0===e&&(e="default"),i=Jd(n,t,e),!Qd(i)||tu(i))return i;throw nu("Can't convert object to primitive value")}return void 0===e&&(e="number"),iu(t,e)},au=hd,ou=function(t){var e=ru(t,"string");return au(e)?e:e+""},lu=Wc,hu=ec.document,cu=lu(hu)&&lu(hu.createElement),du=function(t){return cu?hu.createElement(t):{}},uu=du,pu=!sc&&!nc((function(){return 7!=Object.defineProperty(uu("div"),"a",{get:function(){return 7}}).a})),gu=sc,fu=lc,mu=hc,yu=fc,_u=Oc,vu=ou,bu=Fd,xu=pu,Su=Object.getOwnPropertyDescriptor;ic.f=gu?Su:function(t,e){if(t=_u(t),e=vu(e),xu)try{return Su(t,e)}catch(t){}if(bu(t,e))return yu(!fu(mu.f,t,e),t[e])};var wu={},Au=sc&&nc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ku=Wc,Mu=String,Cu=TypeError,Tu=function(t){if(ku(t))return t;throw Cu(Mu(t)+" is not an object")},Eu=sc,Pu=pu,Ru=Au,Bu=Tu,Iu=ou,Du=TypeError,Lu=Object.defineProperty,Ou=Object.getOwnPropertyDescriptor,Fu="enumerable",zu="configurable",Hu="writable";wu.f=Eu?Ru?function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Hu in i&&!i[Hu]){var n=Ou(t,e);n&&n[Hu]&&(t[e]=i.value,i={configurable:zu in i?i[zu]:n[zu],enumerable:Fu in i?i[Fu]:n[Fu],writable:!1})}return Lu(t,e,i)}:Lu:function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),Pu)try{return Lu(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Du("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var ju=wu,Nu=fc,Vu=sc?function(t,e,i){return ju.f(t,e,Nu(1,i))}:function(t,e,i){return t[e]=i,t},Wu={exports:{}},Gu=sc,Uu=Fd,Yu=Function.prototype,Xu=Gu&&Object.getOwnPropertyDescriptor,$u=Uu(Yu,"name"),Ku={EXISTS:$u,PROPER:$u&&"something"===function(){}.name,CONFIGURABLE:$u&&(!Gu||Gu&&Xu(Yu,"name").configurable)},qu=jc,Zu=Ed,Ju=bc(Function.toString);qu(Zu.inspectSource)||(Zu.inspectSource=function(t){return Ju(t)});var Qu,tp,ep,ip=Zu.inspectSource,np=jc,sp=ec.WeakMap,rp=np(sp)&&/native code/.test(String(sp)),ap=Vd,op=Rd("keys"),lp=function(t){return op[t]||(op[t]=ap(t))},hp={},cp=rp,dp=ec,up=Wc,pp=Vu,gp=Fd,fp=Ed,mp=lp,yp=hp,_p="Object already initialized",vp=dp.TypeError,bp=dp.WeakMap;if(cp||fp.state){var xp=fp.state||(fp.state=new bp);xp.get=xp.get,xp.has=xp.has,xp.set=xp.set,Qu=function(t,e){if(xp.has(t))throw vp(_p);return e.facade=t,xp.set(t,e),e},tp=function(t){return xp.get(t)||{}},ep=function(t){return xp.has(t)}}else{var Sp=mp("state");yp[Sp]=!0,Qu=function(t,e){if(gp(t,Sp))throw vp(_p);return e.facade=t,pp(t,Sp,e),e},tp=function(t){return gp(t,Sp)?t[Sp]:{}},ep=function(t){return gp(t,Sp)}}var wp={set:Qu,get:tp,has:ep,enforce:function(t){return ep(t)?tp(t):Qu(t,{})},getterFor:function(t){return function(e){var i;if(!up(e)||(i=tp(e)).type!==t)throw vp("Incompatible receiver, "+t+" required");return i}}},Ap=bc,kp=nc,Mp=jc,Cp=Fd,Tp=sc,Ep=Ku.CONFIGURABLE,Pp=ip,Rp=wp.enforce,Bp=wp.get,Ip=String,Dp=Object.defineProperty,Lp=Ap("".slice),Op=Ap("".replace),Fp=Ap([].join),zp=Tp&&!kp((function(){return 8!==Dp((function(){}),"length",{value:8}).length})),Hp=String(String).split("String"),jp=Wu.exports=function(t,e,i){"Symbol("===Lp(Ip(e),0,7)&&(e="["+Op(Ip(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Cp(t,"name")||Ep&&t.name!==e)&&(Tp?Dp(t,"name",{value:e,configurable:!0}):t.name=e),zp&&i&&Cp(i,"arity")&&t.length!==i.arity&&Dp(t,"length",{value:i.arity});try{i&&Cp(i,"constructor")&&i.constructor?Tp&&Dp(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Rp(t);return Cp(n,"source")||(n.source=Fp(Hp,"string"==typeof e?e:"")),t};Function.prototype.toString=jp((function(){return Mp(this)&&Bp(this).source||Pp(this)}),"toString");var Np=Wu.exports,Vp=jc,Wp=wu,Gp=Np,Up=Md,Yp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Vp(i)&&Gp(i,r,n),n.global)s?t[e]=i:Up(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Wp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Xp={},$p=Math.ceil,Kp=Math.floor,qp=Math.trunc||function(t){var e=+t;return(e>0?Kp:$p)(e)},Zp=function(t){var e=+t;return e!=e||0===e?0:qp(e)},Jp=Zp,Qp=Math.max,tg=Math.min,eg=function(t,e){var i=Jp(t);return i<0?Qp(i+e,0):tg(i,e)},ig=Zp,ng=Math.min,sg=function(t){return t>0?ng(ig(t),9007199254740991):0},rg=function(t){return sg(t.length)},ag=Oc,og=eg,lg=rg,hg=function(t){return function(e,i,n){var s,r=ag(e),a=lg(r),o=og(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},cg={includes:hg(!0),indexOf:hg(!1)},dg=Fd,ug=Oc,pg=cg.indexOf,gg=hp,fg=bc([].push),mg=function(t,e){var i,n=ug(t),s=0,r=[];for(i in n)!dg(gg,i)&&dg(n,i)&&fg(r,i);for(;e.length>s;)dg(n,i=e[s++])&&(~pg(r,i)||fg(r,i));return r},yg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_g=mg,vg=yg.concat("length","prototype");Xp.f=Object.getOwnPropertyNames||function(t){return _g(t,vg)};var bg={};bg.f=Object.getOwnPropertySymbols;var xg=Yc,Sg=Xp,wg=bg,Ag=Tu,kg=bc([].concat),Mg=xg("Reflect","ownKeys")||function(t){var e=Sg.f(Ag(t)),i=wg.f;return i?kg(e,i(t)):e},Cg=Fd,Tg=Mg,Eg=ic,Pg=wu,Rg=nc,Bg=jc,Ig=/#|\.prototype\./,Dg=function(t,e){var i=Og[Lg(t)];return i==zg||i!=Fg&&(Bg(e)?Rg(e):!!e)},Lg=Dg.normalize=function(t){return String(t).replace(Ig,".").toLowerCase()},Og=Dg.data={},Fg=Dg.NATIVE="N",zg=Dg.POLYFILL="P",Hg=Dg,jg=ec,Ng=ic.f,Vg=Vu,Wg=Yp,Gg=Md,Ug=function(t,e,i){for(var n=Tg(e),s=Pg.f,r=Eg.f,a=0;ar;r++)if((o=y(t[r]))&&bm(Mm,o))return o;return new km(!1)}n=xm(t,s)}for(l=u?t.next:n.next;!(h=fm(l,n)).done;){try{o=y(h.value)}catch(t){wm(n,"throw",t)}if("object"==typeof o&&o&&bm(Mm,o))return o}return new km(!1)},Tm=Xc,Em=TypeError,Pm=function(t,e){if(Tm(e,t))return t;throw Em("Incorrect invocation")},Rm=Zd("iterator"),Bm=!1;try{var Im=0,Dm={next:function(){return{done:!!Im++}},return:function(){Bm=!0}};Dm[Rm]=function(){return this},Array.from(Dm,(function(){throw 2}))}catch(al){}var Lm=wu.f,Om=Fd,Fm=Zd("toStringTag"),zm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Om(t,Fm)&&Lm(t,Fm,{configurable:!0,value:e})},Hm=bc,jm=fd,Nm=jc,Vm=String,Wm=TypeError,Gm=function(t,e,i){try{return Hm(jm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Um=Tu,Ym=function(t){if("object"==typeof t||Nm(t))return t;throw Wm("Can't set "+Vm(t)+" as a prototype")},Xm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Gm(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Um(i),Ym(n),e?t(i,n):i.__proto__=n,i}}():void 0),$m=jc,Km=Wc,qm=Xm,Zm=Xg,Jm=ec,Qm=bc,ty=Hg,ey=Yp,iy=If,ny=Cm,sy=Pm,ry=jc,ay=Pc,oy=Wc,ly=nc,hy=function(t,e){if(!e&&!Bm)return!1;var i=!1;try{var n={};n[Rm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},cy=zm,dy=function(t,e,i){var n,s;return qm&&$m(n=e.constructor)&&n!==i&&Km(s=n.prototype)&&s!==i.prototype&&qm(t,s),t},uy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=Jm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=Qm(o[t]);ey(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!oy(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ty(t,!ry(a)||!(s||o.forEach&&!ly((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),iy.enable();else if(ty(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=ly((function(){d.has(1)})),g=hy((function(t){new a(t)})),f=!s&&ly((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){sy(t,o);var i=dy(new a,t,l);return ay(e)||ny(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,Zm({global:!0,constructor:!0,forced:l!=a},h),cy(l,t),s||i.setStrong(l,t,n),l},py={},gy=mg,fy=yg,my=Object.keys||function(t){return gy(t,fy)},yy=sc,_y=Au,vy=wu,by=Tu,xy=Oc,Sy=my;py.f=yy&&!_y?Object.defineProperties:function(t,e){by(t);for(var i,n=xy(e),s=Sy(e),r=s.length,a=0;r>a;)vy.f(t,i=s[a++],n[i]);return t};var wy,Ay=Yc("document","documentElement"),ky=Tu,My=py,Cy=yg,Ty=hp,Ey=Ay,Py=du,Ry="prototype",By="script",Iy=lp("IE_PROTO"),Dy=function(){},Ly=function(t){return"<"+By+">"+t+""},Oy=function(t){t.write(Ly("")),t.close();var e=t.parentWindow.Object;return t=null,e},Fy=function(){try{wy=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Fy="undefined"!=typeof document?document.domain&&wy?Oy(wy):(e=Py("iframe"),i="java"+By+":",e.style.display="none",Ey.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Ly("document.F=Object")),t.close(),t.F):Oy(wy);for(var n=Cy.length;n--;)delete Fy[Ry][Cy[n]];return Fy()};Ty[Iy]=!0;var zy,Hy,jy,Ny=Object.create||function(t,e){var i;return null!==t?(Dy[Ry]=ky(t),i=new Dy,Dy[Ry]=null,i[Iy]=t):i=Fy(),void 0===e?i:My.f(i,e)},Vy=Np,Wy=wu,Gy=function(t,e,i){return i.get&&Vy(i.get,e,{getter:!0}),i.set&&Vy(i.set,e,{setter:!0}),Wy.f(t,e,i)},Uy=Yp,Yy=function(t,e,i){for(var n in e)Uy(t,n,e[n],i);return t},Xy=!nc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),$y=Fd,Ky=jc,qy=Dd,Zy=Xy,Jy=lp("IE_PROTO"),Qy=Object,t_=Qy.prototype,e_=Zy?Qy.getPrototypeOf:function(t){var e=qy(t);if($y(e,Jy))return e[Jy];var i=e.constructor;return Ky(i)&&e instanceof i?i.prototype:e instanceof Qy?t_:null},i_=nc,n_=jc,s_=Wc,r_=e_,a_=Yp,o_=Zd("iterator"),l_=!1;[].keys&&("next"in(jy=[].keys())?(Hy=r_(r_(jy)))!==Object.prototype&&(zy=Hy):l_=!0);var h_=!s_(zy)||i_((function(){var t={};return zy[o_].call(t)!==t}));h_&&(zy={}),n_(zy[o_])||a_(zy,o_,(function(){return this}));var c_={IteratorPrototype:zy,BUGGY_SAFARI_ITERATORS:l_},d_=c_.IteratorPrototype,u_=Ny,p_=fc,g_=zm,f_=Nf,m_=function(){return this},y_=Xg,__=lc,v_=jc,b_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=u_(d_,{next:p_(+!n,i)}),g_(t,s,!1),f_[s]=m_,t},x_=e_,S_=Xm,w_=zm,A_=Vu,k_=Yp,M_=Nf,C_=Ku.PROPER,T_=Ku.CONFIGURABLE,E_=c_.IteratorPrototype,P_=c_.BUGGY_SAFARI_ITERATORS,R_=Zd("iterator"),B_="keys",I_="values",D_="entries",L_=function(){return this},O_=Yc,F_=Gy,z_=sc,H_=Zd("species"),j_=Ny,N_=Gy,V_=Yy,W_=jf,G_=Pm,U_=Pc,Y_=Cm,X_=function(t,e,i,n,s,r,a){b_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!P_&&t in p)return p[t];switch(t){case B_:case I_:case D_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[R_]||p["@@iterator"]||s&&p[s],f=!P_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=x_(m.call(new t)))!==Object.prototype&&o.next&&(x_(o)!==E_&&(S_?S_(o,E_):v_(o[R_])||k_(o,R_,L_)),w_(o,d,!0)),C_&&s==I_&&g&&g.name!==I_&&(T_?A_(p,"name",I_):(u=!0,f=function(){return __(g,this)})),s)if(l={values:c(I_),keys:r?f:c(B_),entries:c(D_)},a)for(h in l)(P_||u||!(h in p))&&k_(p,h,l[h]);else y_({target:e,proto:!0,forced:P_||u},l);return p[R_]!==f&&k_(p,R_,f,{name:s}),M_[e]=f,l},$_=function(t,e){return{value:t,done:e}},K_=function(t){var e=O_(t);z_&&e&&!e[H_]&&F_(e,H_,{configurable:!0,get:function(){return this}})},q_=sc,Z_=If.fastKey,J_=wp.set,Q_=wp.getterFor,tv={getConstructor:function(t,e,i,n){var s=t((function(t,s){G_(t,r),J_(t,{type:e,index:j_(null),first:void 0,last:void 0,size:0}),q_||(t.size=0),U_(s)||Y_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Q_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=Z_(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),q_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=Z_(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return V_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,q_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),q_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=W_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),V_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),q_&&N_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=Q_(e),r=Q_(n);X_(t,e,(function(t,e){J_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?$_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,$_(void 0,!0))}),i?"entries":"values",!i,!0),K_(e)}};uy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),tv);var ev=Ac,iv=Array.isArray||function(t){return"Array"==ev(t)},nv=bc,sv=nc,rv=jc,av=Jf,ov=ip,lv=function(){},hv=[],cv=Yc("Reflect","construct"),dv=/^\s*(?:class|function)\b/,uv=nv(dv.exec),pv=!dv.exec(lv),gv=function(t){if(!rv(t))return!1;try{return cv(lv,hv,t),!0}catch(t){return!1}},fv=function(t){if(!rv(t))return!1;switch(av(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pv||!!uv(dv,ov(t))}catch(t){return!0}};fv.sham=!0;var mv=!cv||sv((function(){var t;return gv(gv.call)||!gv(Object)||!gv((function(){t=!0}))||t}))?fv:gv,yv=iv,_v=mv,vv=Wc,bv=Zd("species"),xv=Array,Sv=function(t){var e;return yv(t)&&(e=t.constructor,(_v(e)&&(e===xv||yv(e.prototype))||vv(e)&&null===(e=e[bv]))&&(e=void 0)),void 0===e?xv:e},wv=jf,Av=Ec,kv=Dd,Mv=rg,Cv=function(t,e){return new(Sv(t))(0===e?0:e)},Tv=bc([].push),Ev=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=kv(l),f=Av(g),m=wv(h,c),y=Mv(f),_=0,v=d||Cv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Tv(b,u)}else switch(t){case 4:return!1;case 7:Tv(b,u)}return r?-1:n||s?s:b}},Pv={forEach:Ev(0),map:Ev(1),filter:Ev(2),some:Ev(3),every:Ev(4),find:Ev(5),findIndex:Ev(6),filterReject:Ev(7)},Rv=bc,Bv=Yy,Iv=If.getWeakData,Dv=Pm,Lv=Tu,Ov=Pc,Fv=Wc,zv=Cm,Hv=Fd,jv=wp.set,Nv=wp.getterFor,Vv=Pv.find,Wv=Pv.findIndex,Gv=Rv([].splice),Uv=0,Yv=function(t){return t.frozen||(t.frozen=new Xv)},Xv=function(){this.entries=[]},$v=function(t,e){return Vv(t.entries,(function(t){return t[0]===e}))};Xv.prototype={get:function(t){var e=$v(this,t);if(e)return e[1]},has:function(t){return!!$v(this,t)},set:function(t,e){var i=$v(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Wv(this.entries,(function(e){return e[0]===t}));return~e&&Gv(this.entries,e,1),!!~e}};var Kv,qv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Dv(t,r),jv(t,{type:e,id:Uv++,frozen:void 0}),Ov(s)||zv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Nv(e),o=function(t,e,i){var n=a(t),s=Iv(Lv(e),!0);return!0===s?Yv(n).set(e,i):s[n.id]=i,t};return Bv(r,{delete:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).delete(t):i&&Hv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).has(t):i&&Hv(i,e.id)}}),Bv(r,i?{get:function(t){var e=a(this);if(Fv(t)){var i=Iv(t);return!0===i?Yv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},Zv=yf,Jv=ec,Qv=bc,tb=Yy,eb=If,ib=uy,nb=qv,sb=Wc,rb=wp.enforce,ab=nc,ob=rp,lb=Object,hb=Array.isArray,cb=lb.isExtensible,db=lb.isFrozen,ub=lb.isSealed,pb=lb.freeze,gb=lb.seal,fb={},mb={},yb=!Jv.ActiveXObject&&"ActiveXObject"in Jv,_b=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},vb=ib("WeakMap",_b,nb),bb=vb.prototype,xb=Qv(bb.set);if(ob)if(yb){Kv=nb.getConstructor(_b,"WeakMap",!0),eb.enable();var Sb=Qv(bb.delete),wb=Qv(bb.has),Ab=Qv(bb.get);tb(bb,{delete:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),Sb(this,t)||e.frozen.delete(t)}return Sb(this,t)},has:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)||e.frozen.has(t)}return wb(this,t)},get:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)?Ab(this,t):e.frozen.get(t)}return Ab(this,t)},set:function(t,e){if(sb(t)&&!cb(t)){var i=rb(this);i.frozen||(i.frozen=new Kv),wb(this,t)?xb(this,t,e):i.frozen.set(t,e)}else xb(this,t,e);return this}})}else Zv&&ab((function(){var t=pb([]);return xb(new vb,t,1),!db(t)}))&&tb(bb,{set:function(t,e){var i;return hb(t)&&(db(t)?i=fb:ub(t)&&(i=mb)),xb(this,t,e),i==fb&&pb(t),i==mb&&gb(t),this}});var kb=Yc,Mb=bc,Cb=Rd,Tb=kb("Map"),Eb=kb("WeakMap"),Pb=Mb([].push),Rb=Cb("metadata"),Bb=Rb.store||(Rb.store=new Eb),Ib=function(t,e,i){var n=Bb.get(t);if(!n){if(!i)return;Bb.set(t,n=new Tb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Tb)}return s},Db={store:Bb,getMap:Ib,has:function(t,e,i){var n=Ib(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Ib(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Ib(i,n,!0).set(t,e)},keys:function(t,e){var i=Ib(t,e,!1),n=[];return i&&i.forEach((function(t,e){Pb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Lb=Tu,Ob=Db.toKey,Fb=Db.set;Xg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Ob(arguments[3]);Fb(t,e,Lb(i),n)}});var zb=Tu,Hb=Db.toKey,jb=Db.getMap,Nb=Db.store;Xg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Hb(arguments[2]),n=jb(zb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=Nb.get(e);return s.delete(i),!!s.size||Nb.delete(e)}});var Vb=Tu,Wb=e_,Gb=Db.has,Ub=Db.get,Yb=Db.toKey,Xb=function(t,e,i){if(Gb(t,e,i))return Ub(t,e,i);var n=Wb(e);return null!==n?Xb(t,n,i):void 0};Xg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Yb(arguments[2]);return Xb(t,Vb(e),i)}});var $b=bc,Kb=Map.prototype,qb={Map:Map,set:$b(Kb.set),get:$b(Kb.get),has:$b(Kb.has),remove:$b(Kb.delete),proto:Kb},Zb=lc,Jb=bc,Qb=function(t,e,i){for(var n,s,r=i||t.next;!(n=Zb(r,t)).done;)if(void 0!==(s=e(n.value)))return s},tx=qb.Map,ex=qb.proto,ix=Jb(ex.forEach),nx=Jb(ex.entries),sx=nx(new tx).next,rx=fd,ax=Pc,ox=rg,lx=Dd,hx=function(t,e,i){return i?Qb(nx(t),(function(t){return e(t[1],t[0])}),sx):ix(t,e)},cx=qb.Map,dx=qb.has,ux=qb.set,px=bc([].push),gx=Xg,fx=bc,mx=Db,yx=Tu,_x=e_,vx=function(t){var e,i,n,s=lx(this),r=ox(s),a=[],o=new cx,l=ax(t)?function(t){return t}:rx(t);for(e=0;e= than the number of constructor arguments of its base class."},yS=function(t,e){return"@postConstruct error in class "+t+": "+e},_S=function(t,e){return"@preDestroy error in class "+t+": "+e},vS=function(t,e){return"onDeactivation() error in class "+t+": "+e},bS="Maximum call stack size exceeded",xS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(Zx,t),userGeneratedMetadata:Reflect.getMetadata(Kx,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(qx,t)||[]},t}(),SS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function wS(t){return t instanceof RangeError||t.message===bS}function AS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function kS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=TS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function MS(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||MS(t.parentRequest,e))}function CS(t){t.childRequests.forEach((function(t){if(MS(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=AS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(gS+" "+e)}CS(t)}))}function TS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ES=function(){function t(t){this.id=rS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),PS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Wx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),RS=function(t,e){this.parentContext=t,this.rootRequest=e},BS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),IS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),DS=function(){function t(t,e,i,n){this.id=rS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new IS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new PS(Wx,n):n instanceof PS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:jS(t,i)}return 0}function NS(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Xx],multiInject:e[$x],targetName:e[Gx],unmanaged:e[Ux]}}var VS=function(){function t(t,e,i,n,s){this.id=rS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function WS(t){return t._bindingDictionary}function GS(t,e,i,n,s){var r=YS(i.container,s.serviceIdentifier),a=[];return r.length===SS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=YS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new VS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case SS.NoBindingsAvailable:if(i.isOptional())return e;var s=AS(t),r=dS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=kS(n,s,YS),new Error(r);case SS.OnlyOneBindingAvailable:return e;case SS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=AS(t),r=cS+" "+s;throw r+=kS(n,s,YS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function US(t,e,i,n,s,r){var a,o;if(null===s){a=GS(t,e,n,null,r),o=new VS(i,n,null,a,r);var l=new RS(n,o);n.addPlan(l)}else a=GS(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===iS.Instance&&null!==e.implementationType){var s=function(t,e){return OS(t,TS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=jS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===nS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=KS(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=iw(iw({},s),{constr:t});n=s.isAsync?function(t){return nw(this,void 0,void 0,(function(){var e,i;return sw(this,(function(n){switch(n.label){case 0:return[4,lw(t.constructorInjections)];case 1:return e=n.sent(),[4,lw(t.propertyInjections)];case 2:return i=n.sent(),[2,ow(iw(iw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):ow(r)}else n=new t;return n}function ow(t){var e,i=new((e=t.constr).bind.apply(e,rw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function lw(t){return nw(this,void 0,void 0,(function(){var e,i,n,s;return sw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Ow=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Lw,onDeactivations:new Lw}},t}(),Fw=function(){return Fw=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new iA(e,i)})).inSingletonScope().whenTargetNamed(e)}class sA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class rA extends sA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const aA=Symbol.for("EnvContribution"),oA=Symbol.for("Global");var lA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,n){e(i,n,t)}};let dA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new rA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};dA=lA([Xw(),cA(0,qw(eA)),cA(0,$w(aA)),hA("design:paramtypes",[Object])],dA);const uA=kt-1e-8;class pA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>uA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=kt)<0&&(n+=kt),(s%=kt)<0&&(s+=kt),ss;++o,a-=At)g(a);else for(a=n-n%At+At,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const fA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,mA={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},yA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let _A,vA,bA,xA,SA,wA;var AA,kA,MA,CA,TA,EA,PA,RA,BA;function IA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function DA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Gt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=kt:T>0&&0===r&&(T-=kt);const E=Math.ceil(Math.abs(T/(At+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*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 FA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class XA extends YA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function $A(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class KA{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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function qA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new KA(s,n),t),s}function ZA(t,e,i,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,n)}class JA{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&&ZA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(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):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:ZA(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}tryUpdateLength(){return this.context.tryUpdateLength()}}function QA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("basis",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new JA(s,n),t),s}function tk(t){return t<0?-1:1}function ek(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(tk(r)+tk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function ik(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function nk(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class sk{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._lastDefined2);break;case 3:nk(this,this._t0,ik(this,this._t0),!1!==this._lastDefined2)}(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;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,nk(this,ik(this,e=ek(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:nk(this,this._t0,e=ek(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}}tryUpdateLength(){return this.context.tryUpdateLength()}}class rk extends sk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ak(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("monotoneX",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new sk(s,n),t),s}function ok(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new XA("monotoneY",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new rk(s,n),t),s}let lk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function hk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new YA("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new lk(r,e,s),t),r}class ck{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.context.closePath()}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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function dk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new ck(s,n),t),s}function uk(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}class pk extends gA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new pA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([yA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([yA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([yA.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([yA.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([yA.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([yA.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([yA.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([yA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([yA.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}toString(){if(!this.toStringCbList){const t=[];t[yA.M]=t=>`M${t[1]} ${t[2]}`,t[yA.L]=t=>`L${t[1]} ${t[2]}`,t[yA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[yA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[yA.A]=t=>{const e=[];LA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;twA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),FA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===PA.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===PA.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)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const gk=["l",0,0,0,0,0,0,0];function fk(t,e,i){const n=gk[0]=t[0];if("a"===n||"A"===n)gk[1]=e*t[1],gk[2]=i*t[2],gk[3]=t[3],gk[4]=t[4],gk[5]=t[5],gk[6]=e*t[6],gk[7]=i*t[7];else if("h"===n||"H"===n)gk[1]=e*t[1];else if("v"===n||"V"===n)gk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Pk=Object.assign(Object.assign({},Sk),{points:[],cornerRadius:0}),Rk=Object.assign(Object.assign({},Sk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Bk=Object.assign(Object.assign({},Sk),{width:0,height:0,cornerRadius:0,length:0}),Ik=Object.assign(Object.assign({},Sk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Dk=Object.assign(Object.assign(Object.assign({},Sk),bk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Lk=Object.assign(Object.assign({},Sk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ok=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Sk),{fill:!0}),Fk=Object.assign(Object.assign({},Ok),{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});var zk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Hk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Dk.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(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._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};Hk=zk([Xw()],Hk);var jk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Nk=Symbol.for("TextMeasureContribution");let Vk=class extends Hk{};Vk=jk([Xw()],Vk);const Wk=new Nw;const Gk=new class{},Uk=Symbol.for("CanvasFactory"),Yk=Symbol.for("Context2dFactory");function Xk(t){return Wk.getNamed(Uk,Gk.global.env)(t)}const $k=1e-4,Kk=Math.sqrt(3),qk=1/3;function Zk(t){return t>-dM&&tdM||t<-dM}const Qk=[0,0],tM=[0,0],eM=[0,0];function iM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function nM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function sM(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 rM(t){return(t%=Mt)<0&&(t+=Mt),t}function aM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function oM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Mt);let d=Math.atan2(l,o);return d<0&&(d+=Mt),d>=n&&d<=s||d+Mt>=n&&d+Mt<=s}function cM(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(Zk(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 pM=[-1,-1,-1],gM=[-1,-1];function fM(){const t=gM[0];gM[0]=gM[1],gM[1]=t}function mM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Zk(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,qk):Math.pow(i,qk),n=n<0?-Math.pow(-n,qk):Math.pow(n,qk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Kk*Math.sin(e)))/(3*a),h=(-o+i*(n-Kk*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,pM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&fM(),p=sM(e,n,r,o,gM[0]),u>1&&(g=sM(e,n,r,o,gM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(Zk(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,pM);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=nM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);pM[0]=-l,pM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Mt-1e-4){n=0,s=Mt;const e=r?1:-1;return a>=pM[0]+t&&a<=pM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Mt,s+=Mt);let c=0;for(let e=0;e<2;e++){const i=pM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=s||t+Mt>=n&&t+Mt<=s)&&(t>wt/2&&t<1.5*wt&&(e=-e),c+=e)}}return c}function vM(t){return Math.round(t/wt*1e8)/1e8%2*wt}function bM(t,e){let i=vM(t[0]);i<0&&(i+=Mt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Mt?s=i+Mt:e&&i-s>=Mt?s=i-Mt:!e&&i>s?s=i+(Mt-vM(i-s)):e&&i1&&(i||(h+=aM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;xM[0]=S,xM[1]=w,bM(xM,Boolean(a[6])),S=xM[0],w=xM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case yA.M:u=m,p=y,c=u,d=p;break;case yA.L:if(i){if(cM(c,d,m,y,e,n,s))return!0}else h+=aM(c,d,m,y,n,s)||0;c=m,d=y;break;case yA.C:if(i){if(lM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=mM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case yA.Q:if(i){if(oM(c,d,m,y,_,v,e,n,s))return!0}else h+=yM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case yA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=aM(c,d,o,l,n,s),i){if(hM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=_M(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case yA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(cM(u,p,o,p,e,n,s)||cM(o,p,o,l,e,n,s)||cM(o,l,u,l,e,n,s)||cM(u,l,u,p,e,n,s))return!0}else h+=aM(o,p,o,l,n,s),h+=aM(u,l,u,p,n,s);break;case yA.Z:if(i){if(cM(c,d,u,p,e,n,s))return!0}else h+=aM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kM=function(t,e){return function(i,n){e(i,n,t)}};let MM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Xk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:bk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new He(Object.assign({defaultFontParams:{fontFamily:bk.fontFamily,fontSize:bk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var CM;MM=wM([Xw(),kM(0,qw(eA)),kM(0,$w(Nk)),kM(1,qw(oA)),AM("design:paramtypes",[Object,Object])],MM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(CM||(CM={}));const TM=new qt;let EM=class{constructor(){this.matrix=new qt}init(t){return this.mode=CM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=CM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(TM.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(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}scale(t,e,i){return this.mode===CM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return TM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}translate(t,e){return this.mode===CM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===CM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};EM=wM([Xw(),AM("design:paramtypes",[])],EM);const PM={arc:wk,area:Ak,circle:kk,line:Tk,path:Ek,symbol:Ik,text:Dk,rect:Rk,rect3d:Bk,polygon:Pk,richtext:Lk,richtextIcon:Fk,image:Ok,group:Mk,glyph:Ck},RM=Object.keys(PM);function BM(){return{arc:Object.assign({},PM.arc),area:Object.assign({},PM.area),circle:Object.assign({},PM.circle),line:Object.assign({},PM.line),path:Object.assign({},PM.path),symbol:Object.assign({},PM.symbol),text:Object.assign({},PM.text),rect:Object.assign({},PM.rect),rect3d:Object.assign({},PM.rect3d),polygon:Object.assign({},PM.polygon),richtext:Object.assign({},PM.richtext),richtextIcon:Object.assign({},PM.richtextIcon),image:Object.assign({},PM.image),group:Object.assign({},PM.group),glyph:Object.assign({},PM.glyph)}}function IM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const DM=new Array(60).fill(0).map((()=>BM()));class LM{constructor(){this._defaultTheme=DM.pop()||BM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?IM(this.userTheme,t.userTheme,!1):this.userTheme=P(t.userTheme),IM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);RM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const OM=new LM;function FM(t,e){return t.glyphHost?FM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):OM.getTheme()}return null}(t)||OM.getTheme()}class zM{static GenAutoIncrementId(){return zM.auto_increment_id++}}zM.auto_increment_id=0;var HM=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 jM extends r{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=zM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return HM(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){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof WM))return void console.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(XM(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=XM(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");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),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 WM))return void console.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=XM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=XM(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.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=YM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(XM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(XM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,XM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof WM))return void console.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"):XM(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 GM))return void console.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.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;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.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){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=0&&t<=C(this.rootTarget,"width")&&e>=0&&e<=C(this.rootTarget,"height")?this.rootTarget:null,i}}const KM={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof NM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new UM(t,e))}},qM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class ZM{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(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,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new $M(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new WM,this.rootWheelEvent=new GM,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&f(t)&&!E(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class JM{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const QM=(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"},tC=(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 eC extends r{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=YM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=YM.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||QM(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=tC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=YM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=tC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=QM(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=YM.now()-i>this.config.press.time&&tC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class nC{static Avaliable(){return!0}avaliable(){return nC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class sC{static Avaliable(){return!!Gk.global.getRequestAnimationFrame()}avaliable(){return sC.Avaliable()}tick(t,e){Gk.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var rC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(rC||(rC={}));class aC{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-aC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*aC.bounceIn(2*t):.5*aC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}aC.quadIn=aC.getPowIn(2),aC.quadOut=aC.getPowOut(2),aC.quadInOut=aC.getPowInOut(2),aC.cubicIn=aC.getPowIn(3),aC.cubicOut=aC.getPowOut(3),aC.cubicInOut=aC.getPowInOut(3),aC.quartIn=aC.getPowIn(4),aC.quartOut=aC.getPowOut(4),aC.quartInOut=aC.getPowInOut(4),aC.quintIn=aC.getPowIn(5),aC.quintOut=aC.getPowOut(5),aC.quintInOut=aC.getPowInOut(5),aC.backIn=aC.getBackIn(1.7),aC.backOut=aC.getBackOut(1.7),aC.backInOut=aC.getBackInOut(1.7),aC.elasticIn=aC.getElasticIn(1,.3),aC.elasticOut=aC.getElasticOut(1,.3),aC.elasticInOut=aC.getElasticInOut(1,.3*1.5);const oC=new class{constructor(){this.id=zM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===CA.END?this.removeAnimate(e):e.status===CA.RUNNING||e.status===CA.INITIAL?(this.animateCount++,e.advance(t)):e.status===CA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class lC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class hC extends lC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let cC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oC;this.id=t,this.timeline=e,this.status=CA.INITIAL,this.tailAnimate=new dC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&TA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:MA.ANIMATE_PLAY})}runCb(t){const e=new hC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===CA.RUNNING&&(this.status=CA.PAUSED)}resume(){this.status===CA.PAUSED&&(this.status=CA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new dC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===CA.RUNNING&&(this.status=CA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=CA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};cC.mode=TA.NORMAL,cC.interpolateMap=new Map;class dC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new uC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?aC[i]:i,s=this._addStep(e,null,n);return s.type=EA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?aC[i]:i,r=this._addStep(e,null,s);return r.type=EA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=EA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=EA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new uC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class uC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const pC=200,gC="cubicOut",fC=1e3,mC="quadInOut";var yC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(yC||(yC={}));const _C=[!1,!1,!1,!1],vC=[0,0,0,0],bC=t=>t?m(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(vC[0]=t[0],vC[2]=t[0],vC[1]=t[1],vC[3]=t[1],vC):t:t:0,xC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],SC=[1,2,3,0,1,2,3,0];function wC(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;xC[0].x=i,xC[1].y=i,xC[2].x=-i,xC[3].y=-i;const s=Math.ceil(t/At)%4,r=Math.ceil(e/At)%4;if(n.add(Et(t)*i,Bt(t)*i),n.add(Et(e)*i,Bt(e)*i),s!==r||e-t>wt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ht(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=AC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class RC extends lC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:MA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class BC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=Gk.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class IC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=Gk.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class DC extends lC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Mt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+wt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z}}class LC extends lC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class OC extends lC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?aC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function FC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function zC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{rt(e,n)&&rt(i,s)||t.push(e,i,n,s,n,s)};function GC(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function UC(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 i=t.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),qC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ZC=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return qC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return qC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);ZC(s[0],n,i),ZC(s[1],e-n,i)}};var JC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const QC={};for(const t in JC)E(JC,t)&&(QC[JC[t]]=t);const tT={to:{},get:{}};function eT(t,e,i){return Math.min(Math.max(e,t),i)}function iT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}tT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=tT.get.hsl(t,n),i="hsl";break;case"hwb":e=tT.get.hwb(t,n),i="hwb";break;default:e=tT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},tT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=JC[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=eT(e[n],0,255);return e[3]=eT(e[3],0,1),e},tT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},tT.to.keyword=function(t){return QC[t.slice(0,3)]};const nT=tT;var sT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(sT||(sT={}));class rT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===sT.Color1){let e=rT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=tT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];rT.store1[t]=s,rT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=rT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=tT.get(t),n&&n.value){const e=n.value;rT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],rT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===sT.Color1){if(rT.store1[t])return;rT.store1[t]=i,rT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(rT.store255[t])return;rT.store255[t]=i,rT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function aT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 oT(t,e,i,n,s){if(!t||!e)return t&&aT(t)||e&&aT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=rT.Get(t,sT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=rT.Get(e,sT.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:aT(a)})))});return o?oT(r,l,i,n,s):oT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),aT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}rT.store255={},rT.store1={};const lT=[0,0,0,0],hT=[0,0,0,0];function cT(t,e,i){return rT.Get(t,sT.Color255,lT),rT.Get(e,sT.Color255,hT),`rgba(${Math.round(lT[0]+(hT[0]-lT[0])*i)},${Math.round(lT[1]+(hT[1]-lT[1])*i)},${Math.round(lT[2]+(hT[2]-lT[2])*i)},${lT[3]+(hT[3]-lT[3])*i})`}const dT=(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=oT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},uT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?GC(t):[],s=GC(e);i&&n&&(i.fromTransform&&UC(n,i.fromTransform.clone().getInverse()),UC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},gT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],fT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!gT.includes(s))return;const r=e[s];h(r)||h(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?rT.Get(t[s],sT.Color255):t[s],to:"string"==typeof r?rT.Get(r,sT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class mT extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;uT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&dT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const yT=(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=pT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=fT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new mT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:fC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:mC)),c};class _T extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;uT(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&&dT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const vT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>MC.includes(t))(i)||(e[i]=t[i])})),e},bT=(t,e,i)=>{const n=vT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Gk.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},xT=(t,e,i)=>{const n=[],s=i?null:vT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:vT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=XC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Gk.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=XC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=XC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return $C(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 $C(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Gk.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:KC(i)}];const n=[];return ZC(i,e,n),n})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&v(t.x)&&v(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 ZC(r,e,h),h})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=GC(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Gk.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&bT(t,n,e),n};class wT{static GetImage(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=wT.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},wT.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gk.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gk.global.loadBlob(t):"json"===e&&(i.dataPromise=Gk.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}wT.cache=new Map;const AT=new qt,kT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],MT=["x","y"],CT=["scaleX","scaleY"],TT=["angle"],ET=new Ht;class PT extends jM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Wt,this._updateTag=AA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=FM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;ET.x=i+e,ET.y=n+s}else ET.x=i,ET.y=n;return ET}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new qt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&AA.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&AA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=AA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===kA.GLOBAL){const i=new Ht(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Gk.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!h(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:pC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:gC)}else this.setAttributes(t,!1,{type:MA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();E(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=AA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=AA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&AA.UPDATE_SHAPE_AND_BOUNDS)===AA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=AA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=AA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=mk.x,y:e=mk.y,scaleX:i=mk.scaleX,scaleY:n=mk.scaleY,angle:s=mk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Et(a),f=Bt(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(mk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=AT.setValue(a.a,a.b,a.c,a.d,a.e,a.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:MA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=oT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return FM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gk.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return f(t,!0)?this.pathProxy=(new pk).fromString(t):this.pathProxy=new pk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",x(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(wT.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new UM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}PT.mixin(KM);var RT=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 BT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let IT=0;function DT(){return IT++}const LT=DT(),OT=DT(),FT=DT(),zT=DT(),HT=DT(),jT=DT(),NT=DT(),VT=DT(),WT=DT(),GT=DT(),UT=DT(),YT=DT(),XT=DT(),$T=DT(),KT=DT(),qT=DT(),ZT=Symbol.for("GraphicService"),JT=Symbol.for("GraphicCreator");var QT;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(QT||(QT={}));let tE=class t extends PT{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=jT,this._childUpdateTag=AA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new LM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new LM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===kA.GLOBAL){const i=new Ht(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&AA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=FM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Gk.graphicService.updateGroupAABBBounds(t,FM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=bC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS,this._childUpdateTag&=AA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&AA.UPDATE_BOUNDS||(this._childUpdateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Gk.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Gk.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Gk.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Gk.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&AA.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=Gk.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const eE=Symbol.for("LayerHandlerContribution");class iE extends tE{get offscreen(){return this.layerHandler.offscreen}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=Wk.get(eE),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 LM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Gk.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Gk.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var nE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rE=function(t,e){return function(i,n){e(i,n,t)}};let aE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new iE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};aE=nE([Xw(),rE(0,qw(oA)),sE("design:paramtypes",[Object])],aE);var oE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hE=function(t,e){return function(i,n){e(i,n,t)}};const cE=Symbol.for("Window"),dE=Symbol.for("WindowHandlerContribution");let uE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new rA(["x","y","width","height"])},this._uid=zM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Wk.getNamed(dE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};oE([tA(),lE("design:type",Function),lE("design:paramtypes",[]),lE("design:returntype",void 0)],uE.prototype,"postInit",null),uE=oE([Xw(),hE(0,qw(oA)),lE("design:paramtypes",[Object])],uE);const pE=Symbol.for("TransformUtil"),gE=Symbol.for("GraphicUtil"),fE=Symbol.for("LayerService");var mE=new Vw((t=>{t(dA).toSelf().inSingletonScope(),t(oA).toService(dA),t(uE).to(uE),t(cE).toService(uE),t(MM).toSelf().inSingletonScope(),t(gE).toService(MM),t(EM).toSelf().inSingletonScope(),t(pE).toService(EM),t(aE).toSelf().inSingletonScope(),t(fE).toService(aE)}));function yE(t){return!!t}function _E(t,e){let i;return i=m(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function vE(t,e){return t*e>0}function bE(t,e,i,n){return t*e>0&&i>0&&n>0}function xE(t,e){return t*e>0}function SE(t,e,i,n){return t*e>0&&i>0&&n>0}function wE(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=FM(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,m=vE(d,u),y=xE(d,g),_=yE(h),v=_E(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return FA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function AE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function ME(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(s=Mt-St)e.moveTo(i+s*Et(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>St&&(e.moveTo(i+r*Et(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*Et(f),T=s*Bt(f),E=r*Et(y),P=r*Bt(y);let R,B,I,D;if((A>St||w>St)&&(R=s*Et(m),B=s*Bt(m),I=r*Et(_),D=r*Bt(_),hSt){const t=Rt(v,k),r=Rt(b,k),o=kE(I,D,C,T,s,t,Number(c)),l=kE(R,B,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Et(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+R,n+s*Bt(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>St)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>St){const t=Rt(S,M),s=Rt(x,M),o=kE(E,P,R,B,r,-s,Number(c)),l=kE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Et(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*Et(_),n+r*Bt(_))}return a?a[3]&&e.lineTo(i+s*Et(l),n+s*Et(l)):e.closePath(),d}class CE{static GetCanvas(){try{return CE.canvas||(CE.canvas=Gk.global.createCanvas({})),CE.canvas}catch(t){return null}}static GetCtx(){if(!CE.ctx){const t=CE.GetCanvas();CE.ctx=t.getContext("2d")}return CE.ctx}}class TE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=CE.GetCanvas(),n=CE.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=TE.dataMap.get(i);return n||(n=new TE(t,e),TE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){TE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return TE.dataMap.get(t)}}TE.dataMap=new Map;class EE{static GetSize(t){for(let e=0;e=t)return EE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=EE.GenKey(t,e,i,n,s),l=EE.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=EE.GenKey(t,e,i,n,s);EE.cache[l]?EE.cache[l].push({width:a,height:o,pattern:r}):EE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}EE.cache={},EE.ImageSize=[20,40,80,160,320,640,1280,2560];const PE=Symbol.for("ArcRenderContribution"),RE=Symbol.for("AreaRenderContribution"),BE=Symbol.for("CircleRenderContribution"),IE=Symbol.for("GroupRenderContribution"),DE=Symbol.for("ImageRenderContribution"),LE=Symbol.for("PathRenderContribution"),OE=Symbol.for("PolygonRenderContribution"),FE=Symbol.for("RectRenderContribution"),zE=Symbol.for("SymbolRenderContribution"),HE=Symbol.for("TextRenderContribution"),jE=Symbol.for("InteractiveSubRenderContribution");var NE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WE=function(t,e){return function(i,n){e(i,n,t)}};let GE=class{constructor(t){this.arcRenderContribitions=t,this.numberType=LT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Ct(d-c),p=d>c;let g=!1;if(sSt||M>St)&&(D=s*Et(v),L=s*Bt(v),O=r*Et(x),F=r*Bt(x),uSt){const t=Rt(S,T),r=Rt(w,T),a=kE(O,F,P,R,s,t,Number(p)),o=kE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>St)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>St){const t=Rt(k,E),s=Rt(A,E),a=kE(B,I,D,L,r,-s,Number(p)),o=kE(P,R,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Et(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,l){const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x:_=h.x,y:v=h.y}=t.attribute,b=vE(p,g),x=xE(p,m),S=yE(c),w=_E(u,f);if(!t.valid||!y)return;if(!(S||w||d))return;if(!(b||x||a||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=!1;const{isFullStroke:E,stroke:P}=(t=>{var e;let i=!0;if(o(t,!0)){for(let n=0;n<4;n++)_C[n]=t,i&&(i=!(null!==(e=_C[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)_C[e]=!!t[e],i&&(i=!!_C[e]);else _C[0]=!1,_C[1]=!1,_C[2]=!1,_C[3]=!1;return{isFullStroke:i,stroke:_C}})(u);if(S||E||d){if(e.beginPath(),ME(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,_-i,v-n,h),e.fill())),w&&E&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,_-i,v-n,h),e.stroke()))}if(!E&&w){if(e.beginPath(),ME(t,e,i,n,A,k,P),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if(M&&C){const{startAngle:r,endAngle:o}=t.getParsedAngle();if(Ct(o-r)>=Mt-St){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:o=h.endAngle,fill:c=h.fill}=t.attribute,d=o;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;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),oT(o.color,l.color,h,!1)}(0,0,o,s);a||vE&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};GE=NE([Xw(),WE(0,qw(eA)),WE(0,$w(PE)),VE("design:paramtypes",[Object])],GE);var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XE=function(t,e){return function(i,n){e(i,n,t)}};let $E=class{constructor(t){this.circleRenderContribitions=t,this.numberType=zT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(y,f),w=xE(y,m),A=yE(h),k=_E(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};$E=UE([Xw(),XE(0,qw(eA)),XE(0,$w(BE)),YE("design:paramtypes",[Object])],$E);const KE=["radius","startAngle","endAngle",...kT];class qE extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=zT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=FM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateCircleAABBBounds(i,FM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function JE(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function QE(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class tP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=qT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=FM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=FM(this).text,n=Gk.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=JE(c,s),e=QE(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=JE(c,s),_=QE(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=FM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;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 g=Gk.graphicUtil.textMeasure,f=new tP(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).text[t]}needUpdateTags(t){for(let e=0;e{WP[t.type]=t}));const GP=["symbolType","size",...kT];let UP=class t extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=KT}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return m(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=FM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=WP[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new pk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Pt(r,a);return s.transform(0,0,o,o),this._parsedPath=new VP(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=FM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateSymbolAABBBounds(i,FM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=VT}isValid(){return super.isValid()&&this._isValid()}_isValid(){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=kC(i,n,e))}doUpdateAABBBounds(){const t=FM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateLineAABBBounds(e,FM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const $P=["width","height","cornerRadius",...kT];class KP extends PT{constructor(t){super(t),this.type="rect",this.numberType=YT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=FM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRectAABBBounds(e,FM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).rect[t]}needUpdateTags(t){for(let e=0;e<$P.length;e++){const i=$P[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$P.length;e++)if(t===$P[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=t.width,i=t.height,n=new pk;return n.moveTo(0,0),n.rect(0,0,e,i),n}clone(){return new KP(Object.assign({},this.attribute))}}const qP=[[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 ZP extends KP{constructor(t){super(t),this.type="rect3d",this.numberType=XT}findFace(){const t={polygons:[],vertices:[],edges:[]},e=FM(this).rect3d,{width:i=e.width,height:n=e.width,length:s=Rt(e.width,e.height)}=this.attribute;for(let e=0;e{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){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=Gk.graphicService.updateGlyphAABBBounds(this.attribute,FM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new JP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const QP={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"}},tR=!0,eR=!1,iR=/\w|\(|\)/,nR=/[.?!,;:/,。?!、;:]/,sR=/\S/;function rR(t,e,i,n,s){if(!e||e<=0)return 0;const r=Gk.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=function(t,e){let i=e;for(;iR.test(t[i-1])&&iR.test(t[i])||nR.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function aR(t,e){const i=Gk.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class oR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=QP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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,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=this.lines[i].getWidthWithEllips();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((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=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(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=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class lR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=aR(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=aR(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=rR(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=aR(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||eR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||tR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=rR(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=aR(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const hR=["width","height","image",...kT];class cR extends PT{constructor(t){super(t),this.type="image",this.numberType=NT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=FM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateImageAABBBounds(e,FM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ok[t]}needUpdateTags(t){for(let e=0;e{if(m(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=bC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Ok.width,height:e=Ok.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 uR{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 dR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=QP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof lR){const e=sR.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof dR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof dR?t.width:t.getWidthWithEllips(this.direction)})),e}}class pR{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=QP[this.direction]}store(t){if(t instanceof dR){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 uR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof dR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=rR(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new lR(i,t.newLine,t.character),new lR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const gR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...kT];class fR extends PT{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=$T}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=FM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRichTextAABBBounds(e,FM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new pR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const mR=["path","customPath",...kT];class yR extends PT{constructor(t){super(t),this.type="path",this.numberType=WT}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=FM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pk?e.path:(h(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pk?this.cache:t.path)}doUpdateAABBBounds(){const t=FM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePathAABBBounds(e,FM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;f(t.path,!0)?this.cache=(new pk).fromString(t.path):t.customPath&&(this.cache=new pk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).path[t]}needUpdateTags(t){for(let e=0;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 vR(Object.assign({},this.attribute))}}const bR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kT];class xR extends PT{constructor(t){super(t),this.type="arc",this.numberType=LT}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=FM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(v(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=FM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Xt(e),i=e+r,n&&Ct(r)St&&o>St)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=FM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=It(n*n+s*s)}=this.attribute,o=Ct(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>St&&a>St){const i=e>t?1:-1;let r=Ot(Number(a)/s*Bt(u)),o=Ot(Number(a)/n*Bt(u));return(p-=2*r)>St?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>St?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateArcAABBBounds(i,FM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Mt-St)o.moveTo(0+s*Et(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>St&&(o.moveTo(0+n*Et(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Et(e),r=s*Bt(e),l=n*Et(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new xR(Object.assign({},this.attribute))}}class SR extends xR{constructor(t){super(t),this.type="arc3d",this.numberType=OT}doUpdateAABBBounds(){const t=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateArc3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const wR=["points","cornerRadius",...kT];class AR extends PT{constructor(t){super(t),this.type="polygon",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePolygonAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=kC(i,n,e))}getDefaultAttribute(t){return FM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new AR(Object.assign({},this.attribute))}}class kR extends AR{constructor(t){super(t),this.type="pyramid3d",this.numberType=UT}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePyramid3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}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}}var MR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CR=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};CR=MR([Xw()],CR);var TR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ER=Symbol.for("RectBoundsContribution");let PR=class extends CR{};PR=TR([Xw()],PR);var RR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const BR=Symbol.for("SymbolBoundsContribution");let IR=class extends CR{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;BT(i,n+r+o/2,!0,a)}return i}};IR=RR([Xw()],IR);var DR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const LR=Symbol.for("CircleBoundsContribution");let OR=class extends CR{};OR=DR([Xw()],OR);var FR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const zR=Symbol.for("ArcBoundsContribution");let HR=class extends CR{};HR=FR([Xw()],HR);var jR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const NR=Symbol.for("PathBoundsContribution");let VR=class extends CR{};VR=jR([Xw()],VR);class WR{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return WR.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$R=function(t,e){return function(i,n){e(i,n,t)}};function KR(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=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]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function qR(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 ZR(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function JR(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),KR(t,t,[s+o,r+l,a+h]),KR(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),KR(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=UR.allocate(),n=[0,0];if(y){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]}KR(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),KR(i,i,[-n[0],-n[1],0]),ZR(t,t,i)}}let QR=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new rA(["graphic"]),onSetStage:new rA(["graphic","stage"]),onRemove:new rA(["graphic"]),onAddIncremental:new rA(["graphic","group","stage"]),onClearIncremental:new rA(["graphic","group","stage"]),beforeUpdateAABBBounds:new rA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new rA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Wt,this.tempAABBBounds2=new Wt}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)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new pA(t);return FA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){BT(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),Nt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Mt-St?i.set(-a,-a,a,a):wC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=St?i.set(0,0,0,0):Math.abs(a-o)>Mt-St?i.set(-s,-s,s,s):(wC(o,a,s,i),wC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(m(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){BT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){BT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Nt(e,e,s.transMatrix)}};QR=YR([Xw(),$R(0,qw(JT)),$R(1,qw(eA)),$R(1,$w(ER)),$R(2,qw(eA)),$R(2,$w(BR)),$R(3,qw(eA)),$R(3,$w(LR)),$R(4,qw(eA)),$R(4,$w(zR)),$R(5,qw(eA)),$R(5,$w(NR)),XR("design:paramtypes",[Object,Object,Object,Object,Object,Object])],QR);class tB extends tE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const eB=["heightLimit","lineClamp"];class iB extends iP{_isValid(){const{text:t}=this.attribute;return m(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=FM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;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),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=Gk.graphicUtil.textMeasure,f=new tP(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=UR.allocate(),s=UR.allocate();JR(s,t,e),ZR(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),UR.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,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()}};function xB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),SB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=PA.ROW:"y"===n?c=PA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let AB=class extends bB{constructor(){super(...arguments),this.numberType=VT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const y=null!==(f=this.z)&&void 0!==f?f:0;xB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:y}),u.cache&&!m(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:_=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,_-c,v-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,_-c,v-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=vE(d,u),y=xE(d,p),_=yE(h),v=_E(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(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),s=uk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=uk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],Rt(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function kB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),MB(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),MB(t,l,1,n),o=!1):o=!0}t.closePath()}function MB(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]=VA(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)}}AB=wB([Xw()],AB);var CB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EB=function(t,e){return function(i,n){e(i,n,t)}};function PB(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}let RB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=FT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=FM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=vE(y,m),A=yE(f),k=_E(b,x),M=xE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=PB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=PB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=PB(i,n),a=PB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],Rt(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=FM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?PA.ROW:PA.COLUMN,Number.isFinite(c)||(o=PA.COLUMN),Number.isFinite(d)||(o=PA.ROW);const u=i*(o===PA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===BA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,y-h,_-c,o),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===BA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;m(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),xB(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,y-h,_-c,o),t.stroke()}return!1}};RB=CB([Xw(),EB(0,qw(eA)),EB(0,$w(RE)),TB("design:paramtypes",[Object])],RB);var BB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DB=function(t,e){return function(i,n){e(i,n,t)}};let LB=class extends bB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=FM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=vE(f,p),w=xE(f,g),A=yE(d),k=_E(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)FA(t.pathShape.commandList,e,i,n,1,1,x);else{FA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};LB=BB([Xw(),DB(0,qw(eA)),DB(0,$w(LE)),IB("design:paramtypes",[Object])],LB);const OB=wt/2;function FB(t,e,i,n,s,r){let a;if(v(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!G(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-OB,0,!1)}if(t.lineTo(_[0],_[1]),!G(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,OB,!1)}if(t.lineTo(b[0],b[1]),!G(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],OB,wt,!1)}if(t.lineTo(g[0],g[1]),!G(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],wt,wt+OB,!1)}return t.closePath(),t}var zB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jB=function(t,e){return function(i,n){e(i,n,t)}};let NB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:y=l.fillOpacity,lineWidth:_=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=bE(f,y,u,p),A=SE(f,v,u,p),k=yE(h),M=_E(d,_);if(!t.valid||!b)return;if(!(k||M||c))return;if(!(w||A||a||o||c))return;0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),FB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};NB=zB([Xw(),jB(0,qw(eA)),jB(0,$w(FE)),HB("design:paramtypes",[Object])],NB);var VB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class extends bB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=vE(f,p),A=xE(f,g),k=yE(d),M=_E(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};UB=VB([Xw(),GB(0,qw(eA)),GB(0,$w(zE)),WB("design:paramtypes",[Object])],UB);var YB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$B=function(t,e){return function(i,n){e(i,n,t)}};let KB=class extends bB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=qT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=vE(f,p),C=xE(f,g),T=yE(d),E=_E(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const P=!b,R=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===BA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,R,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,R);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,R,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,R);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,R))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,R),this.drawUnderLine(_,v,t,i,n+r,R,h,e)))}P&&this.restoreTransformUseContext2d(t,h,R,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=JE(l,g),m=QE(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=JE(h,a),f=QE("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};KB=YB([Xw(),$B(0,qw(eA)),$B(0,$w(HE)),XB("design:paramtypes",[Object])],KB);var qB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZB=class{};function JB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nI=function(t,e){return function(i,n){e(i,n,t)}};let sI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:y=l.lineWidth,opacity:_=l.opacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(_,p),w=xE(_,f),A=yE(c),k=_E(d,y);t.valid&&v&&(A||k||g)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||m(u)&&u.every((t=>0===t))?JB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)JB(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=tI(l,y,_,c,d),S=tI(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=QB(w,A),M=tI(l,QB(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};sI=eI([Xw(),nI(0,qw(eA)),nI(0,$w(OE)),iI("design:paramtypes",[Object])],sI);var rI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oI=function(t,e){return function(i,n){e(i,n,t)}};const lI=["","repeat-x","repeat-y","repeat"];let hI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=NT}drawShape(t,e,i,n,s,r,a){const o=FM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=vE(d,u),_=yE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,lI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=FM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};hI=rI([Xw(),oI(0,qw(eA)),oI(0,$w(DE)),aI("design:paramtypes",[Object])],hI);const cI=Symbol.for("IncrementalDrawContribution"),dI=Symbol.for("ArcRender"),uI=Symbol.for("Arc3dRender"),pI=Symbol.for("AreaRender"),gI=Symbol.for("CircleRender"),fI=Symbol.for("GraphicRender"),mI=Symbol.for("GroupRender"),yI=Symbol.for("LineRender"),_I=Symbol.for("PathRender"),vI=Symbol.for("PolygonRender"),bI=Symbol.for("RectRender"),xI=Symbol.for("Rect3DRender"),SI=Symbol.for("SymbolRender"),wI=Symbol.for("TextRender"),AI=Symbol.for("RichTextRender"),kI=Symbol.for("Pyramid3dRender"),MI=Symbol.for("GlyphRender"),CI=Symbol.for("ImageRender"),TI=Symbol.for("RenderSelector"),EI=Symbol.for("DrawContribution");function PI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function RI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(m(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const BI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(t)},t));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};return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(e)},e))}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(){this.pools=[]}};var II=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LI=function(t,e){return function(i,n){e(i,n,t)}};let OI=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};OI=II([Xw()],OI);let FI=class{constructor(t){this.subRenderContribitions=t,this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};FI=II([Xw(),LI(0,qw(eA)),LI(0,$w(jE)),DI("design:paramtypes",[Object])],FI);let zI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=BI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return BI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Mt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};zI=II([Xw()],zI);var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),ME(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),ME(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};jI=HI([Xw()],jI);let NI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};NI=HI([Xw()],NI);let VI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};VI=HI([Xw()],VI);var WI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let GI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};GI=WI([Xw()],GI);let UI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};UI=WI([Xw()],UI);let YI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};YI=WI([Xw()],YI);var XI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $I=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};$I=XI([Xw()],$I);var KI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};qI=KI([Xw()],qI);var ZI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),FB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),FB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};JI=ZI([Xw()],JI);let QI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};QI=ZI([Xw()],QI);let tD=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};tD=ZI([Xw()],tD);let eD=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};eD=ZI([Xw()],eD);let iD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};iD=ZI([Xw()],iD);var nD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};sD=nD([Xw()],sD);class rD extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}}class aD extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}}var oD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hD=function(t,e){return function(i,n){e(i,n,t)}};const cD=Symbol.for("RenderService");let dD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}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)}};dD=oD([Xw(),hD(0,qw(EI)),lD("design:paramtypes",[Object])],dD);var uD=new Vw((t=>{t(dD).toSelf(),t(cD).toService(dD)})),pD=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 gD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return pD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function mD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var yD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const _D=Symbol.for("PickItemInterceptor");let vD=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===OT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};vD=yD([Xw()],vD);var bD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SD=function(t,e){return function(i,n){e(i,n,t)}};const wD=Symbol.for("PickerService");let AD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new qt(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=UR.allocate();if(qR(i,e),a){if(i){const t=UR.allocate();r.modelMatrix=ZR(t,a,i),UR.free(i)}}else qR(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Ht(e.x,e.y),a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Ht(e.x,e.y);l.transformPoint(r,r);const a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&UR.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),GR.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};AD=bD([Xw(),SD(0,qw(oA)),SD(1,qw(eA)),SD(1,$w(_D)),xD("design:paramtypes",[Object,Object])],AD);var kD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CD=function(t,e){return function(i,n){e(i,n,t)}};const TD=Symbol.for("GlobalPickerService");let ED=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new qt(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 Ht(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function PD(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function RD(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}ED=kD([Xw(),CD(0,qw(oA)),MD("design:paramtypes",[Object])],ED);class BD{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=UR.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=UR.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const LD=[0,0,0],OD=new qt(1,0,0,1,0,0);let FD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},yk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},vk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new qt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.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&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Mt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),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&&EE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gk.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Gk.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:bk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:bk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[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={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=RI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}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={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=ZE(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=ZE(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(OD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};FD.env="browser",FD=ID([Xw(),DD("design:paramtypes",[Object,Number])],FD);var zD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const jD={WIDTH:500,HEIGHT:500,DPR:1};let ND=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=jD.WIDTH,height:n=jD.HEIGHT,dpr:s=jD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=Gk.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new FD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}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.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};ND.env="browser",ND=zD([Xw(),HD("design:paramtypes",[Object])],ND);const VD=Symbol.for("CanvasArcPicker"),WD=Symbol.for("CanvasArc3dPicker"),GD=Symbol.for("CanvasAreaPicker"),UD=Symbol.for("CanvasCirclePicker"),YD=Symbol.for("CanvasImagePicker"),XD=Symbol.for("CanvasLinePicker"),$D=Symbol.for("CanvasPathPicker"),KD=Symbol.for("CanvasRectPicker"),qD=Symbol.for("CanvasRect3dPicker"),ZD=Symbol.for("CanvasSymbolPicker"),JD=Symbol.for("CanvasTextPicker"),QD=Symbol.for("CanvasPolygonPicker"),tL=Symbol.for("CanvasPyramid3dPicker"),eL=Symbol.for("CanvasRichTextPicker"),iL=Symbol.for("CanvasGlyphPicker"),nL=Symbol.for("CanvasPickerContribution"),sL=Symbol.for("MathArcPicker"),rL=Symbol.for("MathAreaPicker"),aL=Symbol.for("MathCirclePicker"),oL=Symbol.for("MathLinePicker"),lL=Symbol.for("MathPathPicker"),hL=Symbol.for("MathRectPicker"),cL=Symbol.for("MathSymbolPicker"),dL=Symbol.for("MathTextPicker"),uL=Symbol.for("MathPolygonPicker"),pL=Symbol.for("MathGlyphPicker"),gL=Symbol.for("MathPickerContribution");var fL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yL=function(t,e){return function(i,n){e(i,n,t)}};let _L=class extends AD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new ND(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xL=new qt(1,0,0,1,0,0),SL={x:0,y:0};let wL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0),this.path=new pk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},SL),function(t,e,i){return SM(t,0,!1,e,i)}(this.path.commandList,SL.x,SL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},SL);const i=PI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return SM(t,e,!0,i,n)}(this.path.commandList,i,SL.x,SL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(xL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};wL=vL([Xw(),bL("design:paramtypes",[Object,Number])],wL);var AL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ML=function(t,e){return function(i,n){e(i,n,t)}};let CL=class extends AD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new wL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};AL([tA(),kL("design:type",Function),kL("design:paramtypes",[]),kL("design:returntype",void 0)],CL.prototype,"init",null),CL=AL([Xw(),ML(0,qw(eA)),ML(0,$w(gL)),ML(1,qw(oA)),ML(2,qw(eA)),ML(2,$w(_D)),kL("design:paramtypes",[Object,Object,Object])],CL);var TL=new Vw((t=>{t(_L).toSelf().inSingletonScope(),t(CL).toSelf().inSingletonScope(),t(wD).toService(_L),t(ED).toSelf().inSingletonScope(),t(TD).toService(ED),t(vD).toSelf().inSingletonScope(),t(_D).toService(vD),nA(t,_D)})),EL=new Vw((t=>{t(QR).toSelf().inSingletonScope(),t(ZT).toService(QR),t(PR).toSelf().inSingletonScope(),t(ER).toService(PR),nA(t,ER),t(IR).toSelf().inSingletonScope(),t(BR).toService(IR),nA(t,BR),t(OR).toSelf().inSingletonScope(),t(LR).toService(OR),nA(t,LR),t(HR).toSelf().inSingletonScope(),t(zR).toService(HR),nA(t,zR),t(VR).toSelf().inSingletonScope(),t(NR).toService(VR),nA(t,NR),t(JT).toConstantValue(mB)}));const PL=Symbol.for("AutoEnablePlugins"),RL=Symbol.for("PluginService");var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DL=function(t,e){return function(i,n){e(i,n,t)}};let LL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Wk.isBound(PL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};LL=BL([Xw(),DL(0,qw(eA)),DL(0,$w(PL)),IL("design:paramtypes",[Object])],LL);var OL=new Vw((t=>{t(LL).toSelf(),t(RL).toService(LL),nA(t,PL)})),FL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};zL=FL([Xw()],zL);var HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function NL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let VL=class extends zL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(b(o)?o:1),y:(s-r.top)/(b(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return NL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return NL(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:zM.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(){}};function WL(){Wk.rebind(wD).toService(CL)}VL=HL([Xw(),jL("design:paramtypes",[])],VL);var GL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YL=class extends zL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};YL=GL([Xw(),UL("design:paramtypes",[])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KL=class extends zL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Wk.rebind(wD).toService(CL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=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){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}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(){}};KL=XL([Xw(),$L("design:paramtypes",[])],KL);var qL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JL=!1;try{JL=!!lynx.createCanvasNG}catch(t){}let QL=class extends zL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=JL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,JL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(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(){}};QL=qL([Xw(),ZL("design:paramtypes",[])],QL);var tO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eO=class extends zL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};eO=tO([Xw()],eO);var iO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let rO=class extends zL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return sO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{WL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};rO=iO([Xw(),nO("design:paramtypes",[])],rO);var aO=new Vw((t=>{t(VL).toSelf().inSingletonScope(),t(aA).toService(VL),t(YL).toSelf().inSingletonScope(),t(aA).toService(YL),t(KL).toSelf().inSingletonScope(),t(aA).toService(KL),t(QL).toSelf().inSingletonScope(),t(aA).toService(QL),t(rO).toSelf().inSingletonScope(),t(aA).toService(rO),t(eO).toSelf().inSingletonScope(),t(aA).toService(eO),nA(t,aA)})),oO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hO=class{constructor(){this._uid=zM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};hO=oO([Xw(),lO("design:paramtypes",[])],hO);var cO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uO=function(t,e){return function(i,n){e(i,n,t)}};let pO=class extends hO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}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 this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ND(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new ND({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};pO.env="browser",pO=cO([Xw(),uO(0,qw(oA)),dO("design:paramtypes",[Object])],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}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;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};fO.env="feishu",fO=gO([Xw()],fO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _O={WIDTH:500,HEIGHT:500,DPR:1};let vO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=_O.WIDTH,height:n=_O.HEIGHT,dpr:s=_O.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new fO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};vO.env="feishu",vO=mO([Xw(),yO("design:paramtypes",[Object])],vO);var bO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SO=function(t,e){return function(i,n){e(i,n,t)}};let wO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 vO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};wO.env="feishu",wO=bO([Xw(),SO(0,qw(oA)),xO("design:paramtypes",[Object])],wO);var AO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kO=class extends FD{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(RI(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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(PI(this,l,this.dpr)),r.setStrokeStyle(RI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=ZE(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=ZE(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}};kO.env="taro",kO=AO([Xw()],kO);var MO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const TO={WIDTH:500,HEIGHT:500,DPR:1};let EO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=TO.WIDTH,height:n=TO.HEIGHT,dpr:s=TO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new kO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};EO.env="taro",EO=MO([Xw(),CO("design:paramtypes",[Object])],EO);var PO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BO=function(t,e){return function(i,n){e(i,n,t)}};let IO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 EO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};IO.env="taro",IO=PO([Xw(),BO(0,qw(oA)),RO("design:paramtypes",[Object])],IO);var DO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let LO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};LO.env="lynx",LO=DO([Xw()],LO);var OO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zO={WIDTH:500,HEIGHT:500,DPR:1};let HO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=zO.WIDTH,height:n=zO.HEIGHT,dpr:s=zO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new LO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};HO.env="lynx",HO=OO([Xw(),FO("design:paramtypes",[Object])],HO);var jO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VO=function(t,e){return function(i,n){e(i,n,t)}};let WO=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",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:zM.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)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 HO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};WO.env="lynx",WO=jO([Xw(),VO(0,qw(oA)),NO("design:paramtypes",[Object])],WO);var GO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YO=class extends FD{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 qt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};YO.env="node",YO=GO([Xw(),UO("design:paramtypes",[Object,Number])],YO);var XO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$O=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const KO={WIDTH:500,HEIGHT:500,DPR:1};let qO=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=KO.WIDTH,height:n=KO.HEIGHT,canvasControled:s=!0,dpr:r=KO.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new YO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&l(this._nativeCanvas.release)&&this._nativeCanvas.release()}};qO.env="node",qO=XO([Xw(),$O("design:paramtypes",[Object])],qO);var ZO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QO=function(t,e){return function(i,n){e(i,n,t)}};let tF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new qO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new qO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};tF.env="node",tF=ZO([Xw(),QO(0,qw(oA)),JO("design:paramtypes",[Object])],tF);var eF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iF=class extends FD{draw(){}createPattern(t,e){return null}};iF.env="wx",iF=eF([Xw()],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rF={WIDTH:500,HEIGHT:500,DPR:1};let aF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=rF.WIDTH,height:n=rF.HEIGHT,dpr:s=rF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new iF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};aF.env="wx",aF=nF([Xw(),sF("design:paramtypes",[Object])],aF);var oF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hF=function(t,e){return function(i,n){e(i,n,t)}};class cF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let dF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new cF}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:zM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new aF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new aF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};dF.env="wx",dF=oF([Xw(),hF(0,qw(oA)),lF("design:paramtypes",[Object])],dF);var uF=new Vw((t=>{t(pO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(pO))).whenTargetNamed(pO.env),t(wO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(wO))).whenTargetNamed(wO.env),t(IO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(IO))).whenTargetNamed(IO.env),t(WO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(WO))).whenTargetNamed(WO.env),t(dF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(dF))).whenTargetNamed(dF.env),t(tF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(tF))).whenTargetNamed(tF.env)})),pF=new Vw((t=>{t(Vk).toSelf().inSingletonScope(),t(Nk).toService(Vk),nA(t,Nk)})),gF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mF=function(t,e){return function(i,n){e(i,n,t)}};let yF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Xk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,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()}};yF=gF([Xw(),mF(0,qw(oA)),fF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bF=function(t,e){return function(i,n){e(i,n,t)}};let xF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=Xk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};xF=_F([Xw(),bF(0,qw(oA)),vF("design:paramtypes",[Object])],xF);var SF=new Vw((t=>{t(yF).toSelf(),t(xF).toSelf(),t(eE).toService(yF)}));var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const AF=Symbol.for("DrawItemInterceptor"),kF=new Wt;let MF=class{constructor(){this.order=1}afterDrawItem(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){kF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(kF),!0}};MF=wF([Xw()],MF);let CF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=UR.allocate();qR(l,o);const h=r.modelMatrix;if(h){if(l){const t=UR.allocate();r.modelMatrix=ZR(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===OT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&UR.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};CF=wF([Xw()],CF);var TF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},EF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PF=function(t,e){return function(i,n){e(i,n,t)}};let RF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=be(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=mD(e,i,Sk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Se(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):gD(t,Sk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_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||Wk.get(cI);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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IF=class{selector(t){return null}};IF=BF([Xw()],IF);var DF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let FF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:y=l.fillOpacity,strokeOpacity:_=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=bE(u,y,p,g),A=SE(u,_,p,g),k=yE(h),M=_E(d,x);if(!t.valid||!S)return;if(!f){if(!(k||M||c))return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===v||m(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),FB(e,i,n,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=FM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=UR.allocate(),i=UR.allocate();JR(i,t,a),ZR(e,o||e,i),s.modelMatrix=e,UR.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&UR.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};FF=DF([Xw(),OF(0,qw(eA)),OF(0,$w(IE)),LF("design:paramtypes",[Object])],FF);var zF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HF=class extends AB{constructor(){super(...arguments),this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=FM(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,y=vE(u,p),_=xE(u,g),v=yE(c),b=_E(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};HF=zF([Xw()],HF);var jF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NF=class extends RB{constructor(){super(...arguments),this.numberType=FT}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=FM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=vE(u,d),f=yE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};NF=jF([Xw()],NF);var VF,WF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UF=function(t,e){return function(i,n){e(i,n,t)}},YF=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"}(VF||(VF={}));let XF=class extends RF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=VF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new rA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return YF(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,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.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 YF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return YF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>YF(this,void 0,void 0,(function*(){if(2!==t.count)yield fD(t,Sk.zIndex,((i,n)=>{if(this.status===VF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return YF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return YF(this,void 0,void 0,(function*(){this.rendering&&(this.status=VF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=VF.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 YF(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:()=>YF(this,void 0,void 0,(function*(){yield fD(t,Sk.zIndex,(t=>YF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};WF([qw(oA),GF("design:type",Object)],XF.prototype,"global",void 0),XF=WF([Xw(),UF(0,Zw(fI)),UF(1,qw(TI)),UF(2,qw(HF)),UF(3,qw(NF)),UF(4,qw(fE)),UF(5,qw(eA)),UF(5,$w(AF)),GF("design:paramtypes",[Array,Object,Object,Object,Object,Object])],XF);var $F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KF=class extends bB{constructor(){super(...arguments),this.type="rect3d",this.numberType=XT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=bE(g,f,u,p),x=SE(g,y,u,p),S=yE(c),w=_E(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}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){const l=nT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};KF=$F([Xw()],KF);var qF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZF=class{constructor(){this.numberType=$T}drawShape(t,e,i,n,s){const r=FM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&vE(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=FM(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:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),FB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).richtext;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);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};ZF=qF([Xw()],ZF);var JF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let QF=class{constructor(){this.numberType=HT}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=FM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};QF=JF([Xw()],QF);var tz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ez=class extends bB{constructor(){super(...arguments),this.numberType=OT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=vE(p,g),v=xE(p,m),b=yE(c),x=_E(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=nT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(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 d=!1;if(r=Mt-St)e.moveTo(i+r*Et(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>St&&(e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*Et(p),_=r*Bt(p),v=a*Et(f),b=a*Bt(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>St)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Mt,!0,E.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),d=h>l;let u=!1;if(a<=St)e.moveTo(i,n,s);else if(c>=Mt-St)e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Et(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Et(c),f=a*Bt(c),m=a*Et(p),y=a*Bt(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};ez=tz([Xw()],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let nz=class extends bB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=UT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=vE(u,p),x=xE(u,f),S=yE(c),w=_E(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=nT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={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+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};nz=iz([Xw()],nz);var sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};rz=sz([Xw()],rz);let az=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};az=sz([Xw()],az);var oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};lz=oz([Xw()],lz);let hz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};hz=oz([Xw()],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};dz=cz([Xw()],dz);let uz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:CC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:CC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:CC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:CC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};uz=cz([Xw()],uz);var pz=new Vw((t=>{t(RF).toSelf(),t(EI).toService(RF),t(XF).toSelf(),t(cI).toService(XF),t(IF).toSelf(),t(TI).toService(IF),t($E).toSelf().inSingletonScope(),t(gI).to($E),t(fI).to($E),t(GI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(YI).toSelf().inSingletonScope(),t(BE).toService(GI),t(BE).toService(UI),t(BE).toService(YI),nA(t,BE),t(NB).toSelf().inSingletonScope(),t(bI).to(NB),t(fI).to(NB),t(KF).toSelf().inSingletonScope(),t(xI).toService(KF),t(fI).toService(xI),t(JI).toSelf().inSingletonScope(),t(QI).toSelf().inSingletonScope(),t(tD).toSelf().inSingletonScope(),t(eD).toSelf().inSingletonScope(),t(iD).toSelf().inSingletonScope(),t(FE).toService(JI),t(FE).toService(QI),t(FE).toService(tD),t(FE).toService(eD),t(FE).toService(iD),nA(t,FE),t(KB).toSelf().inSingletonScope(),t(wI).to(KB),t(fI).to(KB),nA(t,HE),t(LB).toSelf().inSingletonScope(),t(_I).to(LB),t(fI).to(LB),t(lz).toSelf().inSingletonScope(),t(hz).toSelf().inSingletonScope(),t(LE).toService(lz),t(LE).toService(hz),nA(t,LE),t(UB).toSelf().inSingletonScope(),t(SI).to(UB),t(fI).to(UB),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(aD).toSelf().inSingletonScope(),t(zE).toService(sD),t(zE).toService(rD),t(zE).toService(aD),nA(t,zE),t(GE).toSelf().inSingletonScope(),t(dI).to(GE),t(fI).to(GE),t(ez).toSelf().inSingletonScope(),t(uI).toService(ez),t(fI).toService(uI),t(jI).toSelf().inSingletonScope(),t(NI).toSelf().inSingletonScope(),t(VI).toSelf().inSingletonScope(),t(PE).toService(jI),t(PE).toService(NI),t(PE).toService(VI),nA(t,PE),t(AB).toSelf().inSingletonScope(),t(yI).to(AB),t(fI).to(AB),t(HF).toSelf().inSingletonScope(),t(NF).toSelf().inSingletonScope(),t(RB).toSelf().inSingletonScope(),t(pI).to(RB),t(fI).to(RB),t(dz).toSelf().inSingletonScope(),t(uz).toSelf().inSingletonScope(),t(RE).toService(dz),t(RE).toService(uz),nA(t,RE),t(FF).toSelf().inSingletonScope(),t(mI).to(FF),t(fI).to(FF),t($I).toSelf().inSingletonScope(),t(IE).toService($I),nA(t,IE),t(sI).toSelf().inSingletonScope(),t(vI).to(sI),t(fI).to(sI),t(rz).toSelf().inSingletonScope(),t(az).toSelf().inSingletonScope(),t(OE).toService(rz),t(OE).toService(az),nA(t,OE),t(QF).toSelf().inSingletonScope(),t(MI).toService(QF),t(fI).toService(MI),t(hI).toSelf().inSingletonScope(),t(CI).toService(hI),t(fI).toService(CI),t(qI).toSelf().inSingletonScope(),t(DE).toService(qI),nA(t,DE),t(ZF).toSelf().inSingletonScope(),t(AI).toService(ZF),t(fI).toService(AI),t(nz).toSelf().inSingletonScope(),t(kI).toService(nz),t(fI).toService(kI),t(FI).toSelf().inSingletonScope(),t(HE).toService(FI),t(PE).toService(FI),t(LE).toService(FI),t(zE).toService(FI),t(FE).toService(FI),t(DE).toService(FI),t(BE).toService(FI),t(RE).toService(FI),t(OE).toService(FI),nA(t,jE),nA(t,fI),t(MF).toSelf().inSingletonScope(),t(AF).toService(MF),t(CF).toSelf().inSingletonScope(),t(AF).toService(CF),nA(t,AF)}));var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mz=function(t,e){return function(i,n){e(i,n,t)}};let yz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};yz=gz([Xw(),mz(0,qw(gI)),fz("design:paramtypes",[Object])],yz);var _z=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bz=function(t,e){return function(i,n){e(i,n,t)}};const xz=new Wt;let Sz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=PI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;xz.setValue(i.x1,i.y1,i.x2,i.y2),xz.expand(-r/2),h=!xz.containsPoint(e)}}return n.highPerformanceRestore(),h}};Sz=_z([Xw(),bz(0,qw(bI)),vz("design:paramtypes",[Object])],Sz);var wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Az=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kz=function(t,e){return function(i,n){e(i,n,t)}};let Mz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Mz=wz([Xw(),kz(0,qw(dI)),Az("design:paramtypes",[Object])],Mz);var Cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ez=function(t,e){return function(i,n){e(i,n,t)}};let Pz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Pz=Cz([Xw(),Ez(0,qw(pI)),Tz("design:paramtypes",[Object])],Pz);var Rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Bz=class{constructor(){this.type="image",this.numberType=NT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Bz=Rz([Xw()],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dz=class extends bB{};Dz=Iz([Xw()],Dz);var Lz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fz=function(t,e){return function(i,n){e(i,n,t)}};let zz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};zz=Lz([Xw(),Fz(0,qw(yI)),Oz("design:paramtypes",[Object])],zz);var Hz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nz=function(t,e){return function(i,n){e(i,n,t)}};let Vz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Vz=Hz([Xw(),Nz(0,qw(_I)),jz("design:paramtypes",[Object])],Vz);var Wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Yz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=KT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=FM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Yz=Wz([Xw(),Uz(0,qw(SI)),Gz("design:paramtypes",[Object])],Yz);var Xz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kz=function(t,e){return function(i,n){e(i,n,t)}};let qz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=qT}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=FM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=QE(a,u,s),y=JE(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&UR.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};qz=Xz([Xw(),Kz(0,qw(wI)),$z("design:paramtypes",[Object])],qz);var Zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qz=function(t,e){return function(i,n){e(i,n,t)}};let tH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};tH=Zz([Xw(),Qz(0,qw(vI)),Jz("design:paramtypes",[Object])],tH);var eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let sH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=$T}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};sH=eH([Xw(),nH(0,qw(AI)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};lH=rH([Xw(),oH(0,qw(MI)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let uH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=XT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};uH=hH([Xw(),dH(0,qw(xI)),cH("design:paramtypes",[Object])],uH);var pH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let mH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mH=pH([Xw(),fH(0,qw(kI)),gH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let bH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=OT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};bH=yH([Xw(),vH(0,qw(uI)),_H("design:paramtypes",[Object])],bH);var xH=new Vw(((t,e,i,n)=>{t(yz).toSelf().inSingletonScope(),t(UD).toService(yz),t(nL).toService(UD),t(Sz).toSelf().inSingletonScope(),t(KD).toService(Sz),t(nL).toService(KD),t(uH).toSelf().inSingletonScope(),t(qD).toService(uH),t(nL).toService(qD),t(Mz).toSelf().inSingletonScope(),t(VD).toService(Mz),t(nL).toService(VD),t(Pz).toSelf().inSingletonScope(),t(GD).toService(Pz),t(nL).toService(GD),t(Bz).toSelf().inSingletonScope(),t(YD).toService(Bz),t(nL).toService(YD),t(zz).toSelf().inSingletonScope(),t(XD).toService(zz),t(nL).toService(XD),t(Vz).toSelf().inSingletonScope(),t($D).toService(Vz),t(nL).toService($D),t(Yz).toSelf().inSingletonScope(),t(ZD).toService(Yz),t(nL).toService(ZD),t(qz).toSelf().inSingletonScope(),t(JD).toService(qz),t(nL).toService(JD),t(tH).toSelf().inSingletonScope(),t(QD).toService(tH),t(nL).toService(QD),t(mH).toSelf().inSingletonScope(),t(tL).toService(mH),t(nL).toService(tL),t(bH).toSelf().inSingletonScope(),t(WD).toService(bH),t(nL).toService(WD),t(sH).toSelf().inSingletonScope(),t(eL).toService(sH),t(nL).toService(eL),t(lH).toSelf().inSingletonScope(),t(iL).toService(lH),t(nL).toService(iL),nA(t,nL)})),SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([Xw(),AH(0,qw(_I)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([Xw(),TH(0,qw(gI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BH=function(t,e){return function(i,n){e(i,n,t)}};const IH=new Wt;let DH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;IH.setValue(i.x1,i.y1,i.x2,i.y2),IH.expand(-r/2),h=!IH.containsPoint(e)}}return n.highPerformanceRestore(),h}};DH=PH([Xw(),BH(0,qw(bI)),RH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FH=function(t,e){return function(i,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};zH=LH([Xw(),FH(0,qw(dI)),OH("design:paramtypes",[Object])],zH);var HH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NH=function(t,e){return function(i,n){e(i,n,t)}};let VH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};VH=HH([Xw(),NH(0,qw(pI)),jH("design:paramtypes",[Object])],VH);var WH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let YH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};YH=WH([Xw(),UH(0,qw(yI)),GH("design:paramtypes",[Object])],YH);var XH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KH=function(t,e){return function(i,n){e(i,n,t)}};let qH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=KT}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=FM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qH=XH([Xw(),KH(0,qw(SI)),$H("design:paramtypes",[Object])],qH);var ZH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JH=class{constructor(){this.type="text",this.numberType=qT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};JH=ZH([Xw()],JH);var QH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ej=function(t,e){return function(i,n){e(i,n,t)}};let ij=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ij=QH([Xw(),ej(0,qw(vI)),tj("design:paramtypes",[Object])],ij);var nj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rj=function(t,e){return function(i,n){e(i,n,t)}};let aj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};aj=nj([Xw(),rj(0,qw(MI)),sj("design:paramtypes",[Object])],aj);var oj=new Vw((t=>{t(EH).toSelf().inSingletonScope(),t(aL).toService(EH),t(gL).toService(aL),t(DH).toSelf().inSingletonScope(),t(hL).toService(DH),t(gL).toService(hL),t(zH).toSelf().inSingletonScope(),t(sL).toService(zH),t(gL).toService(sL),t(VH).toSelf().inSingletonScope(),t(rL).toService(VH),t(gL).toService(rL),t(YH).toSelf().inSingletonScope(),t(oL).toService(YH),t(gL).toService(oL),t(kH).toSelf().inSingletonScope(),t(lL).toService(kH),t(gL).toService(lL),t(qH).toSelf().inSingletonScope(),t(cL).toService(qH),t(gL).toService(cL),t(JH).toSelf().inSingletonScope(),t(dL).toService(JH),t(gL).toService(dL),t(ij).toSelf().inSingletonScope(),t(uL).toService(ij),t(gL).toService(uL),t(aj).toSelf().inSingletonScope(),t(pL).toService(aj),t(aj).toService(pL),nA(t,gL)}));var lj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new ND(t))).whenTargetNamed(ND.env),t(Yk).toDynamicValue((()=>(t,e)=>new FD(t,e))).whenTargetNamed(FD.env)})),hj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new EO(t))).whenTargetNamed(EO.env),t(Yk).toDynamicValue((()=>(t,e)=>new kO(t,e))).whenTargetNamed(kO.env)})),cj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new vO(t))).whenTargetNamed(vO.env),t(Yk).toDynamicValue((()=>(t,e)=>new fO(t,e))).whenTargetNamed(fO.env)})),dj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new HO(t))).whenTargetNamed(HO.env),t(Yk).toDynamicValue((()=>(t,e)=>new LO(t,e))).whenTargetNamed(LO.env)})),uj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new aF(t))).whenTargetNamed(aF.env),t(Yk).toDynamicValue((()=>(t,e)=>new iF(t,e))).whenTargetNamed(iF.env)})),pj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new qO(t))).whenTargetNamed(qO.env),t(Yk).toDynamicValue((()=>(t,e)=>new YO(t,e))).whenTargetNamed(YO.env)}));Wk.load(mE),Wk.load(EL),Wk.load(uD),Wk.load(TL),Wk.load(OL),function(t){t.load(aO),t.load(uF),t.load(pF),t.load(SF)}(Wk),function(t){t.load(pz)}(Wk),function(t){t.load(xH),t.load(oj)}(Wk),function(t){t.load(lj),t.load(cj),t.load(hj),t.load(dj),t.load(uj),t.load(pj)}(Wk);const gj=Wk.get(oA);Gk.global=gj;const fj=Wk.get(gE);Gk.graphicUtil=fj;const mj=Wk.get(pE);Gk.transformUtil=mj;const yj=Wk.get(ZT);Gk.graphicService=yj,Wk.get(TD);const _j=Wk.get(fE);Gk.layerService=_j;class vj{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Gk.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Gk.graphicService.hooks.onAttributeUpdate.taps=Gk.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onSetStage.taps=Gk.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class bj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class xj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.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))})),Gk.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){Gk.graphicService.hooks.onAddIncremental.taps=Gk.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onClearIncremental.taps=Gk.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gk.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({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Sj=new Wt;class wj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Gk.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&&(Sj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Sj,t.parent&&t.parent.globalTransMatrix)))})),Gk.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))})),Gk.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Gk.graphicService.hooks.beforeUpdateAABBBounds.taps=Gk.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.afterUpdateAABBBounds.taps=Gk.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onRemove.taps=Gk.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Aj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===rC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=rC.INITIAL,Gk.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Gk.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:sC},{mode:"timeout",cons:nC},{mode:"manual",cons:iC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==rC.INITIAL&&(this.status=rC.PAUSE,!0)}resume(){return this.status!==rC.INITIAL&&(this.status=rC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===rC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===rC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=rC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=rC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Aj.addTimeline(oC),Aj.setFPS(60);class kj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=nT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=It(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=Rt(Pt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=f(e)?nT.get(e).value:e;const r=this.colorRgb;return nT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const Mj="white";class Cj extends tE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:Mj}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new LM,this.hooks={beforeRender:new rA(["stage"]),afterRender:new rA(["stage"])},this.global=Wk.get(oA),this.window=Wk.get(cE),this.renderService=Wk.get(cD),this.pickerService=Wk.get(wD),this.pluginService=Wk.get(RL),this.layerService=Wk.get(fE),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Wt,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Mj,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new ZM({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Aj,this.supportInteractiveLayer=!1!==t.interactiveLayer}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new kj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new BD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new bj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new vj))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new xj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new wj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive")}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Ht(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Wk.get(cE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Tj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Tj||(Tj={}));const Ej="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Pj=Ej,Rj=14,Bj=18,Ij=4,Dj={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Rj}}},Lj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Oj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Rj,offset:12,position:"outside"}}},Fj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},zj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},Hj="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",jj={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:Hj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Hj,fill:"#ddd"}}},Nj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Vj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Wj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},Gj={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj}}},Uj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Yj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Xj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Rj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Rj}}},$j={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Rj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Rj,textBaseline:"middle",textAlign:"center"}}},Kj="__VCHART",qj=500,Zj=500,Jj=`${Kj}_LABEL_LIMIT`,Qj=`${Kj}_LABEL_ALIGN`,tN=`${Kj}_LABEL_TEXT`,eN=`${Kj}_LABEL_VISIBLE`,iN=`${Kj}_LABEL_X`,nN=`${Kj}_LABEL_Y`,sN=`${Kj}_ARC_RATIO`,rN=`${Kj}_ARC_START_ANGLE`,aN=`${Kj}_ARC_END_ANGLE`,oN=`${Kj}_ARC_K`,lN=`${Kj}_ARC_LABEL_HOVER_AX`,hN=`${Kj}_ARC_LABEL_HOVER_AY`,cN=`${Kj}_ARC_LABEL_POINT_AX`,dN=`${Kj}_ARC_LABEL_POINT_AY`,uN=`${Kj}_ARC_LABEL_POINT_BX`,pN=`${Kj}_ARC_LABEL_POINT_BY`,gN=`${Kj}_ARC_LABEL_POINT_CX`,fN=`${Kj}_ARC_LABEL_POINT_CY`,mN=`${Kj}_ARC_LABEL_SELECTED_AX`,yN=`${Kj}_ARC_LABEL_SELECTED_AY`,_N=`${Kj}_ARC_MIDDLE_ANGLE`,vN=`${Kj}_ARC_QUADRANT`,bN=`${Kj}_ARC_RADIAN`,xN=-Math.PI/2,SN=3*Math.PI/2,wN=-90,AN=270,kN=.6,MN={},CN=[],TN=(t,e,i)=>{MN[t]=Object.assign(e,{type:t}),i||CN.push(t)},EN=()=>{CN.slice().forEach((t=>{(t=>{delete MN[t];const e=CN.indexOf(t);e>=0&&CN.splice(e,1)})(t)}))};function PN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:f(t)?t:h(s=t)?null:s.fname})):null}function RN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function BN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const IN=":vGrammar_identifier:";function DN(t,e){return N(t).reduce(((t,i)=>{const n=f(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function LN(t,e){if(h(t))return[];if(!l(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(f(i))return N(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!l(t)&&!!(null==t?void 0:t.callback)}(t))return DN(t.dependency,e);var i;return[]}function ON(t){return l(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function FN(t,e,i,n){if(h(t))return t;if(l(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return f(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function zN(t,e){return HN(t)?t.output():e[t]}const HN=t=>t&&!h(t.grammarType),jN=t=>l(t)?t:e=>e[t],NN=t=>f(t)&&se.parseColorString(t)?t:null;function VN(t){return!!(null==t?void 0:t.scale)}function WN(t){return!!(null==t?void 0:t.field)}function GN(t,e){if(!t)return[];let i=[];return t.scale&&(i=HN(t.scale)?[t.scale]:N(e.getScaleById(t.scale))),i.concat(LN(t,e))}class UN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return f(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=N(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const YN={},XN=t=>YN[t],$N=(t,e,i,n,s)=>(YN[t]=new UN(e,i,n,s),YN[t]);function KN(t){return null===t?0:t}function qN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const ZN=["fillOpacity","x","y","dx","dy"],JN=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=KN(i.x),["x"]):"y"===e?(t.y=KN(i.y),["y"]):"dx"===e?(t.dx=KN(i.dx),["dx"]):"dy"===e?(t.dy=KN(i.dy),["dy"]):[]};var QN,tV,eV,iV,nV,sV,rV,aV,oV,lV,hV,cV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(QN||(QN={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(tV||(tV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(eV||(eV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(iV||(iV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(nV||(nV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(sV||(sV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(rV||(rV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(aV||(aV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(oV||(oV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(lV||(lV={})),function(t){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_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"}(hV||(hV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(cV||(cV={}));const dV={[tV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),b(e.length)||!b(e.z1)&&b(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):b(e.z1)||!b(e.length)&&b(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[tV.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[tV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return b(e)&&b(i)&&b(n)&&b(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[tV.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const uV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=f(t)?dV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(ZN.includes(r)?JN(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{ZN.includes(t)?JN(s,t,e):s[t]=e[t]}));return s},pV=(t,e,i)=>!(!h(t)||!h(e))||!h(t)&&!h(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(f(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function gV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case tV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case tV.group:case tV.rect:case tV.image:return["width","height","y1"].includes(e);case tV.path:case tV.shape:return["path","customPath"].includes(e);case tV.line:return"defined"===e;case tV.area:return["x1","y1","defined"].includes(e);case tV.rule:return["x1","y1"].includes(e);case tV.symbol:return"size"===e;case tV.polygon:return"points"===e;case tV.text:return"text"===e}return!1}function fV(t,e,i,n,s){i&&(ON(i)?e.forEach((e=>{const s=FN(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],c=s&&!gV(t.mark.markType,r)?[e[0]]:e;if(VN(l)){const t=zN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!h(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=f(null==l?void 0:l.field),d=s?ll(l.field):null;let u=s?null:h(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=v(u)||v(i)?u+e+i:u}))}else if(WN(l)){const t=ll(l.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=FN(l,n,e.datum,t)}))})))}function mV(t,e,i,n){if(!t)return null;if(ON(t))return FN(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const c=t[r];if(VN(c)){const t=zN(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!h(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=f(null==c?void 0:c.field),p=u?ll(c.field):null,g=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):h(null==c?void 0:c.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,c.value);s[r]=v(g)||v(d)?g+i+d:g}else if(WN(c)){const t=ll(c.field);s[r]=t(e)}else s[r]=FN(c,n,e,i)})),s}function yV(t){if(t)return t.type===Fl.Band?t.bandwidth():t.type===Fl.Point?t.step():void 0}const _V={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=l(i)?i:pl(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!h(s)){if(h(t))return;t[s]=e}return e})),e;const r=n(e,i);return h(s)||h(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=We.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=ll(a),c=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),d=h(t.default)?null:t.default,u=s.map((t=>ll(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),h(n)&&(n=o);const t=o.map((t=>ll(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],l=o.length;return(h(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=h(r)?d:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=PN(i,t.as||[]),s=i.map((t=>f(t)?ll(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Y(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],x=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),w=b(S*_)?S/_:null,A=b(_*_)?_/x:null;return d&&(y[d]=x),p&&(y[p]=S),r&&(y[r]=w),a&&(y[a]=0===i?1:A),o&&(y[o]=!0===g?w:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:S/v[1]),c&&(y[c]=0===i?1:x/v[1]),u&&(y[u]=_),y}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=RN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=BN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return BN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;h(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=h(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=h(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{h(n[IN])&&(n[IN]=0);let s=n[IN];const r=t.as;return e.forEach((t=>{t&&h(t[r])&&(s+=1,t[r]=s)})),n[IN]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=yV(a.y),l="y"===t.dodgeChannel||h(t.dodgeChannel)&&o>0?"y":"x",c="y"===l?o:yV(a.x);if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!h(t.dodgeBy)){const e=rl(N(t.dodgeBy));o=t=>e(t.getDatum())}const d=[];e.forEach((t=>{const e=o(t);d.includes(e)||d.push(e)}));const u=d.length;if(u<1)return e;const p=ml(a,c);let g=p>=c?c:c-p;const f=ml(i,g);let m=(g-Math.max(u-1,0)*f)/u;m>t.maxWidth?(g-=(m-t.maxWidth)*u,m=t.maxWidth):m{y[t]=-g/2+e*(m+f)}));const _=r.markType;"rect"===_||"interval"===_?e.forEach((t=>{const e=o(t),i=y[e],n=t.getItemAttribute();if("x"===l){const e={x:(h(n.width)&&!h(n.x1)?Math.min(n.x,n.x1):n.x)+(h(n.width)?h(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};h(n.width)?e.x1=e.x+m:e.width=m,t.setItemAttributes(e)}else if("y"===l){const e={y:(h(n.height)&&!h(n.y1)?Math.min(n.y,n.y1):n.y)+(h(n.height)?h(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};h(n.height)?e.y1=e.y+m:e.height=m,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=y[e];if("x"===l){const e=t.getItemAttribute("x")+c/2;t.setItemAttributes({x:e+i+m/2})}else if("y"===l){const e=t.getItemAttribute("y")+c/2;t.setItemAttributes({y:e+i+m/2})}}))}return e},markPhase:"afterEncodeItems"}},vV="__vgrammar_scene_item__",bV=[tV.line,tV.area],xV=[tV.arc3d,tV.rect3d,tV.pyramid3d],SV="key",wV=[{}],AV=["key"],kV="VGRAMMAR_IMMEDIATE_ANIMATION",MV=0,CV=1e3,TV=0,EV=!1,PV=!1,RV="quintInOut",BV={stopWhenStateChange:!1,immediatelyApply:!0},IV={},DV=t=>IV[t],LV=(t,e)=>{IV[t]={creator:e}};class OV extends tE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new pk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Ik.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new pk;let a,o;r.clear();const l=v(s)?s:Pt(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(hV.BEFORE_CREATE_VRENDER_MARK),e===tV.largeRects)return new OV(i);if(e===tV.largeSymbols)return new FV(i);const n=zV[e]?zV[e](i):DV(e)?DV(e).creator(i):null;return t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}function jV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(hV.BEFORE_CREATE_VRENDER_MARK);const n=new JP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=zV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}const NV=t=>{t&&(t[vV]=null,t.release(),t.parent&&t.parent.removeChild(t))};class VV{constructor(t){this.data=null,this.states=[],this.diffState=QN.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if(l(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));fV(this,o,a,this.mark.parameters());const h=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?uV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),h(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===QN.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(hV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=jN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(hV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=N(FN(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===QN.unChange&&(this.diffState=QN.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||this.useStates(this.states),this.mark.markType===tV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new pk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===QN.enter?(r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.update?(n&&r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.exit&&a&&fV(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=o(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=N(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&f(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=N(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=o(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)fl(n,i,t)&&E(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let c=null==l?void 0:l.nextAttrs;if(t&&t.length&&h(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||qN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[tV.line,tV.area,tV.largeRects,tV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===tV.line||e===tV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>qN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=KN(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=KN(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=KN(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=KN(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===tV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>pV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=uV(tV.line,t.attrs,i);return n.points=e.slice(t.startIndex,h(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?Object.assign(c,{segments:e,points:null}):Object.assign(c,{points:t,segments:null})}else p?Object.assign(c,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(c,{points:s,segments:null})}else e===tV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=KN(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=KN(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=KN(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=KN(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===tV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=KN(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=KN(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!M(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!h(e=C(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return C(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!E(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!E(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(NV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(NV(this.graphicItem),this.graphicItem[vV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?h(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):h(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?m(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const WV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(b(e.center.x)&&(s.x=e.center.x),b(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},GV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),UV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const YV=["visible","path","text","lineWidth","textBaseline","textAlign"],XV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:c+u/2,width:h(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:d+p/2,height:h(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:c+u/2,x1:c+u/2,y:d+p/2,y1:d+p/2,width:h(o)?void 0:0,height:h(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:h(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:h(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:h(n)?void 0:0,height:h(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:h(n)?void 0:0}}:{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:h(n)?void 0:0}}:{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:WV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:GV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:GV(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:UV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:UV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return YV.forEach((t=>{delete n[t],delete s[t]})),N(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{fl(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},$V=Object.assign({},XV),KV=t=>$V[t],qV=(t,e)=>{$V[t]=e},ZV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.from.min=l,m.to.min=d),b(u)&&(m.from.max=l,m.to.max=u),b(p)&&(m.from.q1=l,m.to.q1=p),b(g)&&(m.from.q3=l,m.to.q3=g),b(f)&&(m.from.median=l,m.to.median=f),m},JV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.to.min=l,m.from.min=d),b(u)&&(m.to.max=l,m.from.max=u),b(p)&&(m.to.q1=l,m.from.q1=p),b(g)&&(m.to.q3=l,m.from.q3=g),b(f)&&(m.to.median=l,m.from.median=g),m},QV=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(b(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return b(f)?f:b(_)&&b(v)?(_+v)/2:b(m)&&b(y)?(m+y)/2:b(y)?y:b(m)?m:NaN},tW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),b(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(b(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),b(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const eW=(t,e,i)=>{var n,s,r,a;if(b(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return b(o)?o:b(c)&&b(d)?(c+d)/2:b(l)&&b(h)?(l+h)/2:b(h)?h:b(l)?l:NaN},iW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),b(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(b(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),b(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const nW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},sW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},rW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sW:nW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function hW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(SV,i?t.slice().sort(i):t.slice()),{keys:AV,data:n};const s=jN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class cW{constructor(t,e,i){this.prevData=hW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const dW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const uW=(t,e,i,n,s)=>l(i)?i(t.getDatum(),t,s):i;class pW extends lC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class gW extends lC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{h(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}cC.mode|=TA.SET_ATTR_IMMEDIATELY;let fW=0;const mW=t=>!h(t)&&t.prototype instanceof lC;class yW{constructor(t,e,i){this.id=fW++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),b(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=l(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!KV(e.type))return null;const r=KV(e.type)(t,s,i);return dW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return m(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):d(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!h(null===(r=s[i])||void 0===r?void 0:r.from),l=!h(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?uW(t,0,s[i].from,0,n):void 0,e.to[i]=l?uW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),dW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),c=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=mW(o);return h(o)||mW(o)?u?new o(a.from,a.to,r,t.easing,c):a.to?new gW(a.from,a.to,r,t.easing):void 0:new pW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:c})})).filter((t=>!h(t)));1===e.length?t.play(e[0]):t.play(new OC(r,e))}}}function _W(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(vW(i,t[i]))})),e}function vW(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return N(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,c,d,u;if(h(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:MV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:PV,loop:null!==(n=l.loop)&&void 0!==n?n:EV,controlOptions:L({},BV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:CV,delay:null!==(a=l.delay)&&void 0!==a?a:TV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:RV,customParameters:l.customParameters,options:l.options}]}]}}const p=N(t.timeSlices).filter((t=>t.effects&&N(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:MV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:PV,loop:null!==(d=t.loop)&&void 0!==d?d:EV,controlOptions:L({},BV,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:TV,effects:N(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:RV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function bW(t,e,i){return l(t)?t.call(null,e.getDatum(),e,i):t}class xW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!h(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class SW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=_W(null!=e?e:{})}updateConfig(t){this.configs=_W(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==QN.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=vW(kV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return h(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=N(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===QN.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(h(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},i),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new yW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===QN.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(hV.ANIMATION_START,d),this.mark.emit(hV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=FN(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=bW(t.startTime,e,s),o=bW(t.totalTime,e,s),l=bW(t.oneByOne,e,s),h=bW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=bW(t.delay,e,s),l=null!==(i=bW(t.duration,e,s))&&void 0!==i?i:o/n,h=N(t.effects).map((t=>Object.assign({},t,{customParameters:bW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=v(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:v(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===QN.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===QN.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===kV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===QN.exit&&0===a[QN.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(hV.ANIMATION_END,h),this.mark.emit(hV.ELEMENT_ANIMATION_END,h,i)}}const wW=(t,e)=>HN(t)?t.output():t&&d(t)?l(t.callback)?i=>t.callback(i,e):l(t.value)?t.value(e):t:t,AW=(t,e)=>t?d(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=wW(s,e),i}),{}):t.map((t=>wW(t,e))):t;var kW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let MW=-1;class CW extends r{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=N(this.spec.dependency).map((t=>f(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=N(t).map((t=>f(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((i=>{var n;h(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return h(this.spec[e])||this.detach(LN(this.spec[e],this.view)),this.spec[e]=t,this.attach(LN(t,this.view)),this.commit(),this}}const TW=(t,e,i)=>{var n,s;if("callback"===t&&l(e))return{references:[],value:{callback:e,dependency:[]}};if(!h(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!h(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!h(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=LN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},EW=(t,e)=>{const i=(n=t.type,MN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(DN(a,e))));const o=((t,e,i)=>{if(h(e))return{value:e};if(m(e)){const n=e.map((e=>TW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return TW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},PW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=EW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class RW extends VV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if(l(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return fV(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?uV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=o(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===QN.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!h(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===QN.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=uV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{E(this.items[0].nextAttrs,e)||E(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=dV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{E(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===tV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return bV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&E(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),E(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),E(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)fl(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[vV]=null})),this.glyphGraphicItems=null),super.release()}}const BW=t=>t.markType===tV.glyph?new RW(t):new VV(t);function IW(t){return h(t.offsetX)?h(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function DW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return b(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),b(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&b(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&b(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const LW="window",OW="view",FW={trap:!1},zW="default",HW="width",jW="height",NW="viewWidth",VW="viewHeight",WW="padding",GW="viewBox",UW="autoFit";function YW(t,e,i,n,s){if(s===LW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{DW(t,IW(t),!1)}))}));const e=IW(t);DW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var XW=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 $W extends CW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new SW(this,{}),this.differ=new cW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=f(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=f(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!h(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===QN.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===lV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:wV,e);let n=i;(null==i?void 0:i.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(hV.AFTER_MARK_ENCODE)}return this.emit(hV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(hV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>h(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return XW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,h(t)||(f(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return f(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];ON(i)?this.detach(GN(i,this.view)):f(e)?this.detach(GN(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(GN(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return f(e)?(this.spec.encode[t][e]=i,this.attach(GN(i,this.view))):ON(e)?(this.spec.encode[t]=e,this.attach(GN(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(GN(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=PW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{h(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{h(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return bV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!h(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===QN.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];ON(s)||Object.keys(s).forEach((t=>{VN(s[t])&&(e[t]=zN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV];if((null==n?void 0:n.mark)===this){const i=YW(this.view,t,n,e,OW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new SW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=zN(this.spec.group,e);this.group=t,t&&(this.emit(hV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(hV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==tV.group){if(!this.graphicItem){const t=HV(this,tV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||xV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==tV.group?(h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=jN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>SV),a=jN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>SV),o=this.spec.sort,l=this.spec.groupSort,c=this.isCollectionMark(),d=new Set(this.elements.filter((t=>t.diffState===QN.enter))),u=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(h(e))s=this.elementMap.get(n),s&&(s.diffState=QN.exit);else if(h(i)){s=this.elementMap.has(n)?this.elementMap.get(n):BW(this),s.diffState===QN.exit&&(s.diffState=QN.enter,this.animate.getElementAnimators(s,QN.exit).forEach((t=>t.stop("start")))),s.diffState=QN.enter;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),u.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=QN.update;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),u.push(s)}d.delete(s)}));const p=null!=t?t:wV;this.differ.setCurrentData(hW(p,c?a:t=>`${a(t)}-${r(t)}`,c?l:void 0)),this.differ.doDiff(),d.forEach((t=>{this.elementMap.delete(c?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=u,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:HV(this,this.markType,t);if(this.emit(hV.BEFORE_ADD_VRENDER_MARK),this.markType===tV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(hV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==tV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=hW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=jN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>SV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=BW(this);e.diffState=QN.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=BW(this);i.diffState=QN.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(ON(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===tV.glyph&&XN(i)){const t=XN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>gV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{gV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(gV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(hV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(hV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(hV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||AV).forEach((t=>{const e=HV(this,tV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(hV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==QN.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return dV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=QN.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&NV(this.graphicItem),this.detachAll(),super.release()}}class KW extends $W{constructor(t,e,i){super(t,tV.component,i),this._componentDatum={[SV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:DV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,SV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[SV]+=1}evaluateJoin(t){return this.spec.key=SV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=f(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=f(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const qW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class ZW extends tE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){p(this.attribute[t])?L(this.attribute[t],e):this.attribute[t]=e,qW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>qW.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){h(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ct(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ct(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onSliderPointerMove),gj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onSliderPointerMove),gj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=dt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ge(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]=Ge(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new UM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function QW(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&QW(t,e)}))}JW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const tG=t=>!h(t)&&!1!==t.visible,eG=["#ffffff","#000000"];function iG(t,e,i,n,s){const r=aG(t),a=aG(e);return nG(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...eG);for(const s of r)if(t!==s&&nG(s,e,i,n))return s}(r,a,i,n,s)}function nG(t,e,i,n){return n?sG(t,e)>n:"largeText"===i?sG(t,e)>3:sG(t,e)>4.5}function sG(t,e){const i=rG(t),n=rG(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function rG(t){const e=ae(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 aG(t){if(null==t?void 0:t.includes("#"))return t;const e=new se(t),{r:i,g:n,b:s}=e.color;return"#"+oe(i,n,s)}function oG(t,e){return[t[0]*e,t[1]*e]}function lG(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const hG=-.5*Math.PI,cG=1.5*Math.PI,dG="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var uG;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uG||(uG={}));const pG={[uG.selectedReverse]:{},[uG.selected]:{},[uG.hover]:{},[uG.hoverReverse]:{}},gG=(t,e,i)=>new He(Object.assign({defaultFontParams:{fontFamily:dG,fontSize:11},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function fG(t,e){var i,n;if(!t)return{width:0,height:0};const s=_B({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var mG=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);sl&&(y=l,k.setAttribute("maxLineWidth",l-g[1]-g[2])));let D=0,L=0;"center"===B?(D-=y/2,m&&m.setAttribute("x",(m.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===B||"end"===B?(D-=y,m&&m.setAttribute("x",(m.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==B&&"start"!==B||f.setAttribute("x",g[3]),"middle"===I?(L-=_/2,m&&m.setAttribute("y",0)):"bottom"===I?(L-=_,m&&m.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===I&&(f.setAttribute("y",g[0]),m&&m.setAttribute("y",E/2));const{visible:O}=s,F=mG(s,["visible"]);if(u&&o(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:O&&!!e,x:D,y:L,width:y,height:_}),"rect");M(null==p?void 0:p.panel)||(t.states=p.panel)}}}yG.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var _G=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);sf?H=f:Hde&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>ge&&deme&&pece&&feue&&ye=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wG=class{render(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;this.poptipComponent||(this.poptipComponent=new vG(t.attribute.poptip));let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};g=n,L(e,xG.poptip,g),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const s=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:s.e,y:s.f})),h.stage.tryInitInteractiveLayer();const r=h.stage.getLayer("_builtin_interactive");r&&r.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wG=SG([Xw()],wG);var AG=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kG=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kG=AG([Xw()],kG);let MG=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MG=AG([Xw()],MG);const CG=new Vw((t=>{t(wG).toSelf().inSingletonScope(),t(jE).toService(wG),t(kG).toSelf().inSingletonScope(),t(PL).toService(kG),t(MG).toSelf().inSingletonScope(),t(PL).toService(MG)}));class TG extends ZW{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EG extends TG{constructor(t){super(L({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PG extends TG{constructor(t){super(L({},PG.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})}}PG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RG extends TG{constructor(t){super(L({},RG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}RG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class BG extends TG{constructor(t){super(L({},BG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=hG,endAngle:n=cG}=this.attribute,s=n-i,r=Ut(Kt(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}BG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class IG extends TG{constructor(t){super(L({},IG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=$t(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}IG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const DG=new Uint32Array(33),LG=new Uint32Array(33);LG[0]=0,DG[0]=~LG[0];for(let t=1;t<=32;++t)LG[t]=LG[t-1]<<1|1,DG[t]=~LG[t];function OG(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.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:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&DG[31&n]&LG[1+(31&s)])return!0}else{if(i[r]&DG[31&n])return!0;if(i[a]&LG[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,DG[31&i]&LG[1+(31&s)]);else for(n(r,DG[31&i]),n(a,LG[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,LG[31&i]|DG[1+(31&n)]);else for(s(r,LG[31&i]),s(a,DG[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FG(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function zG(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=FG(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function HG(t,e){return!(!t||!e)&&e.encloses(t)}function jG(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return jG(t,e,s,h,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return jG(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}if("moveX"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return jG(t,e,s,r,null===(c=n.overlap)||void 0===c?void 0:c.clampForce)}return!1}const VG=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],WG=["top","inside-top","inside"];const GG={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UG(t,e){var i,n;return null!==(n=null===(i=GG[e])||void 0===i?void 0:i.call(GG,t))&&void 0!==n?n:{from:{},to:{}}}const YG="same-time",XG=300,$G="linear";class KG extends ZW{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||M(e.states)||(e.addState(uG.hover,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this,(t=>{M(t.states)||(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void QW(this,(t=>{M(t.states)||(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));M(e.states)||(e.addState(uG.selected,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!M(e)&&(t.states=e)}_createLabelText(t){const e=dB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if(l(s)&&(s=s({})),!s||0===s.length)return[];let r=[];l(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],h=this.getBaseMarkGroup(),c=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==h?void 0:h.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==h?void 0:h.AABBBounds.height())&&void 0!==s?s:0};if(0===c.width||0===c.height)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:p=!0,clampForce:g=!0}=e,f=this._bmpTool||OG(c.width,c.height),m=this._bitmap||f.bitmap(),y=u.some((t=>"bound"===t.type));d&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&m.setRange(FG(f,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:YG,h=null!==(n=a.duration)&&void 0!==n?n:XG,c=null!==(s=a.easing)&&void 0!==s?s:$G,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=UG(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&b(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new TC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(UG(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==MA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===MA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=iG(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=iG(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=iG(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class qG extends KG{constructor(t){super(L({},qG.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZG extends KG{constructor(t){super(L({},ZG.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}ZG.tag="rect-label",ZG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const JG={rect:ZG,symbol:qG};class QG extends ZW{constructor(t){super(L({},QG.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!b(n*i))return;this._componentMap||(this._componentMap=new Map);const s=OG(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function tU(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 eU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=jt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function iU(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=tU(t,!!s),o=tU(r,!!s);const h=jt.distancePP(n,l),c=jt.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=eU(e,t,!1,!!s),o=eU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=tU(t,!!s),o=tU(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}QG.defaultAttributes={pickable:!1};class nU extends ZW{constructor(t){super(L({},nU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!M(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let h="";if("line"===t||"polygon"===t)h=tU(o,!!n);else if("circle"===t){const{center:t}=this.attribute;h=eU(t,o,!1,!!n)}const c=lB(Object.assign({path:h,z:r},l(i)?L({},nU.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;o.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=tU(o,!!n),g=Ct(o[0].x-o[1].x),f=Ct(o[0].y-o[1].y),m=lB(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*wt/2:0,beta:gf?[o[0].x,0]:[0,o[0].y]},l(i)?L({},nU.defaultAttributes.style,i(t,e)):i));m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${s}`),this.add(m)})),e.length>1&&s)){const t=m(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=oB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),M(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=uB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),M(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var rU,aU;sU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(rU||(rU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(aU||(aU={}));const oU={[aU.selectedReverse]:{},[aU.selected]:{},[aU.hover]:{},[aU.hoverReverse]:{}},lU={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var hU=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.name&&!M(e.states)&&(e.addState(uG.hover,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(uG.selected))return this._lastSelect=null,void QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));e.name&&!M(e.states)&&(e.addState(uG.selected,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);L(this.attribute,t);const i=aB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=aB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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,grid:r,items:a,panel:o}=this.attribute,l=aB({x:0,y:0,zIndex:1});if(l.name=rU.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=aB({x:0,y:0,pickable:!1});t.name=rU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=hB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=rU.background,e.id=this._getNodeId("background"),M(o.state)||(e.states=L({},pG,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){const e=this.getTickLineItems(),i=aB({x:0,y:0,pickable:!1});i.name=rU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=oB(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=rU.tick,r.id=this._getNodeId(t.id),M(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=null;else{const t=this.data[n],e=L({},pG,this.attribute.tick.state);Object.keys(e).forEach((i=>{l(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(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=oB(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=rU.subTick,r.id=this._getNodeId(`${s}`),M(n.state))r.states=null;else{const i=L({},pG,n.state);Object.keys(i).forEach((n=>{l(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&&l(n)&&(e=n(e,i));const s=this._transformItems(e),r=aB({x:0,y:0,pickable:!1});r.name=`${rU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,o=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=dB(u);if(p.name=rU.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),M(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=null;else{const n=L({},pG,this.attribute.label.state);Object.keys(n).forEach((r=>{l(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),o=Math.max(o,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),o=Math.abs(o*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new yG(Object.assign({},e));i.name=rU.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return rt(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&l(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=wt/2*(l.x>e.x?1:-1):h=wt/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===_[1]?m+=(this.axisLabelLayerSize[n-1].height+C(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+C(this.attribute,"label.space",4))*n);const v=this.getVerticalCoord(t.point,m,p),b=this.getVerticalVector(m,p,v),x=g?g(t.label,t,e,i,n):t.label;let{style:S}=f;return S=l(S)?L({},lU.label.style,S(t,e,i,n)):S,S=L({textAlign:this.getTextAlign(b),textBaseline:this.getTextBaseline(b,p)},S),l(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},v),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new nU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${rU.grid}-sub`:`${rU.grid}`,n.id=this._getNodeId(t),e.add(n)}}const dU={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&&uU(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function uU(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function pU(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function fU(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ce(t,i),r=Ce(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Me(t),l=Me(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:ke(t.angle);let f=i?t.angle+At:ke(90-t.angle);const m=i?e.angle:ke(e.angle);let y=i?e.angle+At:ke(90-e.angle);f>Mt&&(f-=Mt),y>Mt&&(y-=Mt);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(we(s,i)+we(s,n))/2>we(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function mU(t,e){"bottom"!==t&&"top"!==t||function(t,e){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"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var yU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return oG([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:m}=l,y=yU(l,["position","space","textStyle","autoRotate","shape","background","state"]);let _=.5;"start"===c?_=0:"end"===c&&(_=1);const{verticalFactor:v=1}=this.attribute,b=-1*v,x=this.getTickCoord(_),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+C(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,T=this.getVerticalCoord(x,k,!1),E=this.getVerticalVector(k,!1);let P,R,{angle:B}=y;if(P="start"===c?"start":"end"===c?"end":"center",h(B)&&p){B=lG(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else P=this.getTextAlign(E),R=this.getTextBaseline(E,!1);const I=Object.assign(Object.assign(Object.assign({},T),y),{textStyle:Object.assign({textAlign:P,textBaseline:R},u),state:M(m)?null:{text:m.text,shape:m.shape,panel:m.background}});return I.angle=B,g&&g.visible&&(I.shape=Object.assign({visible:!0},g.style),g.space&&(I.space=g.space)),f&&f.visible&&(I.panel=Object.assign({visible:!0},f.style)),I}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=hG,endAngle:r=cG}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(M(t))return;const{verticalLimitSize:o,label:c,title:d,line:u,tick:p,orient:g}=this.attribute,f=null!==(s=c.space)&&void 0!==s?s:4;let m=o,y=0,_=0;const v=(null==u?void 0:u.visible)?null!==(r=u.style.lineWidth)&&void 0!==r?r:1:0,x=(null==p?void 0:p.visible)?null!==(a=p.length)&&void 0!==a?a:4:0;(null==d?void 0:d.visible)&&(y=fG(d.text,d.textStyle).height,_=d.space),m&&(m=(m-f-_-y-v-x)/n);const{layoutFunc:S,autoRotate:w,autoRotateAngle:A,autoLimit:k,limitEllipsis:C,autoHide:T,autoHideMethod:E,autoHideSeparation:P}=c;l(S)?S(t,e,i,this):(w&&function(t,e){if(M(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Gt(e)})),mU(i,t),!fU(t))break}}(t,{labelRotateAngle:A,orient:g}),k&&b(m)&&m>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!M(t)&&b(i)&&t.forEach((t=>{const e=0===t.attribute.angle||h(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:m,ellipsis:C,orient:g}),T&&function(t,e){if(M(t))return;const i=t.filter(gU);if(M(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=l(s)?s:dU[s]||dU.parity;if(n.length>=3&&pU(n,r)){do{n=a(n,r)}while(n.length>=3&&pU(n,r));n.length<3&&!V(i).attribute.opacity&&(n.length>1&&V(n).setAttribute("opacity",0),V(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:g,method:E,separation:P}))}}_U.defaultAttributes=lU;var vU,bU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=rB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=rU.line,c.id=this._getNodeId("line"),M(null==a?void 0:a.state)||(c.states=L({},oU,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=hG,endAngle:i=cG}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=hG,endAngle:i=cG,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return $t(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return oG(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:m,state:y}=u,_=bU(u,["space","textStyle","shape","background","state"]);let v=l,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=C(this.attribute.label,"style.fontSize",12)+C(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;h(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",v={x:l.x,y:l.y-S}):"end"===A&&(w="top",v={x:l.x,y:l.y+S});const k=Object.assign(Object.assign(Object.assign({},v),_),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:M(y)?null:{text:y.text,shape:y.shape,panel:y.background}}),{angle:T}=_;return k.angle=T,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}xU.defaultAttributes=lU;class SU extends lC{constructor(){super(...arguments),this.mode=TA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return QW(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},QW(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=b(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=_t.lastIndex=vt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=_t.exec(t))&&(n=vt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=vt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=vU.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=vU.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=vU.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===vU.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===vU.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=vU.endHandler):this.state.start=this.state.start+o:this._activeTag===vU.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===gj.env&&(gj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),gj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===vU.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ct(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ct(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=AU(t,["formatMethod"]),{formatMethod:s}=e,r=AU(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const m=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,y=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(m+y)/2,f={x:f.x+m/2,y:f.y}):(g-=(m+y)/2,f={x:f.x,y:f.y+m})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+P*I,y:B.y,width:(R-P)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+P*D,width:I,height:(R-P)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+P*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(P+R)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+P*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(P+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i}=this.attribute,{start:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new yG(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;c(t)&&c(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...N(a))}setUpdateStateCallback(t){l(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){l(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){l(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){l(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){l(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){l(t)&&(this._statePointToData=t)}};var MU,CU,TU;kU.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(MU||(MU={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(CU||(CU={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(TU||(TU={}));class EU extends ZW{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=aB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const PU={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:MU.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]}},RU={start:{textAlign:"right",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:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},BU={label:{position:CU.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}},IU={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"}},DU={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"}};let LU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},RU[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new sU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new yG(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};LU.defaultAttributes=PU;let OU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},IU[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=gB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new yG(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};OU.defaultAttributes=BU;let FU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=TU.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},DU[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=uB(Object.assign(Object.assign({},e),n)):"text"===i?o=new yG(Object.assign({},e)):"richText"===i?o=fB(Object.assign(Object.assign({},e),s)):"image"===i?o=pB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new sU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=oB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};FU.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const zU={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class HU extends ZW{getCurrent(){return this._current}constructor(t){super(L({},HU.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new UM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new UM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.hasState(WU.selected)?this._setLegendItemState(t,WU.selectedHover):this._setLegendItemState(t,WU.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(GU.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(GU.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=a.delegate;if(a.name===UU.focus){const e=t.hasState(WU.focus);t.toggleState(WU.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover,WU.focus]),this._setLegendItemState(t,WU.selected)})):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover,WU.focus]),this._setLegendItemState(e,WU.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(WU.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(WU.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(GU.legendItemClick,t);n?(this._removeLegendItemState(t,[WU.selected,WU.selectedHover]),this._setLegendItemState(t,WU.unSelected)):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]))}else this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}this._dispatchEvent(GU.legendItemClick,t)}}}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,WU.selected),this._removeLegendItemState(e,[WU.unSelected,WU.unSelectedHover])):(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||M(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=aB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=jU,spaceRow:f=NU,maxWidth:m,width:y,height:_}=t;c(m)?c(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:c(y)&&(this._itemWidthByUser=y),c(_)&&(this._itemHeightByUser=_);let v=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!M(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,c(l)&&(o>=l?(v=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,c(h)&&h0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;v&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:l=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:m={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),m=this._handleStyle(m,t,e,i,n);const y=Ge(l);let _;!1===m.visible?(_=aB({x:0,y:0,cursor:(null==m?void 0:m.style).cursor}),this._appendDataToShape(_,UU.item,t,_)):(_=aB(Object.assign({x:0,y:0},null==m?void 0:m.style)),this._appendDataToShape(_,UU.item,t,_,null==m?void 0:m.state)),_.addState(e?WU.selected:WU.unSelected);const v=aB({x:0,y:0,pickable:!1});_.add(v);let b=0;const x=C(p,"style.size",10),S=C(p,"space",8),w=uB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&h(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&h(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,UU.itemShape,t,_,null==p?void 0:p.state),w.addState(e?WU.selected:WU.unSelected),v.add(w);let k=0;if(d){const e=C(u,"size",10);A=uB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:y})),this._appendDataToShape(A,UU.focus,t,_),k=e}const M=dB(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,UU.itemLabel,t,_,null==g?void 0:g.state),M.addState(e?WU.selected:WU.unSelected),v.add(M);const T=C(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+T,c(a)){const n=C(f,"space",d?8:0),s=dB(Object.assign(Object.assign({x:b+T,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));this._appendDataToShape(s,UU.itemValue,t,_,null==f?void 0:f.state),s.addState(e?WU.selected:WU.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-M.AABBBounds.width()-T-k-n),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-y[1]-y[3]-k-n})),b=s.AABBBounds.x2+n,v.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-k);A&&(A.setAttribute("x",b),v.add(A));const E=v.AABBBounds,P=E.width(),R=E.height(),B=this._itemWidthByUser||P+y[1]+y[3],I=this._itemHeightByUser||R+y[0]+y[2];return _.attribute.width=B,_.attribute.height=I,v.translateTo(-E.x1+y[3],-E.y1+y[0]),_}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=jU,spaceRow:h=NU}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=VU}=o,f=XU(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new HU(Object.assign({layout:1===r?"horizontal":"vertical",total:99},L({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new HU(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=aB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(WU.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=L({},$U,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new UM(t,{item:e,data:e.data,selected:e.hasState(WU.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=L({},t);return t.style&&l(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&l(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var qU;function ZU(t){return m(t)?t:[t,t]}function JU(t){return t?"ew-resize":"ns-resize"}KU.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:jU,spaceRow:NU,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:VU,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"}(qU||(qU={}));let QU=class t extends ZW{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(L({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onHandlerPointerMove),gj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ct(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===gj.env)gj.removeEventListener("pointermove",this._onHandlerPointerMove),gj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onTrackPointerMove),gj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ct(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ct(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onTrackPointerMove),gj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,d;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,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(c(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=N(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;h(u)&&(u=[o,l]),this._currentValue={startValue:ZU(u)[0],endValue:ZU(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=aB({x:0,y:0});g.name=qU.innerView,this.add(g),this._innerView=g;let f,m=0;if(r&&r.visible){f=dB(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=qU.startText,g.add(f);const e=c(r.space)?r.space:0;m+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const y=aB({x:p?m:0,y:p?0:m});g.add(y);const _=aB({x:0,y:0});let v;if(_.name=qU.railContainer,this._railContainer=_,y.add(_),this._renderRail(_),m+=p?n:s,a&&a.visible){const t=c(a.space)?a.space:0;v=dB(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),v.name=qU.endText,g.add(v)}this._renderTrack(_),d&&(this._renderHandlers(y),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=hB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=qU.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:c}=this.attribute;let{value:d}=this.attribute;h(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?l:o,[f,m]=ZU(d),y=(f-i)/(n-i)*g,_=this._renderHandler(Object.assign({x:p?y:l/2,y:p?o/2:y,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(_.name=qU.startHandler,this._startHandler=_,t.add(_),this._currentValue.startPos=y,u){const e=this._renderHandlerText(f);e.name=qU.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(m-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(a.name=qU.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(m);e.name=qU.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:c}=this.attribute;h(c)&&(c=[i,n]);const u=this._isHorizontal,p=u?r:s;let[g,f]=ZU(c);e||(g=i);const m=aB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=qU.trackContainer;const y=d(e)&&!0===e.draggableTrack;let _;_=!1===l?"default":!1===e||!1===y?"pointer":JU(u);const v=(f-g)/(n-i)*p,b=hB(Object.assign({x:u?(g-i)/(n-i)*p:0,y:u?0:(g-i)/(n-i)*p,width:u?v:r,height:u?s:v,cursor:_},a));b.name=qU.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return uB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":JU(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),dB(f)}_bindEvents(){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),d(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===qU.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===qU.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===qU.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===qU.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new UM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};QU.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},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}}};class tY extends YU{constructor(t){super(L({},tY.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,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:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function eY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}tY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class iY extends YU{constructor(t){super(L({},iY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,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:y,sizeBackground:_}=this.attribute,v=aB({x:0,y:0});this._innerView.add(v);const b=new QU({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:eY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=lB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}iY.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)"}};let nY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,P,R,B,I,D,L,O,F,z,H,j,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:mt,minHeight:yt,maxHeight:_t,align:vt,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ge(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&c(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else c(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(h=null==ct?void 0:ct.maxLineWidth)&&void 0!==h?h:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&c(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(m=ut.y)&&void 0!==m?m:At,width:null!==(_=null!==(y=ut.width)&&void 0!==y?y:pt)&&void 0!==_?_:0,height:null!==(b=null!==(v=ut.height)&&void 0!==v?v:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else c(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(c(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),c(gt)&&(Et=gt),c(ft)&&Ttmt&&(Tt=mt)),c(yt)&&Et_t&&(Et=_t)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],c(vt)||c(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:vt,e=null!==(O=null==ct?void 0:ct.width)&&void 0!==O?O:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","left")):"center"===t?(null===(H=this._mainTitle)||void 0===H||H.setAttribute("x",e/2),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(c(vt)||c(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:vt,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};nY.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 sY={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"}}};let rY=class extends ZW{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(c(i))if(!1!==i.visible){const t=L({},C(sY,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:c(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&b(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&b(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(c(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=N(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=L({},C(sY,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:c(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&b(a)&&this._setAutoFit(a,d,e),e.autoLimit&&b(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;h+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=fG(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",c(i.style.lineHeight)?i.style.lineHeight:s)}}};class aY extends UP{constructor(t){super(t)}}var oY,lY;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oY||(oY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lY||(lY={}));class hY extends ZW{constructor(t){super(L({},hY.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style: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"},hY.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style: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"},hY.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{h(this._playController)&&(this._playController=new aY(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{h(this._backwardController)&&(this._backwardController=new aY(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{h(this._forwardController)&&(this._forwardController=new aY(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new UM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(oY.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(oY.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(oY.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(oY.OnBackward);this.dispatchEvent(t)},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()}}hY.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hY.defaultAttributes={visible:!0,[lY.Start]:{},[lY.Pause]:{},[lY.Backward]:{},[lY.Forward]:{}};const cY={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dY=[200,10];var uY,pY;!function(t){t.Default="default",t.Reverse="reverse"}(uY||(uY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(pY||(pY={}));const gY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},fY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},mY=t=>"top"===t||"bottom"===t;class yY extends ZW{constructor(t){super(L({},yY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;b(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Pt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:b(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(mY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:dY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:dY[1];s.layout="vertical",s.railWidth=e,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 QU(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return mY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},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 hY(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=mY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=v(i)?i:Pt(i[0],i[1]);return t+e.space+n}),0),l=(mY(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,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new UM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}yY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},cY),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cY),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cY),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cY),{key:"backward",position:"start"})}};class _Y extends yY{constructor(t){super(L({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:uY.Default,this._dataIndex=h(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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(pY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=gj.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(pY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(pY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=gj.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(),gj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var vY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class bY extends yY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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,n=i/this._maxIndex;this._elapsed=n*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(pY.OnChange))},this.play=()=>vY(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(pY.OnPlay),this._rafId=gj.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=gj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},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(pY.OnBackward)},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(pY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const xY={debounce:gt,throttle:ft};let SY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",xY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=gB(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return L(t,...i,{shape:s.every(h)?void 0:L({},...s),key:r.every(h)?void 0:L({},...r),value:a.every(h)?void 0:L({},...a)})},AY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},kY={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:dG,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Wt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},MY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let CY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=Ge(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",L({symbolType:"circle"},d.shape,{visible:tG(d)&&tG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:tG(d)&&tG(d.value)},AY(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:tG(d)&&tG(d.value)},d.value),"text");const u=tG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-h[3]-h[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const m=tG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+m);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!tG(l))return;const h=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let u=0;if(tG(l.shape)&&d.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),tG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},AY(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(tG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},AY(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";c(l.value.textAlign)?e=l.value.textAlign:tG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>MY.includes(t)))?(this._mergeAttributes(e,n),h(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&tG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=tG(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=gG(u),v=gG(p);let b=0;if(tG(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(tG(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&WP[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return wY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};CY.defaultAttributes=kY;const TY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class EY extends KW{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=f(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}LV(nV.lineAxis,((t,e)=>new _U(t,e))),LV(nV.circleAxis,(t=>new xU(t)));class PY extends EY{constructor(t,e,i){super(t,eV.axis,e),this.spec.componentType=eV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=L({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=DV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=mV(s,e,i,n);const c=FN(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=FN(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=FN(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case nV.lineAxis:return((t,e,i)=>{var n,s;const r=TY.axis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p);case nV.circleAxis:return((t,e,i)=>{var n,s;const r=TY.circleAxis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(h(e)){const i=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?nV.circleAxis:nV.lineAxis,this._axisComponentType}}LV(sV.discreteLegend,(t=>new KU(t))),LV(sV.colorLegend,(t=>new tY(t))),LV(sV.sizeLegend,(t=>new iY(t)));class RY extends EY{constructor(t,e){super(t,eV.legend,e),this.spec.componentType=eV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==sV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":GU.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=f(t)?this.view.getDataById(t):t,l=f(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,iV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=DV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=mV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case sV.discreteLegend:return((t,e)=>{const i=TY.discreteLegend;return t?L({},i,{items:Array.from(new Set(N(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=NN(n),r=s?Object.assign(Object.assign({},TY.discreteLegend.items[0].shape),{fill:s,stroke:s}):TY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):L({},i,null!=e?e:{})})(o,a);case sV.colorLegend:return((t,e)=>{const i=TY.colorLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{colors:t.range().slice(),min:n[0],max:V(n)},null!=e?e:{})})(o,a);case sV.sizeLegend:return((t,e)=>{const i=TY.sizeLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&zl(i)){const t=e.getScale().range();NN(null==t?void 0:t[0])?this._legendComponentType=sV.colorLegend:this._legendComponentType=sV.sizeLegend}else this._legendComponentType=sV.discreteLegend}return this._legendComponentType}}LV(rV.lineCrosshair,(t=>new EG(t))),LV(rV.rectCrosshair,(t=>new PG(t))),LV(rV.sectorCrosshair,(t=>new BG(t))),LV(rV.circleCrosshair,(t=>new RG(t))),LV(rV.polygonCrosshair,(t=>new IG(t)));const BY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(jl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Yt(Kt(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else zl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Kt(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class IY extends EY{constructor(t,e){super(t,eV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case rV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return L({},l,BY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case rV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=BY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=L({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case rV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(jl(e.type)){const i=Yt(Kt(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else zl(e.type)&&(f=Kt(u,t));return L({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=TY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(jl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else zl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return L({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(jl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else zl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return L({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=DV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?rV.sectorCrosshair:rV.rectCrosshair:"radius"===n?rV.circleCrosshair:"radius-polygon"===n?rV.polygonCrosshair:rV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}LV(eV.slider,(t=>new QU(t)));class DY extends KW{constructor(t,e){super(t,eV.slider,e),this.spec.componentType=eV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=f(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=f(t)?this.view.getDataById(t):t,a=f(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,iV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>L({},TY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(h(this.spec.min)?0:FN(this.spec.min,i,t,e),h(this.spec.max)?1:FN(this.spec.max,i,t,e),mV(n,t,e,i))}),e}),{});this._encoders=e}}LV(eV.label,(t=>new QG(t)));let LY=class extends KW{constructor(t,e){super(t,eV.label,e),this.spec.componentType=eV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=FN(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=TY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case tV.line:r=TY.lineLabel;break;case tV.rect:r=TY.rectLabel;break;case tV.symbol:r=TY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[vV],n=mV(i,e.getDatum(),e,s),o=L({},r.data[0],n);a.push(o)}}));const o=FN(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return L({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!h(t)));return L({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};LV(eV.datazoom,(t=>new kU(t)));class OY extends KW{constructor(t,e){super(t,eV.datazoom,e),this.spec.componentType=eV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!h(this.spec.preview)){const t=this.spec.preview.data,e=f(t)?this.view.getDataById(t):t;this.detach(e),this.detach(GN(this.spec.preview.x,this.view)),this.detach(GN(this.spec.preview.y,this.view)),this.detach(GN(this.spec.preview.x1,this.view)),this.detach(GN(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=f(t)?this.view.getDataById(t):t;this.attach(r),this.attach(GN(e,this.view)),this.attach(GN(i,this.view)),this.attach(GN(n,this.view)),this.attach(GN(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t,c=f(e)?(t,i)=>{if(h(i.start)||h(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,iV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},TY.datazoom,t),n=DV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=f(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=mV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=TY.datazoom;return t?L({},l,{previewData:t,previewXCallback:e?t=>mV({x:e},t,r,a).x:null,previewYCallback:i?t=>mV({y:i},t,r,a).y:null,previewX1Callback:n?t=>mV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>mV({y1:s},t,r,a).y1:null},null!=o?o:{}):L({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=f(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}LV(oV.continuousPlayer,(t=>new bY(t))),LV(oV.discretePlayer,(t=>new _Y(t)));let FY=class extends KW{constructor(t,e){super(t,eV.player,e),this.spec.componentType=eV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=m(t)?null:f(t)?this.view.getDataById(t):t;this.detach(e)}const r=m(e)?null:f(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=f(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(pY.OnChange,this._filterCallback),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t;return this._filterData(o,l,iV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(pY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=L({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:DV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=mV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=m(o)?null:f(o)?this.view.getDataById(o):o,h=m(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>L({},TY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>L({},TY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};LV(eV.tooltip,(t=>new CY(t)));let zY=class extends KW{constructor(t,e){super(t,eV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ft(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Wt).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>L({},TY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!h(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return N(t).reduce(((t,e)=>(t=t.concat(LN(e.visible,this.view)),WN(e.key)||(t=t.concat(LN(e.key,this.view))),WN(e.value)||(t=t.concat(LN(e.value,this.view))),WN(e.symbol)||(t=t.concat(LN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=FN(t.visible,n,e,i);return o=!!h(o)||!!o,s=WN(t.key)?ll(t.key.field)(e):FN(t.key,n,e,i),s=h(s)?void 0:u(s)?s:{text:s},r=WN(t.value)?ll(t.value.field)(e):FN(t.value,n,e,i),r=h(r)?void 0:u(r)?r:{text:r},a=WN(t.symbol)?ll(t.symbol.field)(e):FN(t.symbol,n,e,i),a=h(a)?void 0:u(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?N(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var HY=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 jY extends CW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],h(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=LN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];N(t.source).forEach((t=>{const i=HN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return HY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return h(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return h(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=N(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=PW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(N(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=N(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function NY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function VY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,NY(t,e,s,n)}class WY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}return this.nodes.push(t),NY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,VY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class GY{constructor(t){this.list=[],this.ids={},this.idFunc=t||hl}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var UY=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 YY{constructor(){this.grammars=[],this.logger=We.getInstance(),this._curRank=0,this._committed=new GY((t=>t.uid)),this._heap=new WY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return UY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>h(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new GY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return UY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const XY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===tV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class $Y{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(hV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return RT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gk.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(hV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Cj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(hV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(hV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(hV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new JM(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=d(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new eC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class KY extends CW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?FN(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(m(t)&&m(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function rX(t,e,i){FN(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=FN(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),h(null==n?void 0:n.clamp)||(l(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function aX(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i),rX(t,e,i)}function oX(t,e,i){t.round&&e.round(FN(t.round,i,e),!0),t.padding&&e.padding(FN(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(FN(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(FN(t.paddingOuter,i,e),!0),t.align&&e.align(FN(t.align,i,e),!0)}function lX(t,e,i,n){const s=t.field,r=zN(t.data,i),a=f(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),zl(e.type)?(n&&a.filter((t=>v(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function hX(t,e,i){if(ZY(t.domain)?e.domain(lX(t.domain,e,i,!0),!0):e.domain(FN(t.domain,i,e),!0),ZY(t.range))e.range(lX(t.range,e,i),!0);else if(JY(t.range)){const n=zN(t.range.coordinate,i);!function(t){switch(t){case Fl.Quantile:case Fl.Quantize:case Fl.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(FN(t.range,i,e),!0);switch(t.type){case"linear":aX(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){oX(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){aX(t,e,i);const n=FN(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i);const n=FN(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){aX(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){aX(t,e,i);const n=FN(t.constant,i,e);b(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class cX extends CW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=qY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=qY(this.spec.type)),hX(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return h(this.spec.domain)||this.detach(tX(this.spec.domain,this.view)),this.spec.domain=t,this.attach(tX(t,this.view)),this.commit(),this}range(t){return h(this.spec.range)||this.detach(tX(this.spec.range,this.view)),this.spec.range=t,this.attach(tX(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!h(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!h(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return h(e)?null:this.parameters()[e]}configure(t){return this.detach(eX(this.spec.type,t,this.view)),h(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(eX(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let dX=-1;const uX=[HW,jW,WW,NW,VW,GW,UW],pX=t=>{var e,i,n,s;return v(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},gX=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:RV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:TV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:CV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:PV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},fX=(t,e)=>(null==e?void 0:e.debounce)?gt(t,e.debounce):(null==e?void 0:e.throttle)?ft(t,e.throttle):t,mX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:OW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):zV[t]?(i.markType=t,i.source=e):i.source=t===LW?LW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},yX={},_X=()=>yX;let vX=class extends $W{constructor(t,e){super(t,tV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return dV.rect}evaluateJoin(t){return super.evaluateJoin(wV)}};function bX(t,e){if(b(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return b(t)?t*e:0}return 0}function xX(t,e){return Math.min(t<0?t+e:t-1,e)}function SX(t,e,i){let n=xX(t,i),s=xX(e,i);if(b(t)||b(e)?b(t)?b(e)||(n=xX(Math.max(0,s-1),i)):s=xX(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const wX=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>bX(t,i))),u=l.map((t=>bX(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=SX(e,i,r),{start:h,end:c}=SX(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},AX=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=ml(r.maxChildWidth,s.width()),o=ml(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=pX(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==tV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(l(r))r.call(null,t,s,a,e);else if(l(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=AX(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(NW,o),i.updateSignal(VW,l),i.updateSignal(WW,h)}else AX(t,s,a,e);else"grid"===r.display&&wX(t,s,a);kX(s,e,i)}))};class MX extends $W{constructor(t,e,i){super(t,tV.glyph,i),this.glyphType=e,this.glyphMeta=XN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=jV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let CX=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return h(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return h(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return m(t)?(i.x=t[0],i.y=t[1]):v(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new qt,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class TX extends CX{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=h(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=h(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=m(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class EX extends CX{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Yt(s);const r=rt(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function PX(t){switch(t){case"cartesian":default:return new TX;case"polar":return new EX}}class RX extends CW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=PX(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=PX(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,c;!h(t.start)&&e.start(null!==(n=FN(t.start,i))&&void 0!==n?n:[0,0]),!h(t.end)&&e.end(null!==(s=FN(t.end,i))&&void 0!==s?s:[0,0]),!h(t.origin)&&e.origin(null!==(r=FN(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!h(t.translate)){const e=FN(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!h(t.rotate)){const e=FN(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!h(t.scale)){const e=FN(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}h(t.transpose)||FN(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const BX=Symbol.for("key");class IX{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i[0]}):h(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=hW(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=hW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!h(e.morphElementKey)){const i=jN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i}):h(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:BX})),r=hW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:BX}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==BX){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=FN(i.animation.delay,s,o,l),d=FN(i.animation.duration,s,o,l),u=FN(i.animation.oneByOne,s,o,l),p=FN(i.animation.splitPath,s,o,l),g=b(u)&&u>0?t=>v(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(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);yT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>pT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>fT(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:MA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new mT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:fC,null!==(l=i.easing)&&void 0!==l?l:mC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:MA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new _T({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:fC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:mC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):yT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class DX{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=f(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),h(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),h(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),h(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),h(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class LX{constructor(t){this._animations=[],this._onAnimationStart=t=>{0===this._animations.length&&this._view.emit(hV.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._animations=this._animations.filter((e=>e.config!==t.animationConfig||e.mark!==t.mark)),0===this._animations.length&&this._view.emit(hV.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(hV.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(hV.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e)})),this}pause(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e)})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e)})),this}enable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})),this}disable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i||i.call(e)})),this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.enableAnimationState)||void 0===n||n.call(i,t)})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.disableAnimationState)||void 0===n||n.call(i,t)})),this}isAnimating(){return 0!==this._animations.length}animate(){return this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){this._view.removeEventListener(hV.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(hV.ALL_ANIMATION_END,this._onAnimationEnd)}}class OX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=mV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===Fl.Band){if(!h(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===Fl.Band){if(!h(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:dV.rect}addGraphicItem(t,e){const i=HV(this,this.coord&&"polar"===this.coord.output().type?tV.arc:tV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class FX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=mV(e,t,i,s);if(h(r.size)){const t=n.x?yV(n.x):void 0,e=n.y?yV(n.y):void 0;h(t)&&h(e)?r.size=10:h(t)?r.size=e:h(e)&&(r.size=t),r.size=[t,e]}return h(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(v(i.padding)&&i.padding>0)t.size=m(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(m(i.padding)&&2===i.padding.length){const e=m(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(dV.symbol)}release(){super.release(),this._encoders=null}}var zX=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 HX extends r{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV],s=YW(0,t,n,e,OW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){f(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new KY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new jY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new cX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new RX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=f(e)?this.getMarkById(e):e;let s;switch(t){case tV.group:s=new vX(this,n);break;case tV.glyph:s=new MX(this,null==i?void 0:i.glyphType,n);break;case tV.component:s=((t,e,i,n)=>{switch(e){case eV.axis:return new PY(t,i,n);case eV.legend:return new RY(t,i);case eV.crosshair:return new IY(t,i);case eV.slider:return new DY(t,i);case eV.label:return new LY(t,i);case eV.datazoom:return new OY(t,i);case eV.player:return new FY(t,i);case eV.tooltip:return new zY(t,i)}return new KW(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case tV.interval:s=new OX(this,t,n);break;case tV.cell:s=new FX(this,t,n);break;default:s=new $W(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(tV.group,t)}glyph(t,e){return this.mark(tV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(tV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(tV.component,t,{componentType:eV.axis,mode:e})}legend(t){return this.mark(tV.component,t,{componentType:eV.legend})}crosshair(t){return this.mark(tV.component,t,{componentType:eV.crosshair})}slider(t){return this.mark(tV.component,t,{componentType:eV.slider})}label(t){return this.mark(tV.component,t,{componentType:eV.label})}datazoom(t){return this.mark(tV.component,t,{componentType:eV.datazoom})}player(t){return this.mark(tV.component,t,{componentType:eV.player})}tooltip(t){return this.mark(tV.component,t,{componentType:eV.tooltip})}customized(t,e){const i=(t=>yX[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=f(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&uX.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(hV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++dX;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(HW,t.width),this.updateSignal(jW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=_X();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(hV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=lV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:HW,value:null!==(i=t[HW])&&void 0!==i?i:0},{id:jW,value:null!==(n=t[jW])&&void 0!==n?n:0},{id:WW,value:pX(null!==(s=t[WW])&&void 0!==s?s:e[WW])},{id:NW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[HW]-i.left-i.right},dependency:[HW,WW]}},{id:VW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[jW]-i.top-i.bottom},dependency:[jW,WW]}},{id:GW,update:{callback:(t,e)=>{const i=pX(e[WW]);return(t||new Vt).setValue(i.left,i.top,i.left+e[NW],i.top+e[VW])},dependency:[NW,VW,WW]}},{id:UW,value:null!==(r=t[UW])&&void 0!==r?r:e[UW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===tV.glyph?{glyphType:t.glyphType}:t.type===tV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(HW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(NW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(VW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(WW);if(arguments.length){const i=pX(t);return this.updateSignal(e,i),i}return pX(e.output())}autoFit(t){const e=this.getSignalById(UW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(GW);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=lV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===tV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||kX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(hV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(hV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(hV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{XY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(hV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(hV.BEFORE_MARK_RENDER_END),XY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(hV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return zX(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return zX(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(hV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(hV.AFTER_DO_RENDER)}evaluate(t){var e,i;return zX(this,void 0,void 0,(function*(){const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!uX.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return XY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=en(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return zX(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(HW,t)),e!==this.height()&&(n=!0,this.updateSignal(jW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,c=mX(e);if(!c)return;const{source:u,type:p}=c,g=h((v=c).markId)?t=>t&&t.mark.id()===v.markId:h(v.markName)?t=>t&&t.mark.name()===v.markName:h(v.type)?t=>t&&t.mark.markType===v.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:f(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),y=DN(l,this),_=fX(((t,e)=>{const n=u===OW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===LW&&(t=YW(0,t,e,p,LW));let s=!1;if((!i||i(t))&&(!g||g(e))&&m.length){const e=y.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var v;if(u===OW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||d(n)&&!n[i])}(this._eventConfig,OW,p))return this.addEventListener(p,_,FW),()=>{this.removeEventListener(p,_)}}else if(u===LW)return gj.addEventListener(p,_),this._eventListeners.push({type:p,source:gj,handler:_}),()=>{gj.removeEventListener(p,_);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===gj&&t.handler===_));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);f(e)?i.type=e:d(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:zW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?f(r)?r:r.user:zW,o=r&&a===r.user&&(s===r.element||h(s)&&h(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==zW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!h(document)&&document.body:this.container;return e?h(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new $Y(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new DX((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new DX((t=>t.id())),this._options.logger&&We.setInstance(this._options.logger),this.logger=We.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new YY,this.animate=new LX(this),this._morph=new IX,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{m(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[OW,LW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&gj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=lV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==tV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=gj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&gj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),EN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const jX=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{TN(e,t[e],!0)}))}))};jX(_V);const NX=["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 VX,WX,GX;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(VX||(VX={})),function(t){t.chart="chart",t.window="window"}(WX||(WX={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(GX||(GX={}));const UX=`${Kj}_waterfall_default_seriesField`,YX=`${Kj}_DEFAULT_DATA_INDEX`,XX=`${Kj}_DEFAULT_DATA_KEY`,$X=`${Kj}_DEFAULT_DATA_SERIES_FIELD`,KX=`${Kj}_DEFAULT_SERIES_STYLE_NAME`;var qX;!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.Built_In=99]="Built_In"}(qX||(qX={}));const ZX=`${Kj}_STACK_START`,JX=`${Kj}_STACK_END`,QX=`${Kj}_STACK_START_PERCENT`,t$=`${Kj}_STACK_END_PERCENT`,e$=`${Kj}_STACK_START_OffsetSilhouette`,i$=`${Kj}_STACK_END_OffsetSilhouette`,n$=`${Kj}_SEGMENT_START`,s$=`${Kj}_SEGMENT_END`;var r$,a$;!function(t){t[t.Axis_Grid=100]="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"}(r$||(r$={})),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"}(a$||(a$={}));const o$=["linear","radial","conical"],l$={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}},h$={innerRadius:0,outerRadius:1,startAngle:wN,endAngle:AN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var c$,d$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(c$||(c$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(d$||(d$={}));const u$={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,tickSize:Ij,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Ij/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Rj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Rj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},p$={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},g$={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},f$={name:"light",padding:12,fontFamily:Pj,colorScheme:{default:{dataScheme:[{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"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Yj,line:Nj,area:Dj,bar:Lj,bar3d:Oj,pie:Wj,pie3d:Gj,map:Vj,radar:Uj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:Fj,funnel3d:zj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:Xj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:jj,treemap:$j,sunburst:h$,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Rj},minLabel:{position:d$.end},maxLabel:{position:d$.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Rj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...g$,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...g$,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...g$},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...g$}},axis:u$,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10},maxHeight:"30%"},axisY:{label:{space:20},title:{space:20,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Rj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Rj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!0,background:{size:6,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:4,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:p$,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Bj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Rj,lineHeight:Bj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:12,fontWeight:"bold",fill:"#4E5969"},contentStyle:{fontSize:12,fill:"#4E5969"},panel:{visible:!0,fill:"#fff",stroke:"#ffffff",lineWidth:0,cornerRadius:3,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:"rgba(0, 0, 0, 0.1)",size:0,space:12}}}},m$=new Map([[f$.name,f$]]),y$=f$.name;class _${static instances=new Map;static registerInstance(t){_$.instances.set(t.id,t)}static unregisterInstance(t){_$.instances.delete(t.id)}static getInstance(t){return _$.instances.get(t)}static instanceExist(t){return _$.instances.has(t)}static forEach(t,e=[],i){const n=N(e);return _$.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class v${static themes=new Map;static _currentThemeName=y$;static registerTheme(t,e){t&&v$.themes.set(t,L({},v$.getDefaultTheme(),e))}static getTheme(t){return v$.themes.get(t)||v$.getDefaultTheme()}static removeTheme(t){return v$.themes.delete(t)}static themeExist(t){return v$.themes.has(t)}static getDefaultTheme(){return v$.themes.get(y$)}static setCurrentTheme(t){v$.themeExist(t)&&(v$._currentThemeName=t,_$.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return v$.getTheme(v$._currentThemeName)}static getCurrentThemeName(){return v$._currentThemeName}}v$.registerTheme(y$,m$.get(y$)),m$.forEach(((t,e)=>{e!==y$&&v$.registerTheme(e,t)}));const b$=(t,e,i)=>new He({defaultFontParams:{fontFamily:Ej,fontSize:14},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),x$=fB({});function S$(t,e){for(let i=0;it.key===e))}function A$(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const k$=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sP$(t.style(e,i,n,s)):M(t.style)||(e.style=P$(t.style)),!M(t.state)){const i={};Object.keys(t.state).forEach((e=>{l(t.state[e])?i[e]=(i,n,s,r)=>P$(t.state[e](i,n,s,r)):M(t.state[e])||(i[e]=P$(t.state[e]))})),e.state=i}return e}function T$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e,n,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function E$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e.rawValue,n,e,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function P$(t){return M(t)||t.angle&&(t.angle=Gt(t.angle)),t}var R$;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.image="image",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(R$||(R$={}));class B${static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Qa,fields:io,filter:pn,fold:eo};static dataParser={csv:fo,dsv:go,tsv:mo};static _layout={};static registerChart(t,e){B$._charts[t]=e}static registerSeries(t,e){B$._series[t]=e}static registerComponent(t,e){B$._components[t]=e}static registerMark(t,e){B$._marks[t]=e}static registerRegion(t,e){B$._regions[t]=e}static registerTransform(t,e){B$.transforms[t]=e}static registerLayout(t,e){B$._layout[t]=e}static createChart(t,e,i){if(!B$._charts[t])return null;return new(0,B$._charts[t])(e,i)}static createRegion(t,e,i){if(!B$._regions[t])return null;return new(0,B$._regions[t])(e,i)}static createSeries(t,e,i){if(!B$._series[t])return null;return new(0,B$._series[t])(e,i)}static createMark(t,e,i){if(!B$._marks[t])return null;const n=new(0,B$._marks[t])(e,i);return n.type===R$.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(B$._components)}static getComponentInKey(t){return B$._components[t]}static getLayout(t){return B$._layout[t]}static getSeries(t){return B$._series[t]}}const I$=(t,e,i)=>{const n=t.getRegionsInIds(N(e.layoutBindRegionID));return 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})}))},D$=(t,e)=>t===e||!h(t)&&!h(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),L$=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},O$="monotone",F$="linearClosed";var z$;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(z$||(z$={}));var H$;function j$(t){return"bottom"===t||"top"===t}function N$(t){return"left"===t||"right"===t}function V$(t){return"z"===t}function W$(t,e){return Uh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(H$||(H$={}));const G$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&I$(t,n,i)));return n.length?n:null},U$=t=>t.fieldX[0],Y$=t=>t.fieldY[0],X$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=$$(t,n,"x",U$);e&&o.push(e)})),a&&a.forEach((t=>{const e=$$(t,s,"y",Y$);e&&o.push(e)})),o.length?o:null},$$=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return K$(t,a,n)},K$=(t,e,i)=>{const n=t.getScale();if(!n||!jl(n.type))return null;if(h(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=L$(e,t,"cartesian",i??(j$(t.orient)?U$:Y$));return{index:s,value:e,axis:t,data:r}},q$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&I$(t,n,i)));return n.length?n:null},Z$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&jl(e.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=Il({x:1,y:0},d);u=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(u,r);const p=Dl(d),g=a[0]?.getScale(),f=g?.range();if((u-r?.[0])*(u-r?.[1])>0||(p-f?.[0])*(p-f?.[1])>0)return;const m=Math.abs(r[0]-r[1])/i.length/2,y=e.invert(u+m);if(h(y))return;let _=e.domain().findIndex((t=>t?.toString()===y.toString()));_<0&&(_=void 0);const v=L$(y,t,"polar",l);o.push({index:_,value:y,axis:t,data:v})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&jl(e.type)){const a=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let d=Il({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const u=Dl(c),p=r[0]?.getScale(),g=p?.range();if((d-g?.[0])*(d-g?.[1])>0||(u-i?.[0])*(u-i?.[1])>0)return;const f=e.invert(u);if(h(f))return;let m=e.domain().findIndex((t=>t?.toString()===f.toString()));m<0&&(m=void 0);const y=L$(f,t,"polar",l);o.push({index:m,value:f,axis:t,data:y})}})),o.length?o:null};class J${_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=X$(this._chart,{x:t,y:e})??[],n=Z$(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!jl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=K$(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var Q$;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Q$||(Q$={}));const tK={[Q$.dimensionHover]:class extends J${_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:WX.chart},callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:WX.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!D$(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[Q$.dimensionClick]:class extends J${constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:WX.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let eK=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(tK[t]){const e=new tK[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(tK[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class iK{_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(GX.vchart,[]),this._levelNodes.set(GX.chart,[]),this._levelNodes.set(GX.model,[]),this._levelNodes.set(GX.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),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=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const nK={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 sK{globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||WX.chart),n=this.getEventListeners(e.filter?.source||WX.chart);i.get(t)||i.set(t,new iK);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||WX.chart),s=this.getEventListeners(e?.filter?.source||WX.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||WX.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||WX.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(GX.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(GX.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(WX.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(WX.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if(l(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&C(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return nK[n]&&(n=nK[n]),(!t.type||n===t.type)&&(!c(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=c(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=c(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&c(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();c(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:C(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:c(t.id)?GX.model:GX.vchart:GX.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ft(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=gt(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=WX.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==GX.model&&i!==GX.mark||(n=e.type),e?.source&&(s=e.source),c(e?.id)&&(o=e?.id,i=GX.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case WX.chart:return this._viewBubbles;case WX.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case WX.chart:return this._viewListeners;case WX.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return NX.includes(t)||Object.values(hV).includes(t)||Object.values(VX).includes(t)}}function rK(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function aK(t,e,i){t.getParser(e)||t.registerParser(e,i)}const oK=new Map;let lK;function hK(t,e,i={type:"geojson",centroid:!0}){oK.has(t)&&Yo(`map type of '${t}' already exists, will be overwritten.`),lK||(lK=new jo,aK(lK,"geojson",Do),aK(lK,"topojson",Oo),rK(lK,"simplify",Qa));const n=new Vo(lK),s=L({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),oK.set(t,n)}function cK(t,e=!1){let i=e;return t.latestData instanceof Vo&&(i=!1),i?R(t.latestData):t.latestData.slice()}const dK=(t,e)=>0===t.length?[]:1===t.length?cK(t[0],e?.deep):t.map((t=>cK(t,e?.deep)));function uK(t,e,i){rK(e=e instanceof jo?e:t.dataSet,"copyDataView",dK);const n=new Vo(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function pK(t,e,i=[]){if(t instanceof Vo)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new Vo(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!f(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Xo("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const gK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)},logLevel:We.getInstance().level()}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!f(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&gj.getCancelAnimationFrame()(this._rafId),this._rafId=gj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const n=function(n,s){const r=s?.mark?.context??{},a=c(r.modelId)?r.modelId:null,o=c(r.markId)?r.markId:null,l=c(r.modelUserId)?r.modelUserId:null,h=c(r.markUserId)?r.markUserId:null,d={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,d)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===WX.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();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===WX.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(h(e))return;const i=e.id(),n=t.grammarType;h(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(h(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];c(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return c(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return Zo(this._option.mode)?globalThis:this.getStage()?.window}}async function SK(t){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){console.error("getCanvasDataURL",t)}return t.toDataURL()}class wK{id=el();static useChart(t){t.forEach((t=>B$.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>B$.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>B$.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>B$.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>B$.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){B$.registerTransform(t,e)}static registerMap(t,e,i){hK(t,e,i)}static unregisterMap(t){!function(t){oK.has(t)?oK.delete(t):Yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,oK.get(e);var e}static hideTooltip(t=[]){_$.forEach((t=>t?.hideTooltip?.()),t)}static getLogger(){return We.getInstance()}static InstanceManager=_$;static ThemeManager=v$;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=L(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,poptip:a,...o}=this._option;i&&(this._container=f(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=v$.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new xK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,pluginList:!1!==a?["poptipForText"]:[],...o,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new sK(this,this._compiler),this._event=new eK(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!Zo(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(VX.initialized,{}),_$.registerInstance(this)):Xo("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=Jh(f(t)?JSON.parse(t):t))}_initData(){if(h(this._dataSet))return void Yo("dataSet is not initialized");const t=N(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Xo("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=gt(((...t)=>{const{width:e,height:i}=en(this._container,qj,Zj),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof jo?t:new jo,aK(this._dataSet,"dataview",Fo),aK(this._dataSet,"array",cn),rK(this._dataSet,"stackSplit",gK),rK(this._dataSet,"copyDataView",dK);for(const t in B$.transforms)rK(this._dataSet,t,B$.transforms[t]);for(const t in B$.dataParser)aK(this._dataSet,t,B$.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return c(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),oK.clear(),lK=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,_$.unregisterInstance(this)}async updateData(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):m(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(f(t)&&(t=JSON.parse(t)),e&&(t=L({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=Jh(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}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)}_updateCurrentTheme(){var t;f(this._spec?.theme)?(this._currentTheme=L({},v$.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=L({},v$.getTheme(this._currentThemeName),this._spec?.theme??{}),t=L({},this._currentTheme.component?.poptip),L(xG.poptip,bG,t)}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return v$.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===un.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(c(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await SK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!Zo(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await 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):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(c(this._container))return this._container;let t;return t=f(this._canvas)?document?.getElementById(this._canvas):this._canvas,c(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(M(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),Zh(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||h(t)||M(e))return null;if(!m(t)){const{axisId:n,axisIndex:s}=e;let r;if(c(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):c(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Yo("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?Zh(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!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"}(yK||(yK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(_K||(_K={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(vK||(vK={}));class AK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){h(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,L({},AK.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]}getMarksInType(t){const e=N(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]))))}}class kK{event;interaction;_option;_marks=new AK;_markReverse=new AK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){M(t.stateStyle[yK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),M(t.stateStyle[yK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Q$.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=m(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(yK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(yK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class MK{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class CK extends MK{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=a$.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Kh(qh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=h(t.minHeight)?null:$h(t.minHeight,e.height,e),this._maxHeight=h(t.maxHeight)?null:$h(t.maxHeight,e.height,e),this._minWidth=h(t.minWidth)?null:$h(t.minWidth,e.width,e),this._maxWidth=h(t.maxWidth)?null:$h(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:$h(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:$h(t.height,e.height,e)},{height:9}),h(t.offsetX)||(this.layoutOffsetX=$h(t.offsetX,e.width,e)),h(t.offsetY)||(this.layoutOffsetY=$h(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{h(this._spec[i])||(e[i]=$h(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};h(n)||(r.width-=n),h(s)||(r.width-=s),h(e)||(r.height-=e),h(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):(h(n)?h(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,h(e)?h(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){b(t)&&(this._layoutStartPoint.x=t),b(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){b(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),b(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}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={...t};return this._layoutRectLevelMap.width<9?(h(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),h(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(h(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),h(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class TK extends MK{grammarType;id=el();_product;getProduct(){if(c(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return c(e)&&c(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){c(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(c(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(c);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class EK extends TK{grammarType=mK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}c(this._value)&&this._product.value(this._value),c(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class PK extends MK{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new EK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class RK extends PK{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(L(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class BK extends RK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class IK extends CK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new AK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=el(),this._originalSpec=t,this._spec=Qh(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new eK(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new BK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Qh(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(h(t)||h(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=L({},e?.[N(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),m(t))return t.map((t=>d(t)&&!l(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];d(n)&&!l(n)&&(Fh(n)?e[i]=Oh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){c(t)&&c(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!c(t)||!c(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${Kj}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=B$.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const DK={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},LK={symbol:function(t,e){return"shape"===t?DK[e]??e:e}};const OK={};Object.values(yK).forEach((t=>{OK[t]=!0}));const FK={[yK.STATE_HOVER]:yK.STATE_HOVER_REVERSE,[yK.STATE_SELECTED]:yK.STATE_SELECTED_REVERSE,[yK.STATE_DIMENSION_HOVER]:yK.STATE_DIMENSION_HOVER_REVERSE};function zK(t){return FK[t]}class HK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!M(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=zK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=zK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=zK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=zK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class jK extends RK{id=el();stateKeyToSignalName=t=>`${Kj}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===fK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===fK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}}}}class NK extends IK{static type="region";modelType="region";type=NK.type;_series=[];layoutType="region";layoutZIndex=r$.Region;animate;interaction=new HK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler})),c(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:R$.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",qX.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",qX.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:R$.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:R$.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",qX.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(r$.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",qX.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",qX.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",qX.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):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=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||N(t.userId).includes(e.userId))&&(!c(t.specIndex)||!e.getSpecIndex||N(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||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(VX.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new kK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in _K)M(t.stateStyle[_K[e]])||this.interaction.registerMark(_K[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class VK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const WK=[R$.line,R$.area,"trail"];function GK(t){return WK.includes(t)}class UK extends RK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),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];c(n.domain)&&(s.domain=n.domain),c(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=o(GK)?n:!t.mark||GK(t.mark.markType);let s=!1,r=!1;if(c(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!OK[t])).map((t=>[t,10])),n=!t.mark||GK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(m(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Kj)));n=t.datums.some((t=>i&&m(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(d(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Kj)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(zl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class YK extends TK{grammarType=mK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();h(t)||(h(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class XK extends YK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return c(t)?t:`${Kj}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct(t)}}class $K extends TK{grammarType=mK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=r$.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){c(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){h(this._data)&&this.initMarkData({...this._option,mark:this}),c(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new UK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new eK(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new XK(t)}stateKeyToSignalName(t){return`${Kj}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(c(e)&&this.removeProduct());if(c(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),h(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(h(this._data))return;this._data.compile();const t=this._data.getProduct();c(this._product)&&c(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[yK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!l(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(hV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===fK.appear&&this.runAnimationByState(fK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),LK[a]?LK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class KK extends $K{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(c(t.id)&&(this._userId=t.id),o(t.interactive)&&(this._interactive=t.interactive),c(t.zIndex)&&this.setZIndex(t.zIndex),o(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(v(t))return Sl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Sl)),t}return"function"==typeof t?(e,i,n,s)=>Sl(t(e,i,n,s)):t}isUserLevel(t){return[qX.User_Mark,qX.User_Series,qX.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];h(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){this.stateStyle[i]?.[t]&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;c(r)&&r<=n&&L(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return f(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=Nh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;s=this.stateStyle[i]?.[t]?this.stateStyle[i][t]:this.stateStyle.normal[t];let r=this._computeStateAttribute(s,t,e,i,n);return l(s?.postProcess)&&(r=s.postProcess(r,e,this._attributeContext,n,this.getDataView())),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,r):r}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):o$.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):Hl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",qX.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=l(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,qX.User_Mark,e)}else this.setStyle(i,t,qX.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let h=s,d=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(h=t),d||(d=e)}const u=Dh(Ih(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),p={},g={...l$[n],...a};return Object.keys(g).forEach((t=>{const n=g[t];"stops"===t?p.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??h?.scale(e[d]);return l(s)&&(a=s(e,this._attributeContext,i,o)),c(n)&&(a=Uo.SetOpacity(a,n)),{offset:l(r)?r(e,this._attributeContext,i,o):r,color:a||u[0]}})):l(n)?p[t]=n(e,this._attributeContext,i,o):p[t]=n})),p.gradient=n,p}_computeThresholdAttr(t){return(new Th).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class qK extends KK{static type=R$.group;type=qK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Yo("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?(Yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class ZK extends KK{static type=R$.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(tV.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}class JK extends KK{static type=R$.image;type=JK.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}wK.useMark([ZK,qK,JK]),B$.registerRegion("region",NK),B$.registerLayout("base",VK);var QK,tq,eq;We.getInstance(Ve.Error),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(QK||(QK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(tq||(tq={}));class iq{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Nh("colorOrdinal"):Nh(t.type)),e?(m(t.range)&&e.range(t.range),m(t.domain)&&(nl(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),nl(n.domain)?e.reRender=!0:z(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)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{nl(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{S$(e,[{key:t,operations:zl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&S$(e,[{key:i.field,operations:zl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!nl(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=zl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{zl(e.type)?(h(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),h(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;zl(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){if(!h(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(zl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(zl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));zl(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(h(t.field)||!h(t.changeDomain)&&"none"!==t.changeDomain&&!h(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class nq{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(VX.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][JX]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[JX],s>=0?(t[ZX]=e,e+=t[JX],t[JX]=e):(t[ZX]=i,i+=t[JX],t[JX]=i)})),t.values.forEach((t=>{s=t[JX];const r=s>=0?e:i;n=s>=0?1:-1,t[QX]=Math.min(1,t[ZX]/r)*n,t[t$]=Math.min(1,t[JX]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[JX]=function(t){if(b(t))return t;const e=+t;return b(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class sq extends MK{type="chart";id=el();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:qj,height:Zj};getLayoutRect(){return this._layoutRect}_viewRect={width:qj,height:Zj};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:qj,y2:Zj};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=qh(t.padding??this._theme?.padding),this._event=new eK(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new nq(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),E(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=B$.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=pK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),c(t.regionId)?i=this.getRegionsInUserId(t.regionId):c(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&N(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=B$.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(B$.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(VX.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(VX.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>N(t).some((t=>c(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof IK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof KK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof KK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(c(t)&&c(e))this._canvasRect={width:t,height:e};else{let i=qj,n=Zj;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=en(this._option.container,qj,Zj);i=t,n=e}else if(r&&Zo(this._option.mode)){let t;t=f(r)?document?.getElementById(r):r;const{width:e,height:s}=en(t,qj,Zj);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;if(m(t))e.range=t.map((t=>Oh(t,this._theme?.colorScheme)));else{const i=t;Object.prototype.hasOwnProperty.call(i,"type")&&(e.type=i.type),Object.prototype.hasOwnProperty.call(i,"domain")&&(e.domain=i.domain),Object.prototype.hasOwnProperty.call(i,"range")&&(e.range=i.range),Object.prototype.hasOwnProperty.call(i,"specified")&&(e.specified=i.specified)}}return e.range?.length||(e.range=Ih(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new iq(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Ih(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&N(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};m(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Kh(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}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(M(t[n]))continue;const s=t[n];let r={stateValue:n};r=l(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(yK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(yK.STATE_HOVER,!0,t,e,i)}initEvent(){[VX.dataZoomChange,VX.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(hV.AFTER_MARK_RENDER_END,e)};this._event.on(hV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||l(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===Q$.dimensionHover||s===Q$.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===un.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===un.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class rq extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}function aq(t){t.crosshair=N(t.crosshair||{}).map((e=>L({[t.direction===Gh.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(eq||(eq={}));const oq=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!h(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!h(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!h(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=c,(h(o)||o===UX)&&(t[UX]=c?l.total:+t[n]>=0?l.increase:l.decrease)})),f={...i,lastIndex:t},d.push(i)})),d},lq=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},hq=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:cq(t.map((t=>t.latestData)).flat(),e.fields,i)}};function cq(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>cq(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class dq{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new Vo(e instanceof jo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),rK(e,"dimensionTree",hq),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const uq=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},pq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class gq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new AK;_markReverse=new AK;constructor(t,e){this._spec=t,this._option=e,this.event=new eK(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(yK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(yK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(N(i).forEach((e=>{t.on(e,{level:GX.chart},this.onHover)})),n&&"none"!==n&&N(n).forEach((e=>{t.on(e,{level:GX.vchart,source:WX.chart},this.onUnHover)}))),s&&(N(r).forEach((e=>{t.on(e,{level:GX.mark},this.onSelect)})),a&&"none"!==a&&N(a).forEach((e=>{t.on(e,{level:GX.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=pq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;o(i)?this._hover.enable=i:d(i)&&(this._hover.enable=!0,this._hover=L(this._hover,i));const n=this._spec.select;o(n)?this._select.enable=n:d(n)&&(this._select.enable=!0,this._select=L(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,yK.STATE_HOVER)||this.interaction.getEventElement(yK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(yK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(yK.STATE_HOVER,t.item),this.interaction.reverseEventElement(yK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(yK.STATE_HOVER);this.interaction.clearEventElement(yK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(yK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,yK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(yK.STATE_SELECTED);this.interaction.clearEventElement(yK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(yK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(yK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(yK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(yK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(yK.STATE_SELECTED);const e=this.interaction.getEventElementData(yK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class fq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const mq=(t,e)=>c(e)?t.map((t=>e[t])):void 0,yq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),_q=t=>!h(t)&&(m(t)?t.length>0&&t.every(c):Object.keys(t).length>0);function vq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(c(s.regionId)?[s.regionId]:void 0,c(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=c(s)?t[s]:void 0,a=c(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=mq(i,t);let d=mq(n,t);const u=_q(d),p=!u&&c(s)&&h(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,c=i.map(((t,e)=>[t,e])).filter((([,t])=>h(l?.[t])));let g=[l??[]];c.length>0&&c.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];g.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),g=s})),g.forEach((l=>{if(p){const r=t.getViewData()?.latestData.filter(yq(i,l));a.forEach((a=>{const c=r.find((t=>t[s]===a));if(d=mq(n,c),!_q(d))return;const p=t.dataToPosition(c);h(p)||isNaN(p.x)||isNaN(p.y)||o.push({pos:p,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===tq.pie){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToCentralPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}else{const t=e;if(p){const c=t.getViewData()?.latestData.filter(yq(i,l)),p=c.find((t=>t[s]===r));a.forEach((r=>{if(d=mq(n,p),!_q(d))return;const a=t.dataToPosition(p);h(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),d=r.getLayoutStartPoint(),u=r.getLayoutRect(),p=n.globalInstance.getContainer(),g={x:0,y:0,...p?nn(p):{}},f=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>yq(e,i)(t)&&yq(n,s)(t)&&(h(r)||yq([r],[a])(t))));return o},m=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),u.width),y:Math.min(Math.max(t.y,0),u.height)}))(t),i=s.x??d.x+e.x,n=s.y??d.y+e.y;return{canvasX:i,canvasY:n,clientX:g.x+i,clientY:g.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>f(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:WX.chart,event:m({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...f(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:WX.chart,event:m(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),l}return"none"}const bq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return c(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function xq(t){return h(t.mark)&&h(t.model)&&h(t.datum)}class Sq extends fq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];c(i)&&(e[t]={...i,title:c(i.title)?l(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:c(i.content)?l(i.content)?i.content:N(i.content).map((t=>l(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=bq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:c(e)?N(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of N(e)){const e=this.series.getSeriesStyle(t)?.(i);if(c(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const wq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},Aq={min:t=>t===wq.min()?0:t,max:t=>t===wq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===wq.min()?0:t,"array-max":t=>t===wq.max()?0:t};const kq={min:function(t,e){return il(e)?Math.min(t,e):t},max:function(t,e){return il(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.max(t,...i)}},Mq=(t,e)=>{const i={};let n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;n=S$([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!h(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=wq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=kq[n](i[t.key][n],s)})),i[t.key][n]=Aq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},Cq=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>il(t[s])));else if("zero"===n)return t.forEach((t=>{il(t[s])||(t[s]=0)})),t;return t};class Tq extends YK{_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const Eq=`${Kj}_HIERARCHY_DEPTH`,Pq=`${Kj}_HIERARCHY_ROOT`,Rq=`${Kj}_HIERARCHY_ROOT_INDEX`,Bq=()=>({keyMap:new Map});function Iq(t,e,i){t&&(this._seriesField||(t[$X]=this.getSeriesKeys()[0]),t[YX]=e,t[XX]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function Dq(t,e,i,n=0,s,r){void 0===r&&(r=e),Iq.bind(this)(t,e,i),t[Eq]=n,t[Pq]=s||t[this.getCategoryField()],t[Rq]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>Dq.bind(this)(e,n,i,t[Eq]+1,t[Pq],r)))}class Lq extends IK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[QK.label]:{name:QK.label,type:R$.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(VX.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&c(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(VX.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(h(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),o(this._spec.stack)&&(this._stack=this._spec.stack),o(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),o(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),c(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=uK(this._rawData,this._dataSet,{name:`${Kj}_series_${this.id}_viewDataFilter`});const t=uK(this._viewDataFilter,this._dataSet,{name:`${Kj}_series_${this.id}_viewData`});this._data=new Tq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(rK(this._option.dataSet,"invalidTravel",Cq),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new dq(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${Kj}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){rK(this._dataSet,"dimensionStatistics",Mq);const n=new Vo(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=S$(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&S$(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${Kj}_series_${this.id}_viewStackData`;this._viewStackData=new Vo(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(h(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(f(t))return e[t];if(m(t)&&t.every((t=>f(t))))return t.map((t=>e[t])).join("-");if(l(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(VX.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(VX.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(VX.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(VX.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(VX.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||h(e)?[]:f(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:R$.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||h(t.dataId)&&h(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new gq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??$X;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:KX,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,KX)}))}afterInitMark(){this.event.emit(VX.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",qX.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new Sq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??$X,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??$X}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=L({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:l,dataProductId:d,parent:u,isSeriesMark:p,dataStatistics:g,depend:f,label:m,progressive:y,support3d:_=this._spec.support3d||!!this._spec.zField,morph:v=!1}=e,b=super._createMark(t,{key:i??this._getDataIdKey(),support3d:_,dataStatistics:g??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(c(b)){this._marks.addMark(b),p&&(this._seriesMark=b),h(u)?this._rootMark?.addMark(b):!1!==u&&u.addMark(b),h(l)?(b.setDataView(this.getViewData(),this.getViewDataProductId()),b.setSkipBeforeLayouted(!0)):!1!==l&&b.setDataView(l,d),o(s)&&b.setSkipBeforeLayouted(s),c(f)&&b.setDepend(...N(f)),c(m)&&b.setLabelSpec(m);const t=this.getSpec()||{};b.setMorph(v),b.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),b.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),h(y)||b.setProgressiveConfig(y),h(n)||b.setGroupKey(n),this.initMarkStyleWithSpec(b,L({},r,a||t[b.name]))}return b}_getDataIdKey(){return super._getDataIdKey()??XX}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==JX&&t!==t$&&t!==ZX&&t!==QX||(t=this.getStackValueField()),A$(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=B$.getSeries(this.type);return Object.values(t.mark??{})}return t}}class Oq extends Lq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=N(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=N(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&N(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=Gh.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((e=>{const i={key:e,operations:[]};zl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((e=>{const i={key:e,operations:[]};zl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};zl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===Gh.vertical?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction===Gh.vertical?(this.setFieldY(JX),this.setFieldY2(ZX)):(this.setFieldX(JX),this.setFieldX2(ZX))}setValueFieldToPercent(){this.direction===Gh.vertical?(this.setFieldY(t$),this.setFieldY2(QX)):(this.setFieldX(t$),this.setFieldX2(QX))}setValueFieldToStackOffsetSilhouette(){this.direction===Gh.vertical?(this.setFieldY(i$),this.setFieldY2(e$)):(this.setFieldX(i$),this.setFieldX2(e$))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Go(t.xField,i)&&Go(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),c(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(this._spec?.x2Field),this.setFieldY2(this._spec?.y2Field),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{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)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}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._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===Gh.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===Gh.vertical?N(this._spec.yField??this.fieldY):N(this._spec.xField??this.fieldX)}}const Fq=(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};const zq={type:"clipIn"},Hq={type:"fadeIn"};function jq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Hq;default:return zq}}function Nq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=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 Vq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:Nq(t,e)}),Wq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:Nq(t,e)}),Gq={type:"fadeIn"},Uq={type:"growCenterIn"};function Yq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Gq;case"scaleIn":return Uq;default:return Vq(t)}}const Xq={type:"clipIn"},$q={type:"fadeIn"};function Kq(t,e){switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return $q;default:return Xq}}function qq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Zq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:qq(t,!0,fK.appear)}),Jq={type:"fadeIn"},Qq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:qq(t,!0,fK.enter)}),tZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:qq(t,!0,fK.exit)}),eZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:qq(t,!0,fK.exit)});function iZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Jq;case"growRadius":return Zq({...t,growField:"radius"});default:return Zq({...t,growField:"angle"})}}const nZ={type:"fadeIn"};function sZ(t,e){return"fadeIn"===e?nZ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function rZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aZ=t=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:rZ(t)}),oZ={type:"fadeIn"};function lZ(t,e){return!1===e?{}:"fadeIn"===e?oZ:(t=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:rZ(t)}))(t)}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=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const uZ=(t,e)=>({custom:BC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class pZ extends lC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;l(r)&&l(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);b(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);b(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class gZ extends PC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Ht(d,u,p,g);return f.defined=e.defined,f}}const fZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},mZ={type:"fadeIn"},yZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),_Z=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),vZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function bZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mZ;case"growAngle":return fZ({...t,growField:"angle"});default:return fZ({...t,growField:"radius"})}}const xZ={type:"fadeIn"},SZ={type:"growCenterIn"};function wZ(t,e){switch(e){case"fadeIn":return xZ;case"scaleIn":return SZ;default:return Vq(t,!1)}}const AZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},kZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),MZ={type:"fadeIn"},CZ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function TZ(t,e){return"fadeIn"===e?MZ:kZ(t)}const EZ=t=>({custom:DC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),PZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},RZ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===QN.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},IZ=(t,e,i)=>{if(M(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},DZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),LZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},OZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),FZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},zZ={type:"fadeIn"};function HZ(t){return!1===t?{}:zZ}const jZ={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"}},NZ={bar:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),bar3d:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),line:(t,e)=>({appear:Kq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:PC,duration:jZ.update.duration,easing:jZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:jq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),pie3d:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),rose:(t,e)=>({appear:bZ(t,e),enter:yZ(t),exit:_Z(t),disappear:vZ(t)}),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:cZ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:gZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:dZ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:pZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarGroup:(t,e)=>({appear:uZ(t,"in"),disappear:uZ(t,"out")}),circularProgress:(t,e)=>({appear:sZ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:AZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:lZ(t,e),enter:{type:"grow"},disappear:aZ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:IC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:IC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:EZ(t)}),rangeColumn:(t,e)=>({appear:TZ(t,e),enter:kZ(t),exit:CZ(t),disappear:CZ(t)}),waterfall:(t,e)=>({appear:wZ(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:PZ(0,e),enter:DZ(t),exit:OZ(t),disappear:OZ(t)}),circlePacking:(t,e)=>({appear:FZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:HZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:wU},update:{custom:SU},exit:{custom:LC}})},VZ=["appear","enter","update","exit","disappear","normal"];function WZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=l(n)?n(t,s,r):b(n)?n:0;let h=l(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(o+h))},delete t.oneByOne,t}function YZ(t){return t?.[YX]}function XZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function $Z(t){return!function(t){return c(t.timeSlices)}(t)&&c(t.channel)}class KZ extends KK{static type=R$.rect;type=KZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class qZ extends KK{static type=R$.text;type=qZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}wK.useMark([KZ,qZ]);class ZZ extends Oq{static type=tq.bar;type=tq.bar;_barMarkName=QK.bar;_barMarkType=R$.rect;static mark={...Lq.mark,[QK.bar]:{name:QK.bar,type:R$.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...ZZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e)},"normal",qX.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.bar(t,e),GZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Fq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Fq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Fq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class JZ extends KK{static type=R$.rule;type=JZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}wK.useMark([JZ]);class QZ extends ZZ{static type=tq.waterfall;type=tq.waterfall;static mark={...ZZ.mark,[QK.leaderLine]:{name:QK.leaderLine,type:R$.rule},[QK.stackLabel]:{name:QK.stackLabel,type:R$.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],h(this._seriesField)&&(this._seriesField=UX)}getSeriesKeys(){return this._seriesField===UX?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),rK(this._dataSet,"waterfallFillTotal",lq),rK(this._dataSet,"waterfall",oq),(h(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=uK(this.getViewData(),this._dataSet,{name:`${Kj}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new Tq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:ZX,endAs:JX,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(WZ(NZ.waterfall(t,e),GZ(QK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:i}))}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(QZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(QZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===Gh.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):Vh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===Gh.vertical?Vh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===Gh.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",qX.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",qX.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===Gh.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const tJ=`${Kj}_BOX_PLOT_OUTLIER_VALUE`;var eJ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(eJ||(eJ={}));const iJ=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];m(e)||(e=[e]),i.push(...e.map((e=>{const i={[tJ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class nJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(eJ.OUTLIER),value:this.getContentValue(eJ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(eJ.MAX),value:this.getContentValue(eJ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q3),value:this.getContentValue(eJ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MEDIAN),value:this.getContentValue(eJ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q1),value:this.getContentValue(eJ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MIN),value:this.getContentValue(eJ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.SERIES_FIELD),value:this.getContentValue(eJ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return this.series.getOutliersField();if(t===eJ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case eJ.MIN:return this.series.getMinField();case eJ.MAX:return this.series.getMaxField();case eJ.MEDIAN:return this.series.getMedianField();case eJ.Q1:return this.series.getQ1Field();case eJ.Q3:return this.series.getQ3Field();case eJ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return e[tJ];if(t===eJ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case eJ.MIN:return e[this.series.getMinField()];case eJ.MAX:return e[this.series.getMaxField()];case eJ.MEDIAN:return e[this.series.getMedianField()];case eJ.Q1:return e[this.series.getQ1Field()];case eJ.Q3:return e[this.series.getQ3Field()];case eJ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>c(t[tJ])}class sJ extends KK{static type=R$.boxPlot;type=sJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?($N("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(iW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),qV("barBoxplotScaleIn",ZV(eW)),qV("barBoxplotScaleOut",JV(eW))):($N("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(tW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),qV("boxplotScaleIn",ZV(QV)),qV("boxplotScaleOut",JV(QV)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class rJ extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:z$.circle,fill:void 0,lineWidth:0}}}class aJ extends rJ{static type=R$.symbol;type=aJ.type}wK.useMark([sJ,aJ]);class oJ extends Oq{static type=tq.boxPlot;type=tq.boxPlot;static mark={...Lq.mark,[QK.boxPlot]:{name:QK.boxPlot,type:R$.boxPlot},[QK.outlier]:{name:QK.outlier,type:R$.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};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=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(oJ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(oJ.mark.outlier,{progressive:t,key:YX,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:v(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===Gh.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Vh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Vh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Vh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Vh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Vh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},yK.STATE_NORMAL,qX.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),y:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,yK.STATE_NORMAL,qX.Series)}}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"foldOutlierData",iJ),rK(this._dataSet,"addVChartProperty",uq);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===Gh.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._outlierDataView=new Tq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===Gh.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===Gh.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===Gh.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(NZ.boxPlot()),i=this._initAnimationSpec(GZ(QK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(WZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(WZ(NZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new nJ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class lJ{setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(hJ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",qX.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:F$},"normal",qX.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===O$?t===Gh.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",qX.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(hJ.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series))}}const hJ={[QK.point]:{name:QK.point,type:R$.symbol},[QK.line]:{name:QK.line,type:R$.line}};class cJ extends KK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((c=>{const d=t[c];if(h(d)||s.includes(c))return;a&&r.includes(c)&&(Hl(d?.type)||d?.scale||l(d))&&(o=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class dJ extends cJ{static type=R$.line;type=dJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===tq.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}wK.useMark([dJ,aJ,qZ]);class uJ extends Oq{static type=tq.line;type=tq.line;_invalidType="break";static mark={...Lq.mark,...hJ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}j(uJ,lJ);class pJ extends KK{static type=R$.rect3d;type=pJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}wK.useMark([pJ,qZ]);class gJ extends ZZ{static type=tq.bar3d;type=tq.bar3d;static mark={...Lq.mark,[QK.bar3d]:{name:QK.bar3d,type:R$.rect3d}};_barMarkName=QK.bar3d;_barMarkType=R$.rect3d}function fJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===Gh.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===Gh.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===Gh.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===Gh.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",qX.Series)}class mJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class yJ extends ZZ{static type=tq.rangeColumn;type=tq.rangeColumn;_barMarkType=R$.rect;_barName=tq.bar;static mark={...ZZ.mark,[QK.minLabel]:{name:QK.minLabel,type:R$.text},[QK.maxLabel]:{name:QK.maxLabel,type:R$.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(yJ.mark.bar,{morph:XZ(this._spec.animation,this._spec.morph,GZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===c$.bothEnd?void 0:L({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===c$.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(yJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(yJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});fJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});fJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===Gh.horizontal?(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.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===Gh.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.rangeColumn({direction:this.direction},e),GZ(QK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new mJ(this)}}wK.useMark([pJ]);class _J extends yJ{static type=tq.rangeColumn3d;type=tq.rangeColumn3d;_barMarkType=R$.rect3d;_barName=tq.bar3d}class vJ extends cJ{static type=R$.area;type=vJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}wK.useMark([dJ,vJ,qZ,aJ]);class bJ extends Oq{static type=tq.area;type=tq.area;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(bJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Vh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Vh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(WZ(NZ.area(t,e),GZ(QK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}}j(bJ,lJ);class xJ extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class SJ extends bJ{static type=tq.rangeArea;type=tq.rangeArea;static mark={...bJ.mark};initMark(){this._areaMark=this._createMark(SJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new xJ(this)}}Ar();const wJ={},AJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function kJ(t,e){t&&f(t)||al("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(wJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Ar().projection(n),n.copy=n.copy||function(){const t=i();return AJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),wJ[i]||null}const MJ={albers:Wr,albersusa:function(){var t,e,i,n,s,r,a=Wr(),o=Vr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Vr().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(MJ).forEach((t=>{kJ(t,MJ[t])}));const CJ="Feature",TJ="FeatureCollection";function EJ(t){const e=N(t);return 1===e.length?e[0]:{type:TJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===TJ?t.features:N(t).filter((t=>!h(t))).map((t=>t.type===CJ?t:{type:CJ,geometry:t}))}(e))),[])}}const PJ=AJ.concat(["pointRadius","fit","extent","size"]);function RJ(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{PJ.includes(n)&&(i=i.concat(LN(t[n],e)))})),i):i}const BJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(h(i))for(let i=0;i(l(t),t)))};class IJ extends Lq{type=tq.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;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){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(h(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(h(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return h(r)||isNaN(r.x)||isNaN(r.y)?null:r}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){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Kj}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const DJ=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{t[YX]=i,e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class LJ extends Sq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class OJ extends KK{static type=R$.path;type=OJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var FJ,zJ,HJ;wK.useMark([OJ,qZ]),FJ="projection",zJ=class extends CW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return h(this.spec.pointRadius)||this.detach(LN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(LN(t,this.view)),this.commit(),this}size(t){return h(this.spec.size)||this.detach(LN(this.spec.size,this.view)),this.spec.size=t,this.attach(LN(t,this.view)),this.commit(),this}extent(t){return h(this.spec.extent)||this.detach(LN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(LN(t,this.view)),this.commit(),this}fit(t){return h(this.spec.fit)||this.detach(LN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(LN(t,this.view)),this.commit(),this}configure(t){return this.detach(RJ(this.spec,this.view)),h(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(RJ(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=kJ((t||"mercator").toLowerCase());return e||al("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),AJ.forEach((t=>{var i,n,s;h(this.spec[t])||(i=this.projection,n=t,s=FN(this.spec[t],e,kJ),l(i[n])&&i[n](s))})),h(this.spec.pointRadius)||this.projection.path.pointRadius(FN(this.spec.pointRadius,e,kJ)),!(h(this.spec.fit)||h(this.spec.extent)&&h(this.spec.size))){const t=EJ(FN(this.spec.fit,e,kJ));this.spec.extent?this.projection.fitExtent(FN(this.spec.extent,e,kJ),t):this.spec.size&&this.projection.fitSize(FN(this.spec.size,e,kJ),t)}return this.projection}output(){return this.projection}},HJ="projections",yX[FJ]={grammarClass:zJ,specKey:null!=HJ?HJ:FJ};class jJ extends IJ{static type=tq.map;type=tq.map;static mark={...Lq.mark,[QK.area]:{name:QK.area,type:R$.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(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.map)throw new Error(`map type '${this.map}' is not specified !`);if(!oK.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),rK(this._dataSet,"copyDataView",dK),rK(this._dataSet,"map",DJ),rK(this._dataSet,"lookup",BJ);const t=oK.get(this.map);if(!t)throw Error("no valid map data found!");const e=new Vo(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??$X,XX],as:[this.nameField,this.valueField,this._seriesField??$X,XX]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new Tq(this._option,e)}initMark(){this._pathMark=this._createMark(jJ.mark.area,{morph:XZ(this._spec.animation,this._spec.morph,GZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(jJ.mark.label,{parent:this.getRegion().getGroupMark(),skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>c(t[this._seriesField??$X])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??$X]):this._spec?.defaultFillColor,path:this.getPath.bind(this)},"normal",qX.Series),t.setPostProcess("fill",(t=>c(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",qX.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(WZ(NZ.path(),GZ(QK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initTooltip(){this._tooltipHelper=new LJ(this)}getPath(t){const e=this._areaCache.get(t[YX]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t[YX],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===R$.path?n.group.getGroupGraphicItem().scale(e,e,i):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===R$.path?i.group.getGroupGraphicItem().translate(e[0],e[1]):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return b(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]?t[this.nameField]:t.properties?.[this._nameProperty]?this._spec.nameMap?this._spec.nameMap[t.properties[this._nameProperty]]??"":t.properties[this._nameProperty]??"":""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return YX}}class NJ extends Lq{coordinate="polar";_outerRadius=kN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=c(t)?N(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=c(t)?N(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=N(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(h(t)||h(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(t)),n=this.radiusAxisHelper.dataToPosition(N(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};zl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};zl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),c(this._spec.radius)&&(this._outerRadius=this._spec.radius),c(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Go(t.angleField,i)&&Go(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const VJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=xl(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}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},WJ=(t,e)=>{const i=t[0].latestData;return new UJ(e.series,i).updateLabels()};class GJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class UJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=b$(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[eN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:c}=n;if("inside"!==t?.position){const t=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_HOVER),n.middleAngle),i=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_SELECTED),n.middleAngle),a=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_NORMAL),n.middleAngle);s[cN]=a.x,s[dN]=a.y,s[lN]=t.x,s[hN]=t.y,s[mN]=i.x,s[yN]=i.y,s[uN]=l.x,s[pN]=l.y,s[gN]=c.x,s[fN]=c.y,s[nN]=r.y-o.height/2}else s[nN]=r.y;return s[Qj]=this._computeAlign(n),s[Jj]=Math.max(a,0),s[eN]=n.labelVisible&&!h(n.labelText),s[iN]=r.x,s[tN]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=kl(e.x,e.y,f,t.middleAngle),t.labelLimit=p,at(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=Ml(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=Ml(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(ot(t.pointB.x,n+r)||at(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.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 r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?bl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=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}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?h(i)||"auto"===i?"edge"===n?Ml(t.quadrant)?"left":"right":Ml(t.quadrant)?"right":"left":i:h(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=h(n)||h(t[n])||h(t[s]);return l(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class YJ extends KK{type=XJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),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{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+Al({angle:e[_N],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class XJ extends YJ{static type=R$.arc;type=XJ.type}wK.useMark([OJ,qZ,XJ]);class $J extends NJ{_pieMarkName=QK.pie;_pieMarkType=R$.arc;static mark={...Lq.mark,[QK.pie]:{name:QK.pie,type:R$.arc},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=xN;_endAngle=SN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=c(t),r=c(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}}(c(this._spec?.startAngle)?Sl(this._spec.startAngle):this._startAngle,c(this._spec?.endAngle)?Sl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=c(this._spec?.padAngle)?Sl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;rK(this._dataSet,"pie",VJ),rK(this._dataSet,"arcLabel",WJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:rN,asEndAngle:aN,asRatio:sN,asMiddleAngle:_N,asRadian:bN,asQuadrant:vN,asK:oN}},!1);const e=new Vo(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${Kj}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new Tq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...$J.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark($J.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark($J.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Wh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Wh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this)},void 0,qX.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(VX.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){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}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${Kj}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${Kj}_ARC_LABEL_${e}_AY`])} L${Math.round(t[uN])},${Math.round(t[pN])} L${Math.round(t[gN])},${Math.round(t[fN])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(h(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=Al({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=Al({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===fK.appear)return this._startAngle;if(i===fK.disappear)return this._endAngle;const n=[fK.disappear,fK.exit],s=e.mark.elements,r=t,a=r?.[YX];if(void 0===s.find((t=>t.data[0]?.[YX]t.data[0]?.[YX]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[YX]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class KJ extends $J{static type=tq.pie;type=tq.pie}class qJ extends YJ{static type=R$.arc3d;type=qJ.type}wK.useMark([OJ,qZ,qJ]);class ZJ extends $J{static type=tq.pie3d;type=tq.pie3d;_pieMarkName=QK.pie3d;_pieMarkType=R$.arc3d;static mark={...Lq.mark,[QK.pie3d]:{name:QK.pie3d,type:R$.arc3d},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Ol(iN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Ol(nN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this),...n},void 0,qX.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const JJ=[10,20],QJ=Fl.Linear,tQ="circle",eQ=Fl.Ordinal,iQ=["circle","square","triangle","diamond","star"];wK.useMark([aJ,qZ]);class nQ extends Oq{static type=tq.scatter;type=tq.scatter;static mark={...Lq.mark,[QK.point]:{name:QK.point,type:R$.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if(l(e))return e;if(m(e)){if(h(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${Kj}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(d(e)){if(h(t))throw new Error(`${s}Field is required.`);const r={id:`${Kj}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return h(e)?10:v(e)?e:!f(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:QJ,defaultRange:JJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return h(e)?tQ:f(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:eQ,defaultRange:iQ},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(nQ.mark.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(WZ(NZ.scatter({},t),GZ(QK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:v(this._size)||l(this._size)?this._size:10,shape:f(this._shape)||l(this._shape)?this._shape:tQ},yK.STATE_NORMAL,qX.Series),(c(this._sizeField)||c(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},yK.STATE_NORMAL,qX.User_Mark),(c(this._shapeField)||c(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},yK.STATE_NORMAL,qX.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},yK.STATE_NORMAL,qX.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class sQ extends NJ{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(JX),this.setInnerRadiusField(ZX)}setValueFieldToPercent(){this.setRadiusField(t$),this.setInnerRadiusField(QX)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}wK.useMark([XJ,qZ]);class rQ extends sQ{static type=tq.rose;type=tq.rose;static mark={...ZZ.mark,[QK.rose]:{name:QK.rose,type:R$.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(rQ.mark.rose,{morph:XZ(this._spec.animation,this._spec.morph,GZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(rQ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Vh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(wl(e)??0)+90},void 0,qX.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(WZ(NZ.rose(e,t),GZ(QK.rose,this._spec)))}}}wK.useMark([vJ,dJ,aJ,qZ]);class aQ extends sQ{static type=tq.radar;type=tq.radar;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(aQ.mark.area,{progressive:t,isSeriesMark:e})}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._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:F$},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:Sl(this._spec.startAngle)??xN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.radarGroup(t,e),GZ(QK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(c(i)){const s=NZ[n];i.setAnimationConfig(WZ(s(t,e),GZ(i.name,this._spec)))}}))}}j(aQ,lJ);class oQ extends Sq{updateTooltipSpec(){super.updateTooltipSpec(),c(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>Wo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const lQ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},hQ={fill:"#bbb",fillOpacity:.2};wK.useMark([aJ,qZ,JZ,KZ]);class cQ extends Oq{static type=tq.dot;type=tq.dot;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.grid]:{name:QK.grid,type:R$.rule},[QK.gridBackground]:{name:QK.gridBackground,type:R$.rect},[QK.dot]:{name:QK.dot,type:R$.symbol},[QK.title]:{name:QK.title,type:R$.text},[QK.subTitle]:{name:QK.subTitle,type:R$.text},[QK.symbol]:{name:QK.symbol,type:R$.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){c(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){c(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){c(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){c(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){c(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),rK(this._option.dataSet,"objFlat",lQ),rK(this._option.dataSet,"copyDataView",dK),aK(this._option.dataSet,"dataview",Fo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){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(L(hQ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(cQ.mark.group),this._containerMark=this._createMark(cQ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cQ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cQ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cQ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cQ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cQ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cQ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",qX.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i));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",qX.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",qX.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(o))}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){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??$X}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new oQ(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class dQ extends Sq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>Wo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}wK.useMark([JZ,aJ]);class uQ extends Oq{static type=tq.link;type=tq.link;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.link]:{name:QK.link,type:R$.rule},[QK.arrow]:{name:QK.arrow,type:R$.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){c(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){c(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){c(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();rK(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(uQ.mark.group),this._containerMark=this._createMark(uQ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(uQ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(uQ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",qX.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?z$.triangleDown:z$.triangleUp},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new dQ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class pQ extends NJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=Sl(this._spec.startAngle)??Sl(t?.startAngle)??xN,this._endAngle=Sl(this._spec.endAngle)??Sl(t?.endAngle)??SN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||c(n?.startAngle)||c(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[ZX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[JX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class gQ extends YJ{static type=R$.arc;static constructorType=R$.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){c(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),c(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const h=c(t.innerPadding)&&c(a)||c(t.outerPadding)&&c(o),d=c(t.innerRadius)&&s||c(t.outerRadius)&&r;if(h||d){const e=Object.assign({},t);return s&&c(a)&&(l(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+(l(s)?s(t,e,i,n):s):l(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&c(o)&&(l(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-(l(r)?r(t,e,i,n):r):l(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}wK.useMark([XJ,gQ]);class fQ extends pQ{static type=tq.circularProgress;type=tq.circularProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.progressArc},[QK.progress]:{name:QK.progress,type:R$.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(fQ.mark.track),this._progressMark=this._createMark(fQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}}class mQ extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}wK.useMark([KZ]);class yQ extends Oq{static type=tq.linearProgress;type=tq.linearProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.rect},[QK.progress]:{name:QK.progress,type:R$.rect},[QK.group]:{name:QK.group,type:R$.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(yQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(yQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(yQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Vh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(hB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Vh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(hB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",qX.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.linearProgress(t,e),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}initTooltip(){this._tooltipHelper=new mQ(this)}}const _Q=[0],vQ=[20,40],bQ=[200,500],xQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},SQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],wQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:AQ,triangle:AQ,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 AQ(){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 kQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const MQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function CQ(t){return l(t)?t:function(){return t}}class TQ{constructor(t){var e,i;switch(this.options=Object.assign({},TQ.defaultOptions,t),l(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>wQ[t]?wQ[t]():wQ.circle())(this.options.shape),this.getText=null!==(e=CQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=CQ(this.options.fontWeight),this.getTextFontSize=CQ(this.options.fontSize),this.getTextFontStyle=CQ(this.options.fontStyle),this.getTextFontFamily=CQ(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=CQ(this.options.color)}if(h(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=l(this.options.rotate)?t=>{var e;return Gt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Gt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!h(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class PQ extends TQ{constructor(t){var e;super(Object.assign({},PQ.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.spiral=f(this.options.spiral)?null!==(e=EQ[this.options.spiral])&&void 0!==e?e:EQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=CQ(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:n}=kQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));for(this.data=r;s>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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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>=n)s&&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(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(IQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}DQ(p,this._size)&&(p=LQ(p,this._size))}else if(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||BQ(p,i))&&(!i||!RQ(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function RQ(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function BQ(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,DQ=(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 LQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),U(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:n}=kQ(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}FQ.defaultOptions={enlarge:!1};const HQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?NQ(t.fontFamily):"sans-serif",u=t.fontStyle?NQ(t.fontStyle):"normal",p=t.fontWeight?NQ(t.fontWeight):"normal",g=t.rotate?NQ(t.rotate):0,f=NQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?NQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",b=null!==(r=t.shrink)&&void 0!==r&&r,x=null!==(a=t.enlarge)&&void 0!==a&&a,S=null!==(o=t.clip)&&void 0!==o&&o,w=null!==(l=t.minFontSize)&&void 0!==l?l:0,A=t.randomVisible,k=t.as||HQ,M=t.depth_3d,C=t.postProjection;let T=t.fontSize?NQ(t.fontSize):14;const E=t.fontSizeRange;if(E&&!v(T)){const t=T;T=e=>VQ(t(e),WQ(t,h),E)}let P=PQ;"fast"===t.layoutType?P=FQ:"grid"===t.layoutType&&(P=OQ);const R=new P({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:T,shrink:b,clip:S,enlarge:x,minFontSize:w,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},NQ=t=>f(t)||v(t)||l(t)?t:e=>e[t.field],VQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],WQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function GQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),XQ=(t,e)=>{let i=0;for(const e of t)YQ(e)?i+=1:i+=.53;return i};function $Q(t){return x(t)?new Promise(((e,i)=>{const n=pB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{We.getInstance().error("image 加载失败!",t)}})):null}var KQ=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 qQ(t){return KQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield $Q(e);r&&(a=yield function(t,e,i){return KQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&JQ(s,n,a-1);)--a;for(;oo&&QQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield $Q(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||ZQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function ZQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function JQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||n0(e,t,r)))return i0(e,t,r),!0}return!1}function i0(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function n0(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function s0(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,m;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(d=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function r0(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?t0(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=r0(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return t0(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){s0(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!n0(i,y,_)&&(i0(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var l0=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())}))};const h0={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},c0=(t,e,i,n)=>l0(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||al("WordcloudShape shape must be specified."),t.text||al("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(UQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||h0;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=gj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield qQ(l),p=t.colorMode||"ordinal",g={getText:f0(t.text),getFontSize:f0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?f0(t.colorField):f0(t.text),getFillingColor:f0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:f0(t.colorHexField),getFontFamily:f0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:f0(t.padding||1),getFontStyle:f0(t.fontStyle||"normal"),getFontWeight:f0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?f0(t.fontOpacity):()=>1};u0(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:f0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:f0(t.fillingFontStyle||"normal"),getFillingFontWeight:f0(t.fillingFontWeight||"normal"),getFillingPadding:f0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=XQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,P=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),R=Math.max(...P.map((t=>t.fontSize)));P.forEach((t=>t.weight=t.fontSize/R)),P.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield o0(P,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(UQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),d0=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new Wl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Wl).domain(e).range(f).scale(t)}}else(new _h).domain(g0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new _h).domain(g0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},u0=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new Mh).domain(g0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&l(s)&&!n){const e=.5,[o,l]=(i.shapeArea,g0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=p0(h,i,!0);n=[~~(e*c),~~c];const d=(new Mh).domain(g0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=p0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},p0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=XQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},f0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:l(t)?t:e=>e[t.field]:null,m0=`${Kj}_WORD_CLOUD_ANGLE`,y0=`${Kj}_WORD_CLOUD_FILLING_ANGLE`,_0=`${Kj}_WORD_CLOUD_WEIGHT`,v0=`${Kj}_WORD_CLOUD_TEXT`;wK.useMark([qZ]),TN("wordcloud",{transform:jQ,markPhase:"beforeJoin"},!0),TN("wordcloudShape",{transform:c0,markPhase:"beforeJoin"},!0);class b0 extends Lq{static mark={...Lq.mark,[QK.word]:{name:QK.word,type:R$.text},[QK.fillingWord]:{name:QK.fillingWord,type:R$.text}};_nameField;_valueField;setValueField(t){c(t)&&(this._valueField=t,this.setFontSizeRange(vQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){c(t)&&c(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??bQ,this._rotateAngles=this._spec.rotateAngles??_Q,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:xQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:_Q,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!SQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(b0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?v0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud(),GZ(QK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??$X};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:XX,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?v0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:Zo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class x0 extends b0{static type=tq.wordCloud;type=tq.wordCloud}class S0 extends b0{static type=tq.wordCloud3d;type=tq.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(b0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.fillingWord,this._spec)))}}const w0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=b(y*f)?y/f:null,x=b(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:x),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},A0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},k0=`${Kj}_FUNNEL_TRANSFORM_RATIO`,M0=`${Kj}_FUNNEL_REACH_RATIO`,C0=`${Kj}_FUNNEL_HEIGHT_RATIO`,T0=`${Kj}_FUNNEL_VALUE_RATIO`,E0=`${Kj}_FUNNEL_LAST_VALUE_RATIO`,P0=`${Kj}_FUNNEL_NEXT_VALUE_RATIO`,R0=`${Kj}_FUNNEL_LAST_VALUE`,B0=`${Kj}_FUNNEL_CURRENT_VALUE`,I0=`${Kj}_FUNNEL_NEXT_VALUE`,D0=`${Kj}_FUNNEL_TRANSFORM_LEVEL`,L0=20;class O0 extends Sq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===QK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===QK.transform){const e=t?.[M0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===QK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])?t?.[n[0]]:t?.[s]}}class F0 extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class z0 extends F0{static type=R$.polygon;type=z0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}wK.useMark([z0,qZ,JZ]);class H0 extends Lq{static type=tq.funnel;type=tq.funnel;_funnelMarkName=QK.funnel;_funnelMarkType=R$.polygon;_transformMarkName=QK.transform;_transformMarkType=R$.polygon;static mark={...Lq.mark,[QK.funnel]:{name:QK.funnel,type:R$.polygon},[QK.transform]:{name:QK.transform,type:R$.polygon},[QK.transformLabel]:{name:QK.transformLabel,type:R$.text},[QK.outerLabel]:{name:QK.outerLabel,type:R$.text},[QK.outerLabelLine]:{name:QK.outerLabelLine,type:R$.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"funnel",w0),rK(this._dataSet,"funnelTransform",A0);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new Tq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:B0,asTransformRatio:k0,asReachRatio:M0,asHeightRatio:C0,asValueRatio:T0,asNextValueRatio:P0,asLastValueRatio:E0,asLastValue:R0,asNextValue:I0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:D0}})}initMark(){if(this._funnelMark=this._createMark({...H0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...H0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(H0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(H0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(H0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(H0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new O0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>c(t[this._valueField]),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Ol(M0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",qX.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",qX.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),GZ(QK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(WZ(NZ.funnel({},t),GZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(WZ(NZ.label(),GZ(QK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[E0])/2:this._getSecondaryAxisLength(t[T0])/2,s=this._getSecondaryAxisLength(t[T0])/2):(n=this._getSecondaryAxisLength(t[T0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[P0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[D0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return c(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!c(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(v(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-L0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series)}}function V0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=U0(t.children,u.children,i+1,o,u,r);u.value=h(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else u.isLeaf=!0,u.value=h(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:l,flattenIndex:o}},Y0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=Y0(t.children,e,t,s))})),n},X0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=X0(t.children,e,t,s)),s=e(t,n,i,s)})),s},$0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:V0,slice:W0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?W0:V0)(t,e,i,n,s)}};class K0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=m(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=m(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=m(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=m(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},K0.defaultOpionts,t);const i=this.options.nodeKey,n=l(i)?i:i?ll(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?G0(this.options.aspectRatio):null!==(e=$0[this.options.splitType])&&void 0!==e?e:$0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=U0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(v(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(v(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)}))}}K0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const q0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class Z0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];V0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),q0);const n=m(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],n)return this._layoutLabel(t,o(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},Z0.defaultOpionts,t):Object.assign({},Z0.defaultOpionts);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+ml(this.options.center[0],t.width),n=t.y0+ml(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=m(r),l=o?r.map((t=>ml(t,s))):ml(r,s),c=m(a),d=this.options.gapRadius,u=c?a.map((t=>ml(t,s))):ml(a,s),p=Y(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return h(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:ih(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(m(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=ml(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(m(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=U0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("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=$t({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}Z0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const J0=4294967296;function Q0(t,e){let i,n;if(i1(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function i1(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function a1(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function o1(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function l1(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function h1(t){return{_:t,next:null,prev:null}}function c1(t,e){const i=(t=N(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];a1(s,n,r);let a,o,l,h,c,d,u,p=h1(n),g=h1(s),f=h1(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:m(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="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 h=[],c=U0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%J0)/J0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=l(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:g1.defaultOpionts.nodeSort;Y0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)Y0([u],d1(this.options.setRadius)),X0([u],u1(this._getPadding,.5,d)),Y0([u],p1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);Y0([u],d1(g1.defaultOpionts.setRadius)),X0([u],u1(cl,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&X0([u],u1(this._getPadding,u.radius/t,d)),Y0([u],p1(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}g1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const f1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):f1(t.children,e,i)))})),e},m1=(t,e={})=>{if(!t)return[];const i=[];return f1(t,i,e),i},y1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new Z0(i).layout(t,{width:n,height:s})};class _1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var v1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(v1||(v1={}));const b1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(h(s))return t;if(i.type===v1.DrillDown){return N(k$(t,s,n,"children"))}if(i.type===v1.DrillUp){const e=M$(t,s,n,"children");if(e)return N(e)}return t};class x1{pointerId;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(){}parserDragEvent(){return!0}}class S1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const w1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1}};class A1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return w1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===un.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;rK(t,"drillFilter",b1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(h(t.datum)||h(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!m(t)||M(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:v1.DrillDown},e().reRunAllTransform(),i.emit(VX.drill,{value:{path:t,type:v1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!m(i)||M(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:v1.DrillUp},t().reRunAllTransform(),e.emit(VX.drill,{value:{path:i,type:v1.DrillUp},model:this}),i}}wK.useMark([XJ,qZ]);class k1 extends NJ{static type=tq.sunburst;type=tq.sunburst;static mark={...Lq.mark,[QK.sunburst]:{name:QK.sunburst,type:R$.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),this._startAngle=Gt(this._spec.startAngle),this._endAngle=Gt(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),rK(this._dataSet,"sunburstLayout",y1),rK(this._dataSet,"flatten",m1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[c(this._centerX)?this._centerX:this.getLayoutRect().width/2,c(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(k1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){h(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.y+(c(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(k1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return d(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(c(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},yK.STATE_NORMAL,qX.Series)}initTooltip(){this._tooltipHelper=new _1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((i=>{i.setAnimationConfig(WZ(NZ.sunburst(t,e),GZ(i.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(m(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}j(k1,A1);const M1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new g1(i).layout(t,{width:n,height:s})};class C1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}wK.useMark([XJ,qZ]);class T1 extends Oq{static type=tq.circlePacking;type=tq.circlePacking;static mark={...Lq.mark,[QK.circlePacking]:{name:QK.circlePacking,type:R$.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,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();h(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"circlePackingLayout",M1),rK(this._dataSet,"flatten",m1),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(T1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){h(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},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(T1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},yK.STATE_NORMAL,qX.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new C1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((e=>{e.setAnimationConfig(WZ(NZ.circlePacking({},t),GZ(e.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}j(T1,A1);const E1=t=>{let e=0;return t.forEach(((t,i)=>{var n;h(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=E1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function P1(t){return t.depth}function R1(t,e){return e-1-t.endDepth}const B1=(t,e)=>t.y0-e.y0,I1={left:P1,right:R1,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?W(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:P1,end:R1};class D1{constructor(t){this._ascendingSourceBreadth=(t,e)=>B1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D1.defaultOptions,t);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._alignFunc=l(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I1[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];E1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(h(s.source)||h(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(f(e)){const t=ct(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(v(e)){if(r=e,v(i))a=i;else if(h(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else l(e)&&v(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}h(this.options.nodeSortBy)&&s.sort(B1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},O1=(t,e)=>{if(!t||!e?.view||!m(t))return t;const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new D1(e),s=[];return s.push(n.layout(t,i)),s},F1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],z1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class H1 extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(v(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class j1 extends KK{static type=R$.linkPath;type=j1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){$N("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),qV("linkPathGrowIn",aW),qV("linkPathGrowOut",oW),qV("linkPathUpdate",lW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}wK.useMark([KZ,j1,qZ]),TN("sankey",{transform:L1,markPhase:"beforeJoin"},!0);class N1 extends Oq{static type=tq.sankey;type=tq.sankey;static mark={...ZZ.mark,[QK.node]:{name:QK.node,type:R$.rect},[QK.link]:{name:QK.link,type:R$.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=r$.Node;_labelLayoutZIndex=r$.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Vt;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){rK(this._dataSet,"sankey",O1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new jo;aK(t,"dataview",Fo),rK(t,"sankeyNodes",F1),rK(t,"addVChartProperty",uq);const e=new Vo(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._nodesSeriesData=new Tq(this._option,e);const i=new jo;aK(i,"dataview",Fo),rK(i,"sankeyLinks",z1),rK(i,"addVChartProperty",uq);const n=new Vo(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._linksSeriesData=new Tq(this._option,n)}}initMark(){const t=this._createMark(N1.mark.node,{isSeriesMark:!0,key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(N1.mark.link,{key:YX,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(N1.mark.label,{key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},yK.STATE_NORMAL,qX.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},yK.STATE_NORMAL,qX.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(WZ(NZ.sankeyNode(t,e),GZ(QK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(WZ(NZ.sankeyLinkPath(),GZ(QK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:GX.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:GX.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(N(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||N(s[r]).includes(e.source)&&N(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(N(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new H1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Ih(this._option.getTheme().colorScheme,this.type),n=new Hh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const V1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new K0(e).layout(t,i)},W1=(t,e)=>{let i={},n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=m1(s);return i=Mq([{latestData:r}],e),i};class G1 extends Sq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class U1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,w1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return w1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;h(s)||Yh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){w1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){w1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;h(s)&&h(r)||Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:GX.chart},(t=>{if(!t.event)return;const{event:n}=t;Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:GX.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){w1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:GX.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:GX.chart,source:WX.chart},l),this._eventObj.off(n,{level:GX.chart,source:WX.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:GX.chart,source:WX.chart},l),this._eventObj.on(n,{level:GX.chart,source:WX.chart},o)}}wK.useMark([KZ,qZ]);class Y1 extends Oq{static type=tq.treemap;type=tq.treemap;static mark={...Lq.mark,[QK.nonLeaf]:{name:QK.nonLeaf,type:R$.rect},[QK.leaf]:{name:QK.leaf,type:R$.rect},[QK.nonLeafLabel]:{name:QK.nonLeafLabel,type:R$.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Vt;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qt),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),b(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"treemap",V1),rK(this._dataSet,"flatten",m1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){rK(this._dataSet,"hierarchyDimensionStatistics",W1),rK(this._dataSet,"flatten",m1);const i=new Vo(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initMark(){const t=this._createMark(Y1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(Y1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(Y1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(Y1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},yK.STATE_NORMAL,qX.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()},yK.STATE_NORMAL,qX.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}initAnimation(){this.getMarksInType(R$.rect).forEach((t=>{t.setAnimationConfig(WZ(NZ.treemap(),GZ(t.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}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 G1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(hV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(hV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}j(Y1,U1),j(Y1,A1),wK.useMark([OJ,KZ]);class X1 extends pQ{static type=tq.gaugePointer;type=tq.gaugePointer;static mark={...Lq.mark,[QK.pin]:{name:QK.pin,type:R$.path},[QK.pinBackground]:{name:QK.pinBackground,type:R$.path},[QK.pointer]:{name:QK.pointer,type:[R$.path,R$.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?R$.rect:R$.path}initMark(){this._pinBackgroundMark=this._createMark(X1.mark.pinBackground),this._pointerMark=this._createMark({...X1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(X1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===R$.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return c(this.radiusAxisHelper)&&c(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.pointer,this._spec)))}}wK.useMark([gQ]);class $1 extends pQ{static type=tq.gauge;type=tq.gauge;static mark={...Lq.mark,[QK.segment]:{name:QK.segment,type:R$.progressArc},[QK.track]:{name:QK.track,type:R$.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=Sl(this._spec.padAngle??0)}initData(){super.initData();rK(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[s$]=t[this._angleField[0]],t[n$]=e>0?i[e-1][s$]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark($1.mark.track),this._segmentMark=this._createMark($1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(c(t[n$])?this.angleAxisHelper.dataToPosition([t[n$]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[s$]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.segment,this._spec)))}}class K1 extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return c(i)&&"dimension"===t&&(i.visible=!1),i}}class q1 extends rJ{static type=R$.cell;type=q1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}wK.useMark([q1,qZ]);class Z1 extends Oq{static type=tq.heatmap;type=tq.heatmap;static mark={...Lq.mark,[QK.cell]:{name:QK.cell,type:R$.cell},[QK.cellBackground]:{name:QK.cellBackground,type:R$.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=N(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(Z1.mark.cell,{morph:XZ(this._spec.animation,this._spec.morph,GZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(Z1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=Ge(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",qX.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(WZ(NZ.heatmap(t),GZ(QK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new K1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}wK.useSeries([bJ]);class J1 extends rq{static type=eq.area;static view="singleDefault";type=eq.area;seriesType=tq.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([ZZ]);class Q1 extends rq{static type=eq.bar;static view="singleDefault";type=eq.bar;seriesType=tq.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class t2 extends rq{static type=eq.bar3d;static view="singleDefault";type=eq.bar3d;seriesType=tq.bar3d}wK.useSeries([oJ]);class e2 extends rq{static type=eq.boxPlot;static view="singleDefault";type=eq.boxPlot;seriesType=tq.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??Gh.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===Gh.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),aq(t)}}wK.useSeries([T1]);class i2 extends sq{static type=eq.circlePacking;static view="singleDefault";type=eq.circlePacking;seriesType=tq.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=tq.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class n2 extends sq{static type=eq.common;static view="singleDefault";type=eq.common}class s2 extends sq{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([H0]);class r2 extends s2{static type=eq.funnel;static view="singleDefault";type=eq.funnel;seriesType=tq.funnel}wK.useSeries([N0]);class a2 extends s2{static type=eq.funnel3d;static view="singleDefault";type=eq.funnel3d;seriesType=tq.funnel3d}const o2={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function l2(t){let e=0;return C(t,"tick.visible")&&(e+=C(t,"tick.tickSize")),C(t,"label.visible")&&(e+=C(t,"label.space")),e}function h2(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function c2(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function d2(t){const e=t?.orient;return"angle"===e||"radius"===e}const u2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},j$(t)?r:a)},p2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class g2 extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=N(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return c(i)&&e.forEach((t=>{h(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));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],c(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class f2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),h(n.angle.type)&&(n.angle.type="linear"),h(n.radius.type)&&(n.radius.type="band");const s=h2(n.angle,{min:0,max:1});h(n.angle.min)&&(n.angle.min=s.min),h(n.angle.max)&&(n.angle.max=s.max)}}wK.useSeries([X1,$1]);class m2 extends f2{static type=eq.gauge;static view="singleDefault";type=eq.gauge;seriesType=tq.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:tq.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===tq.gauge||t.type===tq.circularProgress));h(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&h(e.radiusField)&&h(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===tq.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),h(e.angle.type)&&(e.angle.type="linear"),h(e.radius.type)&&(e.radius.type="linear")}}wK.useSeries([Z1]);class y2 extends rq{static type=eq.heatmap;static view="singleDefault";type=eq.heatmap;seriesType=tq.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class _2 extends rq{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}wK.useSeries([ZZ]);class v2 extends _2{static type=eq.histogram;static view="singleDefault";type=eq.histogram;seriesType=tq.bar;transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class b2 extends _2{static type=eq.histogram3d;static view="singleDefault";type=eq.histogram3d;seriesType=tq.bar3d}wK.useSeries([uJ]);class x2 extends rq{static type=eq.line;static view="singleDefault";type=eq.line;seriesType=tq.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([jJ]);class S2 extends sq{static type=eq.map;static view="singleDefault";type=eq.map;seriesType=tq.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor}}isValidSeries(t){return t===tq.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class w2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}wK.useSeries([KJ]);class A2 extends w2{static type=eq.pie;static view="singleDefault";type=eq.pie;seriesType=tq.pie}wK.useSeries([ZJ]);class k2 extends w2{static type=eq.pie3d;static view="singleDefault";type=eq.pie3d;seriesType=tq.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}wK.useSeries([fQ]);class M2 extends f2{static type=eq.circularProgress;static view="singleDefault";type=eq.circularProgress;seriesType=tq.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}wK.useSeries([yQ]);class C2 extends rq{static type=eq.linearProgress;static view="singleDefault";type=eq.linearProgress;seriesType=tq.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="band"),h(e.type)&&(e.type="linear");const n=h2(e,{min:0,max:1});h(e.min)&&(e.min=n.min),h(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="linear"),h(e.type)&&(e.type="band");const n=h2(i,{min:0,max:1});h(i.min)&&(i.min=n.min),h(i.max)&&(i.max=n.max)}}}class T2 extends g2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}wK.useSeries([aQ]);class E2 extends T2{static type=eq.radar;static view="singleDefault";type=eq.radar;seriesType=tq.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:L({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}wK.useSeries([SJ]);class P2 extends rq{static type=eq.rangeArea;static view="singleDefault";type=eq.rangeArea;seriesType=tq.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([yJ]);class R2 extends rq{static type=eq.rangeColumn;static view="singleDefault";type=eq.rangeColumn;seriesType=tq.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([_J]);class B2 extends rq{static type=eq.rangeColumn3d;static view="singleDefault";type=eq.rangeColumn3d;seriesType=tq.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}wK.useSeries([rQ]);class I2 extends T2{static type=eq.rose;static view="singleDefault";type=eq.rose;seriesType=tq.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??kN,outerRadius:t.outerRadius??kN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}wK.useSeries([N1]);class D2 extends sq{static type=eq.sankey;static view="singleDefault";type=eq.sankey;seriesType=tq.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([nQ]);class L2 extends rq{static type=eq.scatter;static view="singleDefault";type=eq.scatter;seriesType=tq.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}wK.useSeries([cQ,uQ]);class O2 extends sq{static type=eq.sequence;static view="singleDefault";type=eq.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==tq.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[tq.bar,tq.line,tq.area,tq.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===tq.dot?"band":"linear",visible:t.type!==tq.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===tq.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===tq.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=pK(t.data,this._dataSet,this._spec.data),t.type===tq.link&&(t.dataDot=pK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===tq.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===tq.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}wK.useSeries([k1]);class F2 extends sq{static type=eq.sunburst;static view="singleDefault";type=eq.sunburst;seriesType=tq.sunburst;getDefaultSeriesSpec(t){const e=c(t.startAngle)?t.startAngle:wN,i=c(t.endAngle)?t.endAngle:e+Ut(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=tq.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([Y1]);class z2 extends sq{static type=eq.treemap;static view="singleDefault";type=eq.treemap;seriesType=tq.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([QZ]);class H2 extends Q1{static type=eq.waterfall;static view="singleDefault";type=eq.waterfall;seriesType=tq.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&N(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),aq(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class j2 extends sq{type=eq.wordCloud;seriesType=tq.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([x0]);class N2 extends j2{static type=eq.wordCloud;static view="singleDefault";type=eq.wordCloud;seriesType=tq.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}wK.useSeries([S0]);class V2 extends j2{static type=eq.wordCloud3d;static view="singleDefault";type=eq.wordCloud3d;seriesType=tq.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class W2{plugins;id=el();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function G2(t){const e={...t};return M(t.style)||(e.textStyle=P$(t.style)),M(t.textStyle)||L(e.textStyle,P$(t.textStyle)),t.shape?.style&&P$(e.shape.style),t.background?.style&&P$(e.background.style),e}function U2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class Y2 extends IK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new W2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case un.cartesianBandAxis:return u2(W$(i),"band",e);case un.cartesianLinearAxis:return u2(W$(i),"linear",e);case un.cartesianAxis:case un.cartesianTimeAxis:return u2(W$(i),void 0,e);case un.polarBandAxis:return p2(i.orient,"band",e);case un.polarLinearAxis:return p2(i.orient,"linear",e);case un.polarAxis:return p2(i.orient,void 0,e);case un.cartesianCrosshair:case un.polarCrosshair:return e.component?.crosshair;case un.colorLegend:return e.component?.colorLegend[U2(i)];case un.sizeLegend:return e.component?.sizeLegend[U2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),m(this._originalSpec)?this._spec=this._originalSpec.map((t=>L({},this._theme,t))):this._spec=L({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:WX.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const X2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(h(a)||h(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},$2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{h(i[e])||t.latestData.forEach((t=>{N(i[e]).forEach((i=>{h(t[i])||(h(o[t[i]])&&(o[t[i]]=0),h(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class K2 extends Y2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=W$(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?Gh.horizontal:Gh.vertical)===Gh.horizontal,c(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(c(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):c(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),h(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(c(t)&&(c(t.userId)&&(this._seriesUserId=N(t.userId)),c(t.specIndex)&&(this._seriesIndex=N(t.specIndex))),c(this._spec.seriesId)){const t=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(c(this._spec.seriesIndex)){const t=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(c(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(c(this._spec.regionId)){const t=N(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(zl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};Ll(this._regions,(s=>{const r="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,a="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!r||!a)return;const o=r.getAxisId()===this._relatedAxisComponent.id?r:a.getAxisId()===this._relatedAxisComponent.id?a:this._isHorizontal?r:a,l=o===r?a:r,h=zl(l.getScale(0).type);t.push(s.getRawData());const c=s.getSpec(),d=N(c.xField),u=N(c.yField),p="cartesian"===s.coordinate?d[0]:c.angleField??c.categoryField,g="cartesian"===s.coordinate?u[0]:c.radiusField??c.valueField;if(n[s.id]="link"===s.type?"from_xField":o===r?p:g,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":l===r?p:g;i.push(h?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else h(this._spec.valueField),Ll(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;aK(n,"dataview",Fo),rK(n,"dataFilterComputeDomain",$2);const s=new Vo(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new YK(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&zl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&zl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new ah,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(rK(this._option.dataSet,"dataFilterWithNewDomain",X2),Ll(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>zl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ct(this._start-s,0,1),a=ct(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}j(K2,U1);class q2 extends K2{static type=un.scrollBar;type=un.scrollBar;name=un.scrollBar;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(h(i))return;if(!m(i))return new q2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new q2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new JW({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return h(i)||(n.padding=i),M(t?.style)||(n.railStyle=P$(t.style)),M(e?.style)||(n.sliderStyle=P$(e.style)),n}}class Z2 extends K2{static type=un.dataZoom;type=un.dataZoom;name=un.dataZoom;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;_startHandlerSize;_endHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(h(i))return;if(!m(i))return new Z2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new Z2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const t=this._spec.startHandler.style.visible??!0,e=this._spec.endHandler.style.visible??!0;this._startHandlerSize=t?this._spec.startHandler.style.size:0,this._endHandlerSize=e?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new _h;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e+i};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e+i};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new kU({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:P$(this._spec.background?.style),startHandlerStyle:P$(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:P$(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:P$(this._spec.middleHandler.background?.style)}},endHandlerStyle:P$(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:P$(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:P$(this._spec.endText?.style)},selectedBackgroundStyle:P$(this._spec.selectedBackground.style),dragMaskStyle:P$(this._spec.dragMask?.style),backgroundChartStyle:{line:L(P$(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:L(P$(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class J2 extends Y2{static type=un.customMark;type=un.customMark;layoutType="absolute";layoutZIndex=r$.CustomMark;layoutLevel=a$.CustomMark;static createComponent(t,e){return t.customMark?[new J2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`});if(s&&(h(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),c(t.dataId)||b(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class Q2 extends Y2{layoutType="absolute";static type=un.brush;type=un.brush;name=un.brush;layoutZIndex=r$.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!h(i)&&!1!==i.visible)return[new Q2(i,{...e,specKey:Q2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new SY({zIndex:this.layoutZIndex,brushStyle:P$(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=VX.brushChange;r="brushStart"===n||"brushDown"===n?VX.brushStart:"brushEnd"===n||"brushMaskUp"===n?VX.brushEnd:VX.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{...P$(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&Le(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&De(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){c(this._spec.regionId)&&c(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){c(this._spec.brushLinkSeriesId)&&c(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&N(t).includes(s.userId)||e&&N(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var t3;function e3(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function i3(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function n3(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:i3(t.rect),anchorCandidates:h3(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>e3(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;te3(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function s3(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=Be(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=o3(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=hn(r,n,i);if(!o3(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],r3(a3(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=r3(a3(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=l3(t.rect,a,0),t}));return n3(h)}function r3(t){return t>180?t-360:t}function a3(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function o3(t,e){for(let i=0;i{const{x:r,y:a}=l3({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(t3||(t3={}));class c3 extends Y2{static type=un.mapLabel;type=un.mapLabel;name=un.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=r$.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!c(i.series)?new c3(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new Vo(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new YK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new FU({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=qh(this._spec.background?.padding),d=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const u={},p=this.dataToPosition(t),g=aB({});if(g.name=`${this.name}_marker_itemContainer_${e}`,u.container=g,this._spec.background?.visible){const t=hB(P$({...this._spec.background.style}));t.setAttributes(p),u.labelBackground=t,g.appendChild(t)}if(this._spec.icon?.visible){const t=uB(P$({...this._spec.icon.style}));t.setAttributes(p),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;u.icon=t,g.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=dB(P$({...this._spec.nameLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.nameLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&c(t[this.valueField])){const e=dB(P$({...this._spec.valueLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.valueLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}const f=Object.values(u).find((t=>!!t&&"group"!==t.type)),m={x:f?.getComputedAttribute("x"),y:f?.getComputedAttribute("y")},y={x:m.x,y:m.y,width:0,height:0};y.width=n+r+(i-1)*d,y.height=s+a;const _={rect:y,point:m,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));_.rect=l3(y,o,l),_.anchors=t,_.offset=l}else _.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:_,contentMarks:u}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:P$({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):n3(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class d3{id;name;service;static Name;constructor(t=d3.Name){this.id=el(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function u3(t,e){const i=e.getSpec?.();M(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=j$(e.layoutOrient),r=t[0],a=V(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);u3(n?n.getChildren():[],t.component),u3(s?s.getChildren():[],t.component)}}function g3(t){return 2===t.length&&b(t[0])&&b(t[1])&&t[1]>=t[0]}function f3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!b(a.min),extendable_max:!b(a.max)}}function m3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function y3(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 _3(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 v3(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 b3=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),x3=(t,e,i=0)=>{const n=new Wt(t).expand(i/2),s=new Wt(e).expand(i/2);return n.intersects(s)},S3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function A3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=Sl(-90));const u=b$(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Wt).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},M3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return b3(p,r.options)};class C3 extends d3{Name="AxisSyncPlugin";constructor(){super(C3.Name)}_checkEnableSync(t){if(!zl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(VX.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!zl(i.type)||!zl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!g3(s)||!g3(r))return;const a=f3(t,s),o=f3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!y3(a,o))return}else if(0===p&&0===g){if(!y3(o,a))return}else if(u||y)if(u&&!y){if(!m3(a,o))return}else if(y&&!u){if(!m3(o,a))return}else{if(h===g)return;if(h>g){if(!_3(a,o))return}else if(!_3(o,a))return}else{if(0===h&&0===p){if(!v3(a,o))return}else if(0===g&&0===l&&!v3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){rK(e.getOption().dataSet,"tickAlign",M3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var T3={AxisLabelOverlapPlugin:p3,AxisSyncPlugin:C3};const E3=t=>t,P3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!w3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},R3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?S3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return b3(t.domain());let h;if(c(s))h=t.stepTicks(s);else if(c(n))h=t.forceTicks(n);else if(c(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=l2(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=l2(r),c=b$(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Bl(u),{x:m,y:y}=$t({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Wt).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=I3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}else h=t.domain();return b3(h)},I3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&x3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},D3=(t,e)=>{if(zl(t.type))return((t,e)=>{if(!zl(t.type))return b3(t.domain());const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=c(s)?t.stepTicks(s):c(n)?t.forceTicks(n):t.ticks(i??5),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=k3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&A3(s,i);)s=P3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),V(a)!==V(r)&&a.push(V(r))),r=a}return b3(r)})(t,e);if(jl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(c(s))l=t.stepTicks(s);else if(c(n))l=t.forceTicks(n);else if(c(i))l=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=k3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=R3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}else l=t.domain();return b3(l)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return B3(t,e)}return b3(t.domain())};class L3 extends Y2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),c(this._spec.id)&&t.setUserId(this._spec.id),o(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==C(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=WZ(NZ.axis(),{appear:this._spec.animationAppear??C(this._option.getChart().getSpec(),"animationAppear.axis")??C(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??C(this._option.getChart().getSpec(),"animationDisappear.axis")??C(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??C(this._option.getChart().getSpec(),"animationEnter.axis")??C(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??C(this._option.getChart().getSpec(),"animationExit.axis")??C(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??C(this._option.getChart().getSpec(),"animationUpdate.axis")??C(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return Ll(this._regions,(e=>{m(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;c(t)&&(this._seriesUserId=N(t)),c(i)&&(this._regionUserId=N(i)),c(e)&&(this._seriesIndex=N(e)),c(n)&&(this._regionIndex=N(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(Ll(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!zl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=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));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(Ll(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===rU.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&h(t.title.angle)&&(i="left"===t.orient?-90:90,e=o2[t.orient]),{orient:this.orient,select:t.select,hover:t.hover,line:(n=t.domainLine,(n=C$(n)).startSymbol=C$(n.startSymbol),n.endSymbol=C$(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:l(t.label.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.label.style(e.rawValue,i,e,n,s));return P$(this._preprocessSpec(L({},this._theme.label?.style,r)))}:P$(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:E$(t.label.state),autoRotate:!!t.label.autoRotate,autoHide:!!t.label.autoHide,autoLimit:!!t.label.autoLimit,autoRotateAngle:t.label.autoRotateAngle,autoHideMethod:t.label.autoHideMethod,autoHideSeparation:t.label.autoHideSeparation,limitEllipsis:t.label.limitEllipsis,layoutFunc:t.label.layoutFunc},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:l(t.tick.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.tick.style(e,i,n,s));return P$(this._preprocessSpec(L({},this._theme.tick?.style,r)))}:P$(t.tick.style),state:T$(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:l(t.subTick.style)?(e,i,n,s)=>{const r=t.subTick.style(e,i,n,s);return P$(L({},this._theme.subTick?.style,r))}:P$(t.subTick.style),state:T$(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:l(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return P$(this._preprocessSpec(L({},this._theme.grid?.style,n)))}:P$(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:P$(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Gt(i):null,textStyle:L({},e,P$(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:P$(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:P$(t.title.background?.style)},state:{text:T$(t.title.state),shape:T$(t.title.shape?.state),background:T$(t.title.background?.state)}},panel:{visible:t.background?.visible,style:P$(t.background?.style),state:T$(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const O3=[T3.AxisLabelOverlapPlugin,T3.AxisSyncPlugin];class F3 extends L3{static type=un.cartesianAxis;type=un.cartesianAxis;name=un.cartesianAxis;layoutType="region-relative";layoutZIndex=r$.Axis;layoutLevel=a$.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;_verticalLimitSize;constructor(t,e){super(t,{...e}),this._orient=W$(t,["z"]),V$(this._orient)&&(this.layoutType="absolute"),c(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?j$(t)?"linear":"band":j$(t)?"band":"linear"}(t.orient,i),s=`${F3.type}-${n}`,r=B$.getComponentInKey(s);if(r){let n=t.inverse;return i&&!j$(t.orient)&&(n=!c(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(F3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[F3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===Gh.horizontal;if(!m(i))return c2(i)?F3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>N$(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{c2(t)&&a.push(F3.createAxis(t,{...e,specIndex:i,specKey:F3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):N$(this.orient)?t.setYAxisHelper(this.axisHelper()):V$(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];j$(this.orient)?b(e)&&(s=n?[e,0]:[0,e]):V$(this.orient)?b(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):b(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(O3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();j$(this.orient)?h(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):h(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=j$(this.orient)?t.fieldX:V$(this.orient)?t.fieldZ:t.fieldY,zl(this._scale.type)?e:[e[0]]}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(hV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(j$(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(VX.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Ll(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:j$(this.orient)?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:V$(this.orient)?i.fieldZ:i.fieldY,n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{j$(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):N$(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):V$(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;b(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),b(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=j$(this.orient)?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=j$(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(L({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=L({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&h(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{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=j$(this.orient),s=t=>(n?!j$(t.orient):j$(t.orient))&&zl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(c(t))a=r.find((e=>e.id===t));else if(c(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const z3=Math.sqrt(50),H3=Math.sqrt(10),j3=Math.sqrt(2);class N3{_extend={};setExtraAttrFromSpec(){c(this._spec.nice)&&(this._nice=this._spec.nice),c(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=h2(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];c(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),c(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(W(t)-function(t){if(t&&m(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=z3?10:s>=H3?5:s>=j3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(VX.scaleUpdate,{model:this})}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{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._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}j(G3,W3);class U3 extends V3{static type=un.cartesianTimeAxis;type=un.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=L({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new YK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=Wo.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return m(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&m(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class Y3 extends L3{static type=un.polarAxis;type=un.polarAxis;name=un.polarAxis;layoutType="absolute";layoutZIndex=r$.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=xN;get startAngle(){return this._startAngle}_endAngle=SN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${Y3.type}-${i}`,s=B$.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(Y3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!m(i))return d2(i)?(i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),Y3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!d2(i))return;i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),i.outerRadius=i.radius??t.outerRadius??t.radius??kN;const o=Y3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Sl(this._spec.startAngle??wN),this._endAngle=Sl(this._spec.endAngle??(c(this._spec.startAngle)?this._spec.startAngle+360:AN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(VX.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._spec.tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return zl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=Al({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=jt.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=kN,e=0;const i=this.getChart().getSpec();return Ll(this.getRegions(),(n=>{const s=n;if(function(t){return[tq.rose,tq.radar,tq.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;b(n)&&(t=n),b(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(L({},this._axisStyle,t))}}class X3 extends Y3{static type=un.polarLinearAxis;type=un.polarLinearAxis;_zero=!0;_nice=!0;_scale=new _h;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}j(X3,N3);class $3 extends Y3{static type=un.polarBandAxis;type=un.polarBandAxis;_scale=new ah;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function K3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:p,regionId:g,regionIndex:f,seriesIndex:m,seriesId:y,padding:_,...v}=L({},t),b=v;return i.visible&&(b.title=G2(i)),M(n.focusIconStyle)||P$(n.focusIconStyle),n.shape=C$(n.shape),n.label=C$(n.label),n.value=C$(n.value),n.background=C$(n.background),Xh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),Xh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),Xh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),b.item=n,M(s.textStyle)||P$(s.textStyle),C$(s.handler),b.pager=s,r.visible&&!M(r.style)&&(L(b,r.style),c(r.padding)&&(b.padding=r.padding)),b}j($3,W3);const q3=(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},Z3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return c(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class J3 extends Y2{layoutType="normal";layoutZIndex=r$.Legend;layoutLevel=a$.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Uh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;c(i)&&(this._seriesUserId=N(i)),c(t)&&(this._regionUserId=N(t)),c(n)&&(this._seriesIndex=N(n)),c(e)&&(this._regionUserIndex=N(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new YK(this._option,t),this._initSelectedData(),Ll(this._regions,(t=>{t.event.on(VX.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;h(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(VX.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;b(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(L({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(L({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),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,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class Q3 extends J3{static type=un.discreteLegend;type=un.discreteLegend;name=un.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return i.type&&"discrete"!==i.type?void 0:new Q3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new Q3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){rK(this._option.dataSet,"discreteLegendFilter",Z3),rK(this._option.dataSet,"discreteLegendDataMake",q3);const t=new Vo(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!nl(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=A$(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...K3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return KU}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(GU.legendItemClick,(e=>{const i=C(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(VX.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(GU.legendItemHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(GU.legendItemUnHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:b(r)?r:1,strokeOpacity:b(a)?a:1,opacity:b(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return l(this._spec.data)?this._spec.data(t):t}}const t5=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;b(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},e5=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!M(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function i5(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:d,id:u,visible:p,orient:g,position:f,data:m,defaultSelected:y,field:_,filter:v,regionId:b,regionIndex:x,seriesIndex:S,seriesId:w,padding:A,...k}=L({},t),C=k;return e.visible&&(C.title=G2(e)),C.showHandler=!1!==i.visible,M(i.style)||(C.handlerStyle=P$(i.style)),c(n.width)&&(C.railWidth=n.width),c(n.height)&&(C.railHeight=n.height),M(n.style)||(C.railStyle=P$(n.style)),M(s.style)||(C.trackStyle=P$(s.style)),C.startText=C$(r),C.endText=C$(a),C.handlerText=C$(o),M(l)||(C.sizeBackground=P$(l)),h.visible&&!M(h.style)&&(L(C,h.style),c(h.padding)&&(C.padding=h.padding)),C}function n5(t){return"color"===t||"size"===t}const s5={color:tY,size:iY},r5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],a5=[2,10];class o5 extends J3{static type=un.continuousLegend;type=un.colorLegend;name=un.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return n5(i.type)?new o5(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{n5(t.type)&&n.push(new o5(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?un.colorLegend:un.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){rK(this._option.dataSet,"continuousLegendFilter",e5),rK(this._option.dataSet,"continuousLegendDataMake",t5);const t=new Vo(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=A$(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!nl(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=A$(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),M(n)&&(n="color"===this._legendType?r5:a5);const r={...i5(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return s5[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",gt((e=>{const i=C(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(VX.legendFilter,{model:this,value:i,event:e})}),30))}}}const l5=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),N(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class h5 extends Y2{static speckey="indicator";static type=un.indicator;type=un.indicator;name=un.indicator;layoutType="absolute";layoutZIndex=r$.Indicator;layoutLevel=a$.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==h5.type)return null;const i=N(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map(((t,i)=>new h5(t,{...e,specIndex:i,specKey:h5.speckey})));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){rK(this._option.dataSet,"indicatorFilter",l5);const t=new Vo(this._option.dataSet);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 YK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return N(this._spec.content).forEach((t=>{const e=L({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{...P$(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!c(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{...P$(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rY(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":l(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return Ll(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){this._indicatorComponent&&(this._container.removeChild(this._indicatorComponent),this._indicatorComponent=null),this._cacheAttrs=null,super.clear()}}class c5 extends Y2{static type=un.title;type=un.title;layoutType="normal";layoutZIndex=r$.Title;layoutLevel=a$.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Uh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!m(i))return new c5(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new c5(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;b(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),b(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:b(t.width())?t.width():0,height:this._spec.height?this._spec.height:b(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new nY(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class d5{projection;constructor(t){if(this.projection=kJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function u5(t,e){return`${Kj}_${e}_${t}`}class p5 extends Y2{static type=un.geoCoordinate;type=un.geoCoordinate;name=un.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:u5(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(h(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new p5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=L(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(VX.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new d5(this._projectionSpec)}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===tq.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===tq.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(tq.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==tq.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}j(p5,U1);const g5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},f5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class m5 extends Y2{layoutType="absolute";gridZIndex=r$.CrossHair_Grid;labelZIndex=r$.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach(((t,i)=>this._registerEvent(t,m(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:WX.chart},this._handleEvent),this.event.on(e,{level:GX.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ft((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(g5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(m(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(g5[e][t]),s=s.concat(g5[e][i(t)])})),{in:n,out:s}}return{in:g5[e][t],out:g5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=C(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{f5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),m(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function _5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var v5,b5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(v5||(v5={}));class x5 extends m5{static type=un.cartesianCrosshair;type=un.cartesianCrosshair;name=un.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.xField||i.yField?new x5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new x5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,v5.VERTICAL,!0),this.layoutByValue(v5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,v5.HORIZONTAL,!1),this.layoutByValue(v5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return zl(t.getScale().type)&&b(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){j$(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(v5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=v5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,d;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(jl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(zl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=_5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=l2(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(jl(s.type)){const t=s._step;d=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(zl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=_5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(d=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):d=1,a=r}}if(this.yHair.label?.visible){const e=l2(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(v5.HORIZONTAL&&this._layoutHorizontal(n,d??0),v5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EG({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new PG({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new yG(e)),n.add(t)),y5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(b5||(b5={}));class S5 extends m5{static type=un.polarCrosshair;type=un.polarCrosshair;name=un.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.categoryField||i.valueField?new S5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new S5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});zl(s.getScale().type)&&b(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:jt.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(b5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",L(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=l2(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=l2(t.getSpec())),n.angle=i.angle,n.axis=t,L(n,s)}))),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(b5.HORIZONTAL&&this._layoutHorizontal(n),b5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:$t(l,n,i),end:$t(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new EG({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new BG({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Bl(i),e={...$t(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Kt(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=$t(t,s,p),m=$t(t,s,g),y=ve([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=ct(jt.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new IG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new RG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=xl(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}}(i),n={...$t(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new yG(e),n.add(t),i(t)),y5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const w5=t=>P$({...t}),A5=t=>({...t,style:{...P$(t.style)}}),k5=t=>{const e=w5(t?.slider?.trackStyle??{}),i=w5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},P$({...s}));var s;const r=A5(t?.controller?.start??{}),a=A5(t?.controller?.pause??{}),o=A5(t?.controller?.backward??{}),l=A5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},M5=(t,e)=>({...k5(t),data:e,type:"continuous"}),C5=(t,e)=>({...k5(t),data:e,type:"discrete"}),T5=t=>"left"===t||"right"===t,E5=t=>"top"===t||"bottom"===t;class P5 extends Y2{layoutZIndex=r$.Player;layoutLevel=a$.Player;static type=un.player;type=un.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return h(i)||!1===i.visible?null:new P5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),b(t.x)){const e=T5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(b(t.y)){const e=E5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{...C5(this._spec,this._specs),...e}:{...M5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new _Y(t):this._playerComponent=new bY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 v(this._spec.width)?Math.min(t.width,Number(this._spec.width)):T5(this._orient)?this._maxSize():t.width}_computeHeight(t){return v(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):E5(this._orient)?this._maxSize():t.height}_computeDx(t){return T5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return E5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size),(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(VX.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnEnd,(()=>{this.event.emit(VX.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];N(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(VX.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const R5=(t,e)=>Tl(t[0].latestData,e.field),B5=(t,e)=>El(t[0].latestData,e.field);function I5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function D5(t,e){return Pl(t[0].latestData,e.field)}function L5(t,e){return Rl(t[0].latestData,e.field)}function O5(t,e){return function(t,e){return Math.sqrt(Rl(t,e))}(t[0].latestData,e.field)}function F5(t,e){return function(t,e){return Z(t.map((t=>t[e])))}(t[0].latestData,e.field)}function z5(t,e){const i={min:R5,max:B5,sum:I5,average:D5,variance:L5,standardDeviation:O5,median:F5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(c(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(c(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function H5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.x)){v(t.x)&&V5(u,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function j5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.y)){v(t.y)&&V5(u,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function N5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();v(t.x)&&V5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),v(t.y)&&V5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function V5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const W5=["sum","average","min","max","variance","standardDeviation","median"];class G5 extends Y2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||W5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??N(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(N(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Tl(t,e),r=El(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Y5 extends G5{static type=un.markLine;type=un.markLine;name=un.markLine;layoutZIndex=r$.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new Y5(i,{...e,specKey:Y5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new Y5(t,{...e,specIndex:i,specKey:Y5.speckey}))})),n}_createMarkerComponent(){const t=new LU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:P$(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:P$(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:P$(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)||c(t.coordinates)&&c(t.process)&&c(t.process.x),a=c(t.y)||c(t.coordinates)&&c(t.process)&&c(t.process.y),o=c(t.coordinates)&&(!c(t.process)||"process"in t&&"xy"in t.process),l=c(t.positions),h=t?.autoRange??!1;let d=[];r?d=H5(e,i,n,s,h)[0]:a?d=j5(e,i,n,s,h)[0]:o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new Vo(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new Vo(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class X5 extends G5{static type=un.markArea;type=un.markArea;name=un.markArea;layoutZIndex=r$.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new X5(i,{...e,specKey:X5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new X5(t,{...e,specIndex:i,specKey:X5.speckey}))})),n}_createMarkerComponent(){const t=new OU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:P$(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)&&c(t.x1),a=c(t.y)&&c(t.y1),o=c(t.coordinates),l=c(t.positions),h=t?.autoRange??!1;let d=[],u=[];r?(u=H5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):a?(u=j5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=c(t.x)&&c(t.x1),n=c(t.y)&&c(t.y1),s=c(t.coordinates);if(!i&&!n&&!s)return null;let r;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new Vo(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class $5 extends G5{static type=un.markPoint;type=un.markPoint;name=un.markPoint;layoutZIndex=r$.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new $5(i,{...e,specKey:$5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new $5(t,{...e,specIndex:i,specKey:$5.speckey}))})),n}_createMarkerComponent(){const t=new FU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:P$(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:P$(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{...P$(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{...P$(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:P$(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=N5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!c(t.coordinate))return;rK(this._option.dataSet,"markerAggregation",z5);const i=this._processSpecCoo(t),n=new Vo(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const K5=(t,e,i)=>h(t)?t:l(t)?t(e,i):t,q5=(t,e,i)=>{if(h(t))return t;if(m(t)){const n=[];return t.forEach((t=>{if(l(t)){const s=t(e,i);c(s)&&n.push(s)}else n.push(t)})),n}return l(t)?t(e,i):t};const Z5=(t,e)=>(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight),J5="vchart-tooltip-container",Q5=20,t4={key:"其他",value:"..."},e4={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class i4{static dom=`${Kj}_TOOLTIP_HANDLER_DOM`;static canvas=`${Kj}_TOOLTIP_HANDLER_CANVAS`}const n4=(t,e,i)=>{const n=K5(e.key,t,i),s=K5(e.value,t,i),r=!1!==K5(e.visible,t,i)&&(c(n)||c(s)),a=K5(e.isKeyAdaptive,t,i),o=K5(e.shapeType,t,i),l=K5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},s4=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,r4=(t,e)=>{let i;if(c(t))if(v(t))i=t;else if(l(t)){const n=t(e);v(n)&&(i=n)}return i},a4=(t,e)=>{const i=b$(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function o4(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Ej,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var l4;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(l4||(l4={}));class h4{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),l4.success):(this._updateTooltip(!1,e),l4.success)}if(h(n)||h(s))return l4.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(c(t.visible)||c(t.activeType)?s.visible=bq(t).includes("mark"):c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=s4(i,"mark")??{},a=L({},R(e.mark),R(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(c))),[]);if(t.every((t=>!bq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=s4(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{l(t)?o.push(t):o.push(...N(t))})),r={...i[0],content:o};let d={};const u=t.filter((t=>{const e=t.tooltipHelper?.spec;return c(e?.dimension)&&bq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(u.length){let t=[];u.every((({content:t})=>h(t)))?t=void 0:u.forEach((({content:e})=>{h(e)||(l(e)?t?.push(e):t?.push(...N(e)))})),d={...u[0],content:t}}a=L({},R(e.dimension),d)}const o=r.title,d={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(c(a.title))if(l(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...d,...n}}}else a.title={...r.title,...d,...a.title};else a.title={...r.title,...d};const u=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),p=N(r.content);if(c(a.content))if(l(a.content)){const t=a.content;a.content=(e,i)=>{const n=N(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...u(p[0]),...t}})),n}}else{const t=N(a.content);t.forEach(((e,i)=>{t[i]={...u(p[0]),...e}}))}else a.content=p.map((t=>({...t,...u(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return l4.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??l4.success;const a=r[n];if(!a)return l4.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),h(o.title?.key)&&h(o.title?.value)&&!o.content?.length?l4.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??l4.success;const o=i[n];if(!o)return l4.failed;const l=this._getActualTooltipPosition(e,q5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),l4.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=v(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...e4,offsetX:t?.x??e4.offsetX,offsetY:t?.y??e4.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=q5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=q5(t.title,e,i),s=N(q5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=Q5}=t,o=!1!==K5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,c(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=K5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=n4(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...t4});break}if(!(r.content.lengthh(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=n4(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...t4});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(h(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),h(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!c(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,u=this._component.getSpec(),p="canvas"===u.renderMode,g=i?.chart?.getCanvasRect(),f=g?.width??qj,m=g?.height??Zj;let y,_,v,x,S,w,A=!1;if(d(e)){const{left:t,right:i,top:n,bottom:s}=e;y=r4(t,r),_=r4(n,r),v=r4(i,r),x=r4(s,r)}else if(c(e)&&"mark"===t.activeType){A=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case H$.left:y=t-a-l,_=(i+c)/2-o/2;break;case H$.right:y=n+l,_=(i+c)/2-o/2;break;case H$.top:y=(t+n)/2-a/2,_=i-o-h;break;case H$.bottom:y=(t+n)/2-a/2,_=c+h;break;case H$.inside:y=(t+n)/2-a/2,_=(i+c)/2-o/2}}}const k={width:0,height:0},M=(t=0)=>({x:t,y:t});let C=M(),T=M(),E=1,P=1;if(Zo(this._env)&&!u.confine){if(k.width=window.innerWidth,k.height=window.innerHeight,!p){T=n.getBoundingClientRect();const t=this._compiler.getCanvas()??this._chartContainer,e=t.getBoundingClientRect();C={x:e.x-T.x,y:e.y-T.y},E=Z5(t,e),P=Z5(n,T)}}else k.width=f,k.height=m;const{canvasX:R,canvasY:B}=r;S=b(y)?y:b(v)?f-a-v:R+l,w=b(_)?_:b(x)?m-o-x:B+h,S*=E,w*=E,Zo(this._env)&&(S+=C.x,w+=C.y),S/=P,w/=P;const{width:I,height:D}=k;return(S+a)*P+T.x>I&&(A?S=(I-T.x)/P-a:S-=2*l+a),(w+o)*P+T.y>D&&(A?w=(D-T.y)/P-o:w-=2*h+o),S*P+T.x<0&&(S=0-T.x/P),w*P+T.y<0&&(w=0-T.y/P),{x:S,y:w}};_getTooltipBoxSize(t,e){return e&&!h(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:m="",hasShape:y,shapeType:_="",shapeHollow:v,shapeColor:b}=h;if(l.title.visible=f,f){const{text:t,width:e,height:i}=a4(m,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},u=e,g=i,y&&WP[_]){const t={symbolType:_};v?t.stroke=b:t.fill=b,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],h=[],d=[];l.content=t.map(((l,u)=>{const g={height:0,spaceRow:i};let f=0;const{hasShape:m,key:y,shapeColor:_,shapeHollow:v,shapeType:b="",value:x,isKeyAdaptive:S}=l;if(c(y)){const{width:t,height:e,text:i}=a4(y,a);g.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},S?h.push(t):n.push(t),f=Math.max(f,e)}if(c(x)){const{width:t,height:e,text:i}=a4(x,o);g.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},d.push(t),f=Math.max(f,e)}if(m&&WP[b]){e=!0;const t={visible:!0,symbolType:b};v?t.stroke=_:t.fill=_,f=Math.max(r.size,f),g.shape=t}else g.shape={visible:!1};return g.height=f,p+=f,uc(t)?m(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function d4(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=L({},e,t),d={};return d.fontFamily=i,d.fontSize=c4(n),d.color=s,d.textAlign=r,d.lineHeight=c4(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=c4(c),d}function u4(t,e){if(!t)return;const{size:i}=L({},e,t),n={};return n.width=c4(i),n}class p4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===p4.type}type=p4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return p4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=qo?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(p4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const g4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},f4={boxSizing:"border-box"},m4={display:"flex",whiteSpace:"nowrap"},y4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},_4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},v4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},b4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},x4={lineHeight:"normal"};class S4 extends p4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!WP[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=WP[e].pathStr;let o="currentColor";if(!n||f(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(d(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class w4 extends p4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class A4 extends p4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=$(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=$(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},y4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=L({},a?v4:_4,{height:c4(i[n].height),...t.keyColumn.item});f(r)&&""!==r?.trim?.()||v(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=L({},b4,{height:c4(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=L({},x4,{height:c4(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class k4 extends p4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new A4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new A4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new A4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(L({},m4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class M4 extends p4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new S4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new w4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(L({},g4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class C4 extends p4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&c(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new M4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new k4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},f4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class T4 extends h4{type=i4.dom;_tooltipContainer=qo?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(qo&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:d,lineWidth:u=0},padding:p,key:g,value:f,title:m,shape:y,enterable:_,spaceRow:v,transitionDuration:b}=t,x=i,S={panel:{width:c4((e?.panel?.width??0)+2*u),height:c4((e?.panel?.height??0)+2*u),paddingBottom:c4(p.bottom),paddingLeft:c4(p.left),paddingRight:c4(p.right),paddingTop:c4(p.top),borderColor:d,borderWidth:c4(u),borderRadius:c4(h),backgroundColor:x?`${x}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:_?"auto":"none",transitionDuration:b?`${b}ms`:"initial",transitionProperty:b?"transform":"initial",transitionTimingFunction:b?"ease-out":"initial"},title:d4(m),content:{},shapeColumn:{item:u4(y),width:c4(y.size),marginRight:c4(y.spacing??8)},keyColumn:{item:d4(g),width:c4(e?.keyWidth),marginRight:c4(g.spacing??26)},valueColumn:{item:d4(f),width:c4(e?.valueWidth),marginRight:c4(f.spacing??0)},spaceRow:c4(v)};if(c(v)){const t=v/2;[S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((e=>{e.marginTop=c4(t),e.marginBottom=e.marginTop})),S.content.marginTop=c4(-t),S.content.marginBottom=S.content.marginTop}else[S.content,S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return S}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class E4 extends h4{type=i4.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new CY({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?c(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class P4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&c(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??l4.success:l4.failed}class R4 extends P4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!xq(t)&&!h(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...X$(r,a)??[],...Z$(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(c(i))break}return c(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class B4 extends P4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const I4=t=>c(t)&&!m(t),D4=t=>c(t)&&m(t);class L4 extends Y2{static type=un.tooltip;type=un.tooltip;name=un.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!m(i))return new L4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new L4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?E4:T4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new B4(this),dimension:new R4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:GX.chart},this._handleMouseMove),(Jo(e)||Qo(e))&&(this._mountEvent("pointerdown",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;Zo(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||xq(t)||(n&&I4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&D4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):c(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!h(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),r};_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};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=L({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!c(t.visible)||t.visible,activeType:bq(t),renderMode:"html",trigger:c(t.trigger)?t.trigger:"hover",className:c(t.className)?t.className:"vchart-tooltip-element",enterable:!!c(t.enterable)&&t.enterable,transitionDuration:c(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=c(t.triggerOff)?t.triggerOff:this._spec.trigger,c(t.renderMode)?this._spec.renderMode=t.renderMode:Qo(this._option.mode)&&(this._spec.renderMode="canvas"),c(t.mark)&&(this._spec.mark={...R(t.mark),activeType:"mark"}),c(t.dimension)&&(this._spec.dimension={...R(t.dimension),activeType:"dimension"}),c(t.parentElement)?f(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Zo(this._option.mode)&&(this._spec.parentElement=qo?.body),c(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=vq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:WX.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(h(this._cacheInfo)||h(t))return!1;if(D4(t)){if(I4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>D$(t,e[i])))}if(D4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(c(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(c(n)&&c(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function O4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function F4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const z4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??O4(e)};let o=!1;return f(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??F4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class H4 extends Y2{static type=un.label;type=un.label;name=un.label;layoutType="absolute";layoutZIndex=r$.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new H4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(VX.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(hV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(hV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Ll(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:R$.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:R$.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{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}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=z4[s.type]??z4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return L({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class j4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(b(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:l(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&c(t.modelId)){if(c(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&c(t.modelKey)&&"modelIndex"in t&&c(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>N4(t))),a=s.filter((t=>!N4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>N4(t))),h=o.filter((t=>!N4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);b(o.width)||(o.width=a.width),b(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function N4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class V4 extends VK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&j$(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&N$(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var W4;W4={},L(xG.poptip,W4),Wk.load(CG),wK.useChart([J1,x2,Q1,t2,L2,S2,A2,k2,I2,E2,n2,O2,v2,b2,M2,N2,V2,r2,a2,C2,R2,B2,F2,i2,z2,H2,e2,D2,m2,P2,y2]),wK.useComponent([V3,G3,U3,$3,X3,Q3,o5,L4,x5,S5,Z2,q2,h5,p5,Y5,c5,X5,P5,H4,$5,Q2,J2,c3]),B$.registerLayout("grid",j4),B$.registerLayout("layout3d",V4),t.Arc3dMark=qJ,t.ArcMark=XJ,t.AreaChart=J1,t.AreaMark=vJ,t.AreaSeries=bJ,t.Bar3dChart=t2,t.Bar3dSeries=gJ,t.BarChart=Q1,t.BarSeries=ZZ,t.BaseChart=sq,t.BaseMark=KK,t.BaseSeries=Lq,t.BoxPlotChart=e2,t.BoxPlotMark=sJ,t.BoxPlotSeries=oJ,t.Brush=Q2,t.CartesianAxis=F3,t.CartesianBandAxis=G3,t.CartesianChart=rq,t.CartesianCrossHair=x5,t.CartesianLinearAxis=V3,t.CartesianSeries=Oq,t.CartesianTimeAxis=U3,t.CellMark=q1,t.CirclePackingChart=i2,t.CirclePackingSeries=T1,t.CircularProgressChart=M2,t.CircularProgressSeries=fQ,t.CommonChart=n2,t.ComponentMark=ZK,t.ContinuousLegend=o5,t.CustomMark=J2,t.DataZoom=Z2,t.DiscreteLegend=Q3,t.DotSeries=cQ,t.Factory=B$,t.Funnel3dChart=a2,t.Funnel3dSeries=N0,t.FunnelChart=r2,t.FunnelSeries=H0,t.GaugeChart=m2,t.GaugePointerSeries=X1,t.GaugeSeries=$1,t.GeoCoordinate=p5,t.GridLayout=j4,t.GroupMark=qK,t.HeatmapChart=y2,t.HeatmapSeries=Z1,t.Histogram3dChart=b2,t.HistogramChart=v2,t.Indicator=h5,t.Label=H4,t.Layout=VK,t.Layout3d=V4,t.LineChart=x2,t.LineMark=dJ,t.LineSeries=uJ,t.LinearProgressChart=C2,t.LinearProgressSeries=yQ,t.LinkPathMark=j1,t.LinkSeries=uQ,t.MapChart=S2,t.MapLabelComponent=c3,t.MapSeries=jJ,t.MarkArea=X5,t.MarkLine=Y5,t.MarkPoint=$5,t.PathMark=OJ,t.Pie3dChart=k2,t.Pie3dSeries=ZJ,t.PieChart=A2,t.PieSeries=KJ,t.Player=P5,t.PolarAxis=Y3,t.PolarBandAxis=$3,t.PolarChart=g2,t.PolarCrossHair=S5,t.PolarLinearAxis=X3,t.PolarSeries=NJ,t.PolygonMark=z0,t.ProgressArcMark=gQ,t.ProgressLikeChart=f2,t.ProgressLikeSeries=pQ,t.Pyramid3dMark=j0,t.RadarChart=E2,t.RadarSeries=aQ,t.RangeAreaChart=P2,t.RangeAreaSeries=SJ,t.RangeColumn3dChart=B2,t.RangeColumn3dSeries=_J,t.RangeColumnChart=R2,t.RangeColumnSeries=yJ,t.Rect3dMark=pJ,t.RectMark=KZ,t.RoseChart=I2,t.RoseLikeChart=T2,t.RoseLikeSeries=sQ,t.RoseSeries=rQ,t.RuleMark=JZ,t.SankeyChart=D2,t.SankeySeries=N1,t.ScatterChart=L2,t.ScatterSeries=nQ,t.ScrollBar=q2,t.SequenceChart=O2,t.SunburstChart=F2,t.SunburstSeries=k1,t.SymbolMark=aJ,t.TextMark=qZ,t.ThemeManager=v$,t.Title=c5,t.Tooltip=L4,t.TreeMapChart=z2,t.TreeMapSeries=Y1,t.VChart=wK,t.WaterfallChart=H2,t.WaterfallSeries=QZ,t.WordCloud3dChart=V2,t.WordCloud3dSeries=S0,t.WordCloudChart=N2,t.WordCloudSeries=x0,t.default=wK,t.version="1.1.1",Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/react-vchart/CHANGELOG.json b/packages/react-vchart/CHANGELOG.json index b40ce60d35..38c25104a1 100644 --- a/packages/react-vchart/CHANGELOG.json +++ b/packages/react-vchart/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@visactor/react-vchart", "entries": [ + { + "version": "1.1.1", + "tag": "@visactor/react-vchart_v1.1.1", + "date": "Fri, 28 Jul 2023 08:52:08 GMT", + "comments": { + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vchart\" from `1.1.0` to `1.1.1`" + } + ] + } + }, { "version": "1.1.0", "tag": "@visactor/react-vchart_v1.1.0", diff --git a/packages/react-vchart/CHANGELOG.md b/packages/react-vchart/CHANGELOG.md index 067eb166fd..1c1c33f1e0 100644 --- a/packages/react-vchart/CHANGELOG.md +++ b/packages/react-vchart/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log - @visactor/react-vchart -This log was last generated on Wed, 26 Jul 2023 03:18:52 GMT and should not be manually modified. +This log was last generated on Fri, 28 Jul 2023 08:52:08 GMT and should not be manually modified. + +## 1.1.1 +Fri, 28 Jul 2023 08:52:08 GMT + +_Version update only_ ## 1.1.0 Wed, 26 Jul 2023 03:18:52 GMT diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index 8436e969a0..a273eb1758 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vchart", - "version": "1.1.0", + "version": "1.1.1", "description": "The react version of VChart 4.x", "keywords": [ "react", @@ -28,7 +28,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vchart": "workspace:1.1.0", + "@visactor/vchart": "workspace:1.1.1", "@visactor/vutils": "~0.13.3", "@visactor/vgrammar": "~0.5.1", "@visactor/vrender": "~0.13.4", diff --git a/packages/taro-vchart/CHANGELOG.json b/packages/taro-vchart/CHANGELOG.json index 99a02fcfb0..fa6a9e0a06 100644 --- a/packages/taro-vchart/CHANGELOG.json +++ b/packages/taro-vchart/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@visactor/taro-vchart", "entries": [ + { + "version": "1.1.1", + "tag": "@visactor/taro-vchart_v1.1.1", + "date": "Fri, 28 Jul 2023 08:52:08 GMT", + "comments": { + "dependency": [ + { + "comment": "Updating dependency \"@visactor/vchart\" from `1.1.0` to `1.1.1`" + } + ] + } + }, { "version": "1.1.0", "tag": "@visactor/taro-vchart_v1.1.0", diff --git a/packages/taro-vchart/CHANGELOG.md b/packages/taro-vchart/CHANGELOG.md index 1e68bc23aa..0624dd22c2 100644 --- a/packages/taro-vchart/CHANGELOG.md +++ b/packages/taro-vchart/CHANGELOG.md @@ -1,6 +1,11 @@ # Change Log - @visactor/taro-vchart -This log was last generated on Wed, 26 Jul 2023 03:18:52 GMT and should not be manually modified. +This log was last generated on Fri, 28 Jul 2023 08:52:08 GMT and should not be manually modified. + +## 1.1.1 +Fri, 28 Jul 2023 08:52:08 GMT + +_Version update only_ ## 1.1.0 Wed, 26 Jul 2023 03:18:52 GMT diff --git a/packages/taro-vchart/package.json b/packages/taro-vchart/package.json index 1712f08b7a..c8f815a39a 100644 --- a/packages/taro-vchart/package.json +++ b/packages/taro-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/taro-vchart", - "version": "1.1.0", + "version": "1.1.1", "description": "Taro VChart 图表组件", "sideEffects": false, "main": "lib/src/index.js", @@ -40,7 +40,7 @@ }, "license": "MIT", "dependencies": { - "@visactor/vchart": "workspace:1.1.0" + "@visactor/vchart": "workspace:1.1.1" }, "devDependencies": { "@internal/eslint-config": "workspace:*", diff --git a/packages/tt-vchart/src/vchart/index.js b/packages/tt-vchart/src/vchart/index.js index faa925baed..f02004a875 100644 --- a/packages/tt-vchart/src/vchart/index.js +++ b/packages/tt-vchart/src/vchart/index.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var s={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}]`,o=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||a(t,"Boolean")},l=t=>"function"==typeof t,h=t=>null==t,c=t=>null!=t,d=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},u=t=>"object"==typeof t&&null!==t,p=function(t){if(!u(t)||!a(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},g=t=>void 0===t,f=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||a(t,"String")},m=t=>Array.isArray?Array.isArray(t):a(t,"Array"),y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},_=t=>a(t,"Date"),v=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||a(t,"Number")},b=t=>v(t)&&Number.isFinite(t),x=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),S=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),w=Object.prototype,A=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)},k=Object.prototype.hasOwnProperty;function M(t){if(h(t))return!0;if(y(t))return!t.length;const e=S(t);if("Map"===e||"Set"===e)return!t.size;if(A(t))return!Object.keys(t).length;for(const e in t)if(k.call(t,e))return!1;return!0}const C=(t,e,i)=>{const n=f(e)?e.split("."):e;for(let e=0;enull!=t&&T.call(t,e);function P(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,o){if(null===i)return null;if(0===o)return i;let l;if("object"!=typeof i)return i;if(m(i)?l=[]:a(i,"RegExp")?(l=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(l.lastIndex=i.lastIndex)):l=_(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(l)}for(const e in i)l[e]=t(i[e],o-1);return l}(t,i)}function R(t){let e;if(!c(t)||"object"!=typeof t)return t;const i=m(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:o(t)||v(t)||f(t)?t:_(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=R(n)}return e}function B(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(c(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];c(n[r])&&"object"==typeof n[r]?I(t,e,r,i):D(t,r,n[r])}}}}function I(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(m(r)){if(n)a=[];else if(m(s))a=s;else if(y(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!z(t[i],e[i]))return!1;return!0}if(!p(t))return!1;const i=F(t),n=F(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!z(t[s],e[s]))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;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function G(t,e){if(!m(t)||!m(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Y(t,e,i){c(e)||(e=t,t=0),c(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function $(t){return Number(t)}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function q(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(h(n)&&(n=t.length);i>>1;X(t[s],e)>0?n=s:i=s+1}return i}const Z=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(X)),K(i,.5)},J=Math.sqrt(50),Q=Math.sqrt(10),et=Math.sqrt(2);function it(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=J?s*=10:r>=Q?s*=5:r>=et&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:nt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function at(t,e,i,n){return t>e&&!rt(t,e,i,n)}function ot(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},ht=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?lt(n,r)+s:"center"===i?lt(n,Math.floor(r/2))+s+lt(n,Math.ceil(r/2)):s+lt(n,r)},ct=function(t,e,i){return ti?i:t},dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,p=!0;const g=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function y(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function _(){const t=Date.now();if(y(t))return v(t);o=m(_,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function v(t){return o=void 0,p&&n?f(t):(n=s=void 0,a)}function x(){const t=Date.now(),i=y(t);for(var r=arguments.length,d=new Array(r),p=0;pt*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const _t=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vt=new RegExp(_t.source,"g");const bt=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function xt(t){if(t instanceof Date)return t;if(f(t)){const e=bt.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return h(t)?new Date(NaN):new Date(Math.round(t))}const St=1e-12,wt=Math.PI,At=wt/2,kt=2*wt,Mt=2*Math.PI,Ct=Math.abs,Tt=Math.atan2,Et=Math.cos,Pt=Math.max,Rt=Math.min,Bt=Math.sin,It=Math.sqrt,Dt=Math.pow;function Lt(t){return t>1?0:t<-1?wt:Math.acos(t)}function Ot(t){return t>=1?At:t<=-1?-At:Math.asin(t)}function Ft(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function zt(t,e){return t[0]*e[1]-t[1]*e[0]}class Ht{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ht(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 v(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return v(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 jt{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Ht((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return m(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Nt(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 Wt extends Vt{}function Gt(t){return t*(Math.PI/180)}function Ut(t){return 180*t/Math.PI}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-kt;)t+=kt;else if(t>0)for(;t>kt;)t-=kt;return t},Xt=Yt;function $t(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Kt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new qt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new qt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new qt(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=Ut(r.rotateDeg),r}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return v(t)?new re(t>>16,t>>8&255,255&t,1):m(t)?new re(t[0],t[1],t[2]):new re(255,255,255)}let se=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(c(te[t]))return function(t){return v(t)?new re(t>>>24,t>>>16&255,t>>>8&255,255&t):m(t)?new re(t[0],t[1],t[2],t[3]):new re(255,255,255,1)}(te[t]);if(c(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new re((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new re(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new re(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new re(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new re(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}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}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=Zt(h(t)?s.h:ct(t,0,360),h(e)?s.s:e>=0&&e<=1?100*e:e,h(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new re(r.r,r.g,r.b,n),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}};class re{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)),c(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ae(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new re(e,c,d,l*(1-t)+h*t)}},rgbToHex:oe,rgbToHsl:Jt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ye;function _e(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}function be(t,e,i){return null===t?e:null===e?t:(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,i&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>=fe||de<=ge||ue>=ye||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ye)})}var xe;function Se(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me]),ce>fe||deye||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function ke(t){return t/180*Math.PI}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?t.angle:ke(t.angle),n=Me(t);return[Ae({x:t.x1,y:t.y1},i,n),Ae({x:t.x2,y:t.y1},i,n),Ae({x:t.x2,y:t.y2},i,n),Ae({x:t.x1,y:t.y2},i,n)]}let Te,Ee,Pe,Re;function Be(t){return Te=1/0,Ee=1/0,Pe=-1/0,Re=-1/0,t.forEach((t=>{Te>t.x&&(Te=t.x),Pet.y&&(Ee=t.y),Ree&&r>n||rs?o:0}function Fe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class He{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(),c(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=c(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(h(this._canvas)&&(c(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),h(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&c(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),h(this._context)&&c(this._canvas)){const t=this._canvas.getContext("2d");c(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!h(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(h(t))return{width:0,height:0};if(h(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 c;try{const h=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});c={width:h.width(),height:h.height()}}catch(e){this._notSupportVRender=!0,c=this.measureWithNaiveCanvas(t)}return c}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}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===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(h(this._numberCharSize)){const t=this._standardMethod(He.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/He.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return h(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(He.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(h(this._letterCharSize)){const t=this._standardMethod(He.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/He.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return c(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){c(this._canvas)&&(this._canvas=null),c(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}He.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",He.NUMBERS_CHAR_SET="0123456789",He.FULL_SIZE_CHAR="字";const je="undefined"!=typeof console;function Ne(t,e,i){const n=[e].concat([].slice.call(i));je&&console[t].apply(console,n)}var Ve;!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"}(Ve||(Ve={}));class We{static getInstance(t,e){return We._instance&&v(t)?We._instance.level(t):We._instance||(We._instance=new We(t,e)),We._instance}static setInstance(t){return We._instance=t}static setInstanceLevel(t){We._instance?We._instance.level(t):We._instance=new We(t)}static clearInstance(){We._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Ve.Info}canLogDebug(){return this._level>=Ve.Debug}canLogError(){return this._level>=Ve.Error}canLogWarn(){return this._level>=Ve.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Ve.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):Ne(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Warn&&Ne(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Info&&Ne(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Debug&&Ne(this._method||"log","DEBUG",e),this}}function Ge(t){if(b(t))return[t,t,t,t];if(m(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(d(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 Ue(t){return t?"getUTCFullYear":"getFullYear"}function Ye(t){return t?"getUTCMonth":"getMonth"}function Xe(t){return t?"getUTCDate":"getDate"}function $e(t){return t?"getUTCHours":"getHours"}function Ke(t){return t?"getUTCMinutes":"getMinutes"}function qe(t){return t?"getUTCSeconds":"getSeconds"}function Ze(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Je(t){return t?"setUTCFullYear":"setFullYear"}We._instance=null;const Qe=1e3,ti=6e4,ei=36e5,ii=24*ei,ni=31*ii,si=365*ii,ri=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),ai=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),oi=(t,e)=>e.getFullYear()-t.getFullYear(),li=t=>t.getFullYear(),hi=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),ci=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),di=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),ui=t=>t.getUTCFullYear(),pi=t=>(t.setDate(1),t.setHours(0,0,0,0),t),gi=(t,e)=>(t.setMonth(t.getMonth()+e),t),fi=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),mi=t=>t.getMonth(),yi=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),_i=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),vi=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),bi=t=>t.getUTCMonth(),xi=t=>(t.setHours(0,0,0,0),t),Si=(t,e)=>(t.setDate(t.getDate()+e),t),wi=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ii,Ai=t=>t.getDate()-1,ki=t=>(t.setUTCHours(0,0,0,0),t),Mi=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Ci=(t,e)=>(+e-+t)/ii,Ti=t=>t.getUTCDate()-1,Ei=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),Pi=(t,e)=>(t.setHours(t.getHours()+e),t),Ri=(t,e)=>(+e-+t)/ei,Bi=t=>t.getHours(),Ii=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),Di=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Li=t=>t.getUTCHours(),Oi=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),Fi=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),zi=(t,e)=>(+e-+t)/6e4,Hi=t=>t.getMinutes(),ji=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),Ni=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Vi=t=>t.getUTCMinutes(),Wi=t=>(t.setTime(+t-t.getMilliseconds()),t),Gi=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ui=(t,e)=>(+e-+t)/1e3,Yi=t=>t.getSeconds(),Xi=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),$i=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ki=t=>t.getUTCSeconds(),qi=t=>t,Zi=(t,e)=>(t.setTime(+t+e),t),Ji=(t,e)=>+e-+t,Qi=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},tn=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Qi(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Qi(h,c)}};function en(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function nn(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var sn=6371008.8,rn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*sn,kilometers:6371.0088,kilometres:6371.0088,meters:sn,metres:sn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:sn/1852,radians:1,yards:6967335.223679999};function an(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function on(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ln(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function hn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Gt(t[0]),r=Gt(t[1]),a=Gt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=rn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Ut(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Ut(l)}}const cn=t=>t;var dn,un;t.RenderModeEnum=void 0,(dn=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",dn["mobile-browser"]="mobile-browser",dn.node="node",dn.worker="worker",dn.miniApp="miniApp",dn["desktop-miniApp"]="desktop-miniApp",dn.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(un||(un={}));for(let t=0;t<256;t++)t.toString(16);const pn=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};function gn(){return new fn}function fn(){this.reset()}fn.prototype={constructor:fn,reset:function(){this.s=this.t=0},add:function(t){yn(mn,t,this.t),yn(this,mn.s,this.s),this.s?this.t+=mn.t:this.s=mn.t},valueOf:function(){return this.s}};var mn=new fn;function yn(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var _n=1e-6,vn=Math.PI,bn=vn/2,xn=vn/4,Sn=2*vn,wn=180/vn,An=vn/180,kn=Math.abs,Mn=Math.atan,Cn=Math.atan2,Tn=Math.cos,En=Math.exp,Pn=Math.log,Rn=Math.pow,Bn=Math.sin,In=Math.sign||function(t){return t>0?1:t<0?-1:0},Dn=Math.sqrt,Ln=Math.tan;function On(t){return t>1?0:t<-1?vn:Math.acos(t)}function Fn(t){return t>1?bn:t<-1?-bn:Math.asin(t)}function zn(){}function Hn(t,e){t&&Nn.hasOwnProperty(t.type)&&Nn[t.type](t,e)}var jn={Feature:function(t,e){Hn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nvn?t+Math.round(-t/Sn)*Sn:t,e]}function ts(t,e,i){return(t%=Sn)?e||i?Jn(is(t),ns(e,i)):is(t):e||i?ns(e,i):Qn}function es(t){return function(e,i){return[(e+=t)>vn?e-Sn:e<-vn?e+Sn:e,i]}}function is(t){var e=es(t);return e.invert=es(-t),e}function ns(t,e){var i=Tn(t),n=Bn(t),s=Tn(e),r=Bn(e);function a(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*i+o*n;return[Cn(l*s-c*r,o*i-h*n),Fn(c*s+l*r)]}return a.invert=function(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*s-l*r;return[Cn(l*s+h*r,o*i+c*n),Fn(c*i-o*n)]},a}function ss(t,e){(e=Yn(e))[0]-=t,Zn(e);var i=On(-e[1]);return((-e[2]<0?-i:i)+Sn-_n)%Sn}function rs(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:zn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function as(t,e){return kn(t[0]-e[0])<_n&&kn(t[1]-e[1])<_n}function os(t,e,i,n){this.x=t,this.z=e,this.o=i,this.e=n,this.v=!1,this.n=this.p=null}function ls(t,e,i,n,s){var r,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,i,n=t[0],a=t[e];if(as(n,a)){if(!n[2]&&!a[2]){for(s.lineStart(),r=0;r=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function hs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function ps(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function gs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=rs(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=y,u.lineStart=_,u.lineEnd=v,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=ps(a);var t=function(t,e){var i=ds(e),n=e[1],s=Bn(n),r=[Bn(i),-Tn(i),0],a=0,o=0;cs.reset(),1===s?n=bn+_n:-1===s&&(n=-bn-_n);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>vn,C=f*x;if(cs.add(Cn(C*A*Bn(k),m*S+C*Tn(k))),a+=M?w+A*Sn:w,M^p>=i^v>=i){var T=$n(Yn(u),Yn(_));Zn(T);var E=$n(r,T);Zn(E);var P=(M^w>=0?-1:1)*Fn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-_n||a<_n&&cs<-_n)^1&o}(r,n);a.length?(d||(s.polygonStart(),d=!0),ls(a,ms,t,i,s)):t&&(d||(s.polygonStart(),d=!0),s.lineStart(),i(null,null,1,s),s.lineEnd()),d&&(s.polygonEnd(),d=!1),a=r=null},sphere:function(){s.polygonStart(),s.lineStart(),i(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function p(e,i){t(e,i)&&s.point(e,i)}function g(t,e){l.point(t,e)}function f(){u.point=g,l.lineStart()}function m(){u.point=p,l.lineEnd()}function y(t,e){o.push([t,e]),c.point(t,e)}function _(){c.lineStart(),o=[]}function v(){y(o[0][0],o[0][1]),c.lineEnd();var t,e,i,n,l=c.clean(),u=h.result(),p=u.length;if(o.pop(),r.push(o),o=null,p)if(1&l){if((e=(i=u[0]).length-1)>0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(fs))}return u}}function fs(t){return t.length>1}function ms(t,e){return((t=t.x)[0]<0?t[1]-bn-_n:bn-t[1])-((e=e.x)[0]<0?e[1]-bn-_n:bn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return us(e(t),i)})}(us);var ys=gs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?vn:-vn,l=kn(r-i);kn(l-vn)<_n?(t.point(i,n=(n+a)/2>0?bn:-bn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=vn&&(kn(i-s)<_n&&(i-=s*_n),kn(r-o)<_n&&(r-=o*_n),n=function(t,e,i,n){var s,r,a=Bn(t-i);return kn(a)>_n?Mn((Bn(e)*(r=Tn(n))*Bn(i)-Bn(n)*(s=Tn(e))*Bn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*bn,n.point(-vn,s),n.point(0,s),n.point(vn,s),n.point(vn,0),n.point(vn,-s),n.point(0,-s),n.point(-vn,-s),n.point(-vn,0),n.point(-vn,s);else if(kn(t[0]-e[0])>_n){var r=t[0]0,s=kn(e)>_n;function r(t,i){return Tn(t)*Tn(i)>e}function a(t,i,n){var s=[1,0,0],r=$n(Yn(t),Yn(i)),a=Xn(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=$n(s,r),u=qn(s,h);Kn(u,qn(r,c));var p=d,g=Xn(u,p),f=Xn(p,p),m=g*g-f*(Xn(u,u)-1);if(!(m<0)){var y=Dn(m),_=qn(p,(-g-y)/f);if(Kn(_,u),_=Un(_),!n)return _;var v,b=t[0],x=i[0],S=t[1],w=i[1];x0^_[1]<(kn(_[0]-b)<_n?S:w):S<=_[1]&&_[1]<=w:A>vn^(b<=_[0]&&_[0]<=x)){var M=qn(p,(-g+y)/f);return Kn(M,u),[_,Un(M)]}}}function o(e,i){var s=n?t:vn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return gs(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=n?f?0:o(d,u):f?o(d+(d<0?vn:-vn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||as(e,p)||as(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(s&&e&&n^f){var y;m&i||!(y=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!f||e&&as(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Tn(e),o=Bn(e),l=n*i;null==s?(s=e+n*Sn,r=e-l/2):(s=ss(a,s),r=ss(a,r),(n>0?sr)&&(s+=n*Sn));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return kn(n[0]-t)<_n?s>0?0:3:kn(n[0]-i)<_n?s>0?2:1:kn(n[1]-e)<_n?s>0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,y,_,v=a,b=rs(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);y=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,s=(l=ps(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&ls(l,o,e,r,a),a.polygonEnd());v=a,l=h=c=null}};function S(t,e){s(t,e)&&v.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),y)d=r,u=a,p=o,y=!1,o&&(v.lineStart(),v.point(r,a));else if(o&&m)v.point(r,a);else{var l=[g=Math.max(bs,Math.min(vs,g)),f=Math.max(bs,Math.min(vs,f))],b=[r=Math.max(bs,Math.min(vs,r)),a=Math.max(bs,Math.min(vs,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(v.lineStart(),v.point(r,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),o||v.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ss(t){return t}var ws,As,ks,Ms,Cs=gn(),Ts=gn(),Es={point:zn,lineStart:zn,lineEnd:zn,polygonStart:function(){Es.lineStart=Ps,Es.lineEnd=Is},polygonEnd:function(){Es.lineStart=Es.lineEnd=Es.point=zn,Cs.add(kn(Ts)),Ts.reset()},result:function(){var t=Cs/2;return Cs.reset(),t}};function Ps(){Es.point=Rs}function Rs(t,e){Es.point=Bs,ws=ks=t,As=Ms=e}function Bs(t,e){Ts.add(Ms*t-ks*e),ks=t,Ms=e}function Is(){Bs(ws,As)}var Ds=Es,Ls=1/0,Os=Ls,Fs=-Ls,zs=Fs,Hs={point:function(t,e){tFs&&(Fs=t);ezs&&(zs=e)},lineStart:zn,lineEnd:zn,polygonStart:zn,polygonEnd:zn,result:function(){var t=[[Ls,Os],[Fs,zs]];return Fs=zs=-(Os=Ls=1/0),t}};var js,Ns,Vs,Ws,Gs=Hs,Us=0,Ys=0,Xs=0,$s=0,Ks=0,qs=0,Zs=0,Js=0,Qs=0,tr={point:er,lineStart:ir,lineEnd:rr,polygonStart:function(){tr.lineStart=ar,tr.lineEnd=or},polygonEnd:function(){tr.point=er,tr.lineStart=ir,tr.lineEnd=rr},result:function(){var t=Qs?[Zs/Qs,Js/Qs]:qs?[$s/qs,Ks/qs]:Xs?[Us/Xs,Ys/Xs]:[NaN,NaN];return Us=Ys=Xs=$s=Ks=qs=Zs=Js=Qs=0,t}};function er(t,e){Us+=t,Ys+=e,++Xs}function ir(){tr.point=nr}function nr(t,e){tr.point=sr,er(Vs=t,Ws=e)}function sr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,er(Vs=t,Ws=e)}function rr(){tr.point=er}function ar(){tr.point=lr}function or(){hr(js,Ns)}function lr(t,e){tr.point=hr,er(js=Vs=t,Ns=Ws=e)}function hr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,Zs+=(s=Ws*t-Vs*e)*(Vs+t),Js+=s*(Ws+e),Qs+=3*s,er(Vs=t,Ws=e)}var cr=tr;function dr(t){this._context=t}dr.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,Sn)}},result:zn};var ur,pr,gr,fr,mr,yr=gn(),_r={point:zn,lineStart:function(){_r.point=vr},lineEnd:function(){ur&&br(pr,gr),_r.point=zn},polygonStart:function(){ur=!0},polygonEnd:function(){ur=null},result:function(){var t=+yr;return yr.reset(),t}};function vr(t,e){_r.point=br,pr=fr=t,gr=mr=e}function br(t,e){fr-=t,mr-=e,yr.add(Dn(fr*fr+mr*mr)),fr=t,mr=e}var xr=_r;function Sr(){this._string=[]}function wr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ar(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Gn(t,i(n))),n.result()}return r.area=function(t){return Gn(t,i(Ds)),Ds.result()},r.measure=function(t){return Gn(t,i(xr)),xr.result()},r.bounds=function(t){return Gn(t,i(Gs)),Gs.result()},r.centroid=function(t){return Gn(t,i(cr)),cr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ss):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Sr):new dr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function kr(t){return function(e){var i=new Mr;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Mr(){}function Cr(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Gn(i,t.stream(Gs)),e(Gs.result()),null!=n&&t.clipExtent(n),t}function Tr(t,e,i){return Cr(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Er(t,e,i){return Tr(t,[[0,0],e],i)}function Pr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Rr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Sr.prototype={_radius:4.5,_circle:wr(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=wr(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}},Mr.prototype={constructor:Mr,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 Br=16,Ir=Tn(30*An);function Dr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,m){var y=h-n,_=c-s,v=y*y+_*_;if(v>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Dn(b*b+x*x+S*S),A=Fn(S/=w),k=kn(kn(S)-1)<_n||kn(r-d)<_n?(r+d)/2:Cn(x,b),M=t(k,A),C=M[0],T=M[1],E=C-n,P=T-s,R=_*E-y*P;(R*R/v>e||kn((y*E+_*P)/v-.5)>.3||a*u+o*p+l*g2?t[2]%360*An:0,E()):[m*wn,y*wn,_*wn]},C.angle=function(t){return arguments.length?(v=t%360*An,E()):v*wn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Dr(o,M=t*t),P()):Dn(M)},C.fitExtent=function(t,e){return Tr(C,t,e)},C.fitSize=function(t,e){return Er(C,t,e)},C.fitWidth=function(t,e){return Pr(C,t,e)},C.fitHeight=function(t,e){return Rr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function jr(t){var e=0,i=vn/3,n=Hr(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*An,i=t[1]*An):[e*wn,i*wn]},s}function Nr(t,e){var i=Bn(t),n=(i+Bn(e))/2;if(kn(n)<_n)return function(t){var e=Tn(t);function i(t,i){return[t*e,Bn(i)/e]}return i.invert=function(t,i){return[t/e,Fn(i*e)]},i}(t);var s=1+i*(2*n-i),r=Dn(s)/n;function a(t,e){var i=Dn(s-2*n*Bn(e))/n;return[i*Bn(t*=n),r-i*Tn(t)]}return a.invert=function(t,e){var i=r-e,a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,Fn((s-(t*t+i*i)*n*n)/(2*n))]},a}function Vr(){return jr(Nr).scale(155.424).center([0,33.6442])}function Wr(){return Vr().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Gr(t){return function(e,i){var n=Tn(e),s=Tn(i),r=t(n*s);return[r*s*Bn(e),r*Bn(i)]}}function Ur(t){return function(e,i){var n=Dn(e*e+i*i),s=t(n),r=Bn(s),a=Tn(s);return[Cn(e*r,n*a),Fn(n&&i*r/n)]}}var Yr=Gr((function(t){return Dn(2/(1+t))}));Yr.invert=Ur((function(t){return 2*Fn(t/2)}));var Xr=Gr((function(t){return(t=On(t))&&t/Bn(t)}));function $r(t,e){return[t,Pn(Ln((bn+e)/2))]}function Kr(){return qr($r).scale(961/Sn)}function qr(t){var e,i,n,s=zr(t),r=s.center,a=s.scale,o=s.translate,l=s.clipExtent,h=null;function c(){var r=vn*a(),o=s(function(t){function e(e){return(e=t(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e}return t=ts(t[0]*An,t[1]*An,t.length>2?t[2]*An:0),e.invert=function(e){return(e=t.invert(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e},e}(s.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),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function Zr(t){return Ln((bn+t)/2)}function Jr(t,e){var i=Tn(t),n=t===e?Bn(t):Pn(i/Tn(e))/Pn(Zr(e)/Zr(t)),s=i*Rn(Zr(t),n)/n;if(!n)return $r;function r(t,e){s>0?e<-bn+_n&&(e=-bn+_n):e>bn-_n&&(e=bn-_n);var i=s/Rn(Zr(e),n);return[i*Bn(n*t),s-i*Tn(n*t)]}return r.invert=function(t,e){var i=s-e,r=In(n)*Dn(t*t+i*i),a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,2*Mn(Rn(s/r,1/n))-bn]},r}function Qr(t,e){return[t,e]}function ta(t,e){var i=Tn(t),n=t===e?Bn(t):(i-Tn(e))/(e-t),s=i/n+t;if(kn(n)<_n)return Qr;function r(t,e){var i=s-e,r=n*t;return[i*Bn(r),s-i*Tn(r)]}return r.invert=function(t,e){var i=s-e,r=Cn(t,kn(i))*In(i);return i*n<0&&(r-=vn*In(t)*In(i)),[r/n,s-In(n)*Dn(t*t+i*i)]},r}Xr.invert=Ur((function(t){return t})),$r.invert=function(t,e){return[t,2*Mn(En(e))-bn]},Qr.invert=Qr;var ea=1.340264,ia=-.081106,na=893e-6,sa=.003796,ra=Dn(3)/2;function aa(t,e){var i=Fn(ra*Bn(e)),n=i*i,s=n*n*n;return[t*Tn(i)/(ra*(ea+3*ia*n+s*(7*na+9*sa*n))),i*(ea+ia*n+s*(na+sa*n))]}function oa(t,e){var i=Tn(e),n=Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function la(t,e){var i=e*e,n=i*i;return[t*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791)),e*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))]}function ha(t,e){return[Tn(e)*Bn(t),Bn(e)]}function ca(t,e){var i=Tn(e),n=1+Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function da(t,e){return[Pn(Ln((bn+e)/2)),-t]}aa.invert=function(t,e){for(var i,n=e,s=n*n,r=s*s*s,a=0;a<12&&(r=(s=(n-=i=(n*(ea+ia*s+r*(na+sa*s))-e)/(ea+3*ia*s+r*(7*na+9*sa*s)))*n)*s*s,!(kn(i)<1e-12));++a);return[ra*t*(ea+3*ia*s+r*(7*na+9*sa*s))/Tn(n),Fn(Bn(n)/ra)]},oa.invert=Ur(Mn),la.invert=function(t,e){var i,n=e,s=25;do{var r=n*n,a=r*r;n-=i=(n*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))-e)/(1.007226+r*(.045255+a*(.259866*r-.311325-.005916*11*a)))}while(kn(i)>_n&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ha.invert=Ur(Fn),ca.invert=Ur((function(t){return 2*Mn(t)})),da.invert=function(t,e){return[-e,2*Mn(En(t))-bn]},Kr().translate([0,0]).center([0,0]).scale(63781);var ua=Object.prototype.hasOwnProperty;function pa(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^ya[2]^ya[3])}function va(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=pa(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return _a(r[t])}function S(t,e){return ga(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=Sa(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ia(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Da(t,e)}))}:Da(t,e)}function Da(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=La(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function La(t,e){var i=Ra(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function Ha(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Ba(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=ja(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=Ya(t.slice(0,n),e),o=Ya(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Xa=Ya;!function(t){var e=Xa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=Ka(Ja,e),{tolerance:n}=i;return $a(t,n)};var to;!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"}(to||(to={}));const eo=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},io=(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.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?"+"+oo(e,6):oo(e,4))+"-"+oo(t.getUTCMonth()+1,2)+"-"+oo(t.getUTCDate(),2)+(r?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"."+oo(r,3)+"Z":s?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"Z":n||i?"T"+oo(i,2)+":"+oo(n,2)+"Z":"")}function ho(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 so;if(h)return h=!1,no;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.DSV;const i=Ka(po,e),{delimiter:n}=i;if(!f(n))throw new TypeError("Invalid delimiter: must be a string!");return ho(n).parse(t)},fo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,co(t)},mo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,uo(t)};function yo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return _o(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 _o(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return bo(t);default:throw new Error("unknown GeoJSON type")}}function _o(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=vo(t.properties),e.geometry=bo(t.geometry),e}function vo(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=vo(n):e[i]=n})),e):e}function bo(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return bo(t)})),e):(e.coordinates=xo(t.coordinates),e)}function xo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return xo(t)}))}function So(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 wo(t){for(var e,i,n=So(t),s=0,r=1;r0}function Ao(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=yo(t));var r=[];switch(t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,n)})),t;case"FeatureCollection":return Ao(t,(function(t){Ao(Co(t,n),(function(t){r.push(t)}))})),on(r)}return Co(t,n)}function Co(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,e)})),t;case"LineString":return To(So(t),e),t;case"Polygon":return Eo(So(t),e),t;case"MultiLineString":return So(t).forEach((function(t){To(t,e)})),t;case"MultiPolygon":return So(t).forEach((function(t){Eo(t,e)})),t;case"Point":case"MultiPoint":return t}}function To(t,e){wo(t)===e&&t.reverse()}function Eo(t,e){wo(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Po(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Do=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.GEO;const i=Ka(Bo,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Io(t))})):e.push(Io(t))})),e})(t);let o=t.features;return a&&(o=Mo(t,{reverse:!d(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Ro.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Ro.bounds(t);t.bbox=e}})),t.features=o,t},Lo={},Oo=(t,e,i)=>{i.type=to.GEO;const n=Ka(Bo,Lo,e),{object:s}=n;if(!f(s))throw new TypeError("Invalid object: must be a string!");const r=Ia(t,t.objects[s]);return Do(r,n,i)},Fo=(t,e,i)=>{const n=!o(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!m(t))throw new TypeError("Invalid data: must be DataView array!");return m(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 zo=0;function Ho(){return zo>1e8&&(zo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+zo++}class jo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new r,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Ho("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){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){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const No="_data-view-diff-rank";class Vo{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new r,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Ho("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",io),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=R(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[No]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[No]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[No][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);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};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};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};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};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};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};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};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};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};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};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};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};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};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};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};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=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));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Go(t,e){const i=new Set(N(t)),n=new Set(N(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Uo}=le,Yo=(t,e)=>(l($o.warnHandler)&&$o.warnHandler.call(null,t,e),e?We.getInstance().warn(`[VChart warn]: ${t}`,e):We.getInstance().warn(`[VChart warn]: ${t}`)),Xo=(t,e,i)=>{const n=new Error(t);return We.getInstance().error(`[VChart error]: ${n}`,e)},$o={silent:!1,warnHandler:!1,errorHandler:!1},Ko="undefined"!=typeof window&&void 0!==window.document,qo=Ko&&globalThis.document;function Zo(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ko}function Jo(t){return"miniApp"===t||"mobile-browser"===t}function Qo(t){return t.includes("miniApp")||"lynx"===t}let tl=0;function el(){return tl>=9999999&&(tl=0),tl++}function il(t){return!h(t)&&(!!v(t)||+t==+t)}function nl(t){return!(!t||0===t.length)&&(!h(t[0])&&!h(t[0].dataId)&&m(t[0].fields))}const sl=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const rl=t=>e=>C(e,t),al=t=>{We.getInstance().error(t)},ol=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||al("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&al("Access path missing closing bracket: "+t),a&&al("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return sl((i&&i.get||rl)(n),[s],e||s)},ll=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m(t)){const n=t.map((t=>ol(t,e,i)));return t=>n.map((e=>e(t)))}return ol(t,e,i)};ll("id");const hl=sl((function(t){return t}),[],"identity"),cl=sl((function(){return 0}),[],"zero");sl((function(){return 1}),[],"one"),sl((function(){return!0}),[],"true"),sl((function(){return!1}),[],"false"),sl((function(){return{}}),[],"emptyObject");const dl=(t,e)=>{if((te||h(e))&&!h(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},ul=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>dl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=N(e)||[],s=[],r=[],a={},o=i.comparator||ul;return N(t).forEach(((t,e)=>{if(h(t))return;s.push("desc"===n[e]?-1:1);const o=l(t)?t:ll(t,null,i);var c;r.push(o),(c=o,(h(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:sl(o(r,s),Object.keys(a))},gl=(t,e)=>{const i=l(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(h(e)||h(i))return h(e)&&h(i);if(!u(e)&&!u(i))return e===i;const s=m(e)?e:e[t],r=m(i)?i:i[t];return s===r||!1!==n&&(m(r)?!(!m(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!d(r)&&!(!d(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>fl(t,r,s)))))},ml=(t,e)=>h(t)?e:Math.min(f(t)?e*parseFloat(t)/100:t,e);function yl(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!h(s)&&(s=+s)>=s&&!h(r)&&(r=+r)>=r&&n(s,r,++a)}))}function _l(t,e,i,n,s){let r=0,a=0;return yl(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function vl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;yl(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:_l(t,e,i,s,h)}}const bl=rt;function xl(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Sl=t=>b(t)?Gt(t):null,wl=t=>b(t)?Ut(t):null;function Al(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function kl(t,e,i,n){const s=Al({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function Ml(t){return 3===t||4===t}function Cl(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)}function Tl(t,e){const i=e?+t[0][e]:+t[0];if(!b(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&n{const n=e?+i[e]:+i;return b(n)&&n>t&&(t=n),t}),i)}function Pl(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;b(s)&&(i+=s,n++)}));return i/n}function Rl(t,e){const i=Pl(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Bl(t){let e="center",i="middle";return e=(t=xl(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}}function Il(t,e){const i=Dl(t),n=Dl(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 Dl(t,e={x:0,y:0}){return jt.distancePP(t,e)}function Ll(t,e,i){let n=!1;if(e&&l(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 Ol(t){return function(e){let i;return i=m(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var Fl;function zl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:return!0;default:return!1}}function Hl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}function jl(t){switch(t){case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}!function(t){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"}(Fl||(Fl={}));class Nl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Vl=Symbol("implicit");class Wl extends Nl{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=Fl.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Vl}clone(){return(new Wl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}scale(t){const e=this._getSpecifiedValue(t);if(!h(e))return e;const i=`${t}`;let n=this._index.get(i);if(!n){if(this._unknown!==Vl)return this._unknown;n=this._domain.push(t),this._index.set(i,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Yl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),Xl=t=>t<0?-t*t:t*t,$l=t=>-Math.log(-t),Kl=t=>-Math.exp(-t),ql=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Zl=t=>10===t?ql:t===Math.E?Math.exp:e=>Math.pow(t,e),Jl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Ql=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),th=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function eh(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 ih(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function nh(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class ah extends Wl{constructor(t){super(),this.type=Fl.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Y(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&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=[$(t[0]),$(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[$(t[0]),$(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:rh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}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()}clone(){return new ah(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:oh}=le;function lh(t,e){const i=typeof e;let n;if(h(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=se.parseColorString(e)){const e=oh(se.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof re?oh(t,e):e instanceof se?oh(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class hh extends Nl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Gl,this._piecewise=ih,this._interpolate=lh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,$);return this._domain=i,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){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=ut(this._domain[0],this._domain[n-1])),this._piecewise=n>2?nh:ih,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Gl),this.rescale(i)):this._clamp!==Gl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ch=Math.sqrt(50),dh=Math.sqrt(10),uh=Math.sqrt(2);function ph(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=ch?a=10:r>=dh?a=5:r>=uh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function fh(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=gh(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class _h extends hh{constructor(){super(...arguments),this.type=Fl.Linear}clone(){return(new _h).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function vh(t){return e=>-t(-e)}class bh extends hh{constructor(){super(Jl(10),Zl(10)),this.type=Fl.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new bh).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){if(t)return this;super.rescale();const e=Jl(this._base),i=Zl(this._base);return this._domain[0]<0?(this._logs=vh(e),this._pows=vh(i),this.transformer=$l,this.untransformer=Kl):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Gl}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.lengththis._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}}class xh extends ah{constructor(t){super(!1),this.type=Fl.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class Sh extends _h{constructor(){super(),this.type=Fl.Pow,this._exponent=1}clone(){return(new Sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=Gl,this.untransformer=Gl):.5===this._exponent?(this.transformer=Yl,this.untransformer=Xl):(this.transformer=Ul(this._exponent),this.untransformer=Ul(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function wh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class Ah{constructor(){this.type=Fl.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return wh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new kh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class Mh extends _h{constructor(){super(Yl,Xl),this.type=Fl.Sqrt}clone(){return(new Mh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Ch extends _h{constructor(){super(Ql(1),th(1)),this.type=Fl.Symlog,this._const=1}clone(){return(new Ch).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=Ql(t),this.untransformer=th(t),this.rescale(e)):this._const}}class Th{constructor(){this.type=Fl.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!h(t)&&b(+t)?this._range[q(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 Th).domain(this._domain).range(this._range).unknown(this._unknown)}}const Eh=[["second",1,Qe],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,ti],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,ei],["hour",3,3*ei],["hour",6,6*ei],["hour",12,12*ei],["day",1,ii],["day",2,2*ii],["day",7,7*ii],["month",1,ni],["month",3,3*ni],["month",6,6*ni],["year",1,365*ii]];function Ph(t){return+xt(t)}function Rh(t,e,i,n){const s=(+e-+t)/i,r=q(Eh.map((t=>t[2])),s);if(r===Eh.length){const s=Math.max(it(+t/si,+e/si,i),1),r=t=>(t[Je(n)](Math.floor(t[Ue(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Je(n)](t[Ue(n)]()+e*s),t);return{floor:r,offset:a,ceil:Qi(r,a)}}if(0===r){const n=Math.max(it(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Qi(s,r)}}const[a,o]=Eh[s/Eh[r-1][2]"year"===t&&e?{floor:hi,offset:ci,count:di,field:ui}:"month"===t&&e?{floor:yi,offset:_i,count:vi,field:bi}:"day"===t&&e?{floor:ki,offset:Mi,count:Ci,field:Ti}:"hour"===t&&e?{floor:Ii,offset:Di,count:Ri,field:Li}:"minute"===t&&e?{floor:ji,offset:Ni,count:zi,field:Vi}:"second"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"year"===t?{floor:ri,offset:ai,count:oi,field:li}:"month"===t?{floor:pi,offset:gi,count:fi,field:mi}:"day"===t?{floor:xi,offset:Si,count:wi,field:Ai}:"hour"===t?{floor:Ei,offset:Pi,count:Ri,field:Bi}:"minute"===t?{floor:Oi,offset:Fi,count:zi,field:Hi}:"second"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:{floor:qi,offset:Zi,count:Ji})(a,n);return tn(o,l)}class Bh extends hh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=Fl.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(xt);const i=Array.from(t,Ph);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=xt(t),s=e[Ue(n)](),r=e[Ye(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Xe(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[$e(n)](),c=(h-1)%12+1,d=e[Ke(n)](),u=e[qe(n)](),p=e[Ze(n)]();return(i||"").replace(/YYYY/g,ht(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,ht(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,ht(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,ht(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,ht(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,ht(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,ht(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,ht(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Bh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(v(t)||h(t))&&(i=Rh(e[0],e[e.length-1],h(t)?10:t,this._isUtc)),i&&this.domain(sh(e,i)),this}utc(){return this._isUtc}}function Ih(t,e){const i=c(e)?t?.[e]??t?.default:t?.default;if(!i||m(i))return i;if(d(i)){const{dataScheme:n}=i;return n?zh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c)}))):n.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c):[]}return[]}function Dh(t,e){return zh(t)?t.find((t=>c(t.isAvailable)?l(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!c(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function Lh(t,e,i){const n=c(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!c(e.a)&&!c(e.l)||!f(s))return s;let r=new Uo(s);if(c(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Jt(t,i,n),o=Zt(s,a,e.l),l=new Uo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return c(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Oh=(t,e,i)=>{if(Fh(t)&&e){const n=Lh(e,t,i);if(n)return n}return t};function Fh(t){return d(t)&&"palette"===t.type&&!!t.key}function zh(t){return!!m(t)&&t.every((t=>c(t.scheme)))}class Hh extends Wl{_range;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(!zh(this._range))return void super.range(this._range);const t=Dh(this._range,this._domain);super.range(t)}}const jh={linear:_h,band:ah,point:xh,ordinal:Wl,threshold:Th,colorOrdinal:Hh};function Nh(t){const e=jh[t];return e?new e:null}function Vh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Wh(t){return c(t?.field)&&c(t?.scale)}var Gh;function Uh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Yh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Xh(t){return!!f(t)&&(!!t.endsWith("%")&&il(t.substring(0,t.length-1)))}function $h(t,e,i){return v(t)?t:Xh(t)?Number(t.substring(0,t.length-1))*e/100:l(t)?t(i):0}function Kh(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>v(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=$h(t[s],e.size,i)}))})),n}function qh(t){let e={};return m(t)?(h(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),h(t[1])||(e.left=e.right=t[1]),h(t[2])||(e.bottom=t[2]),h(t[3])||(e.left=t[3]),e):v(t)||Xh(t)||l(t)?(e.top=e.left=e.bottom=e.right=t,e):(d(t)&&(e={...t}),e)}function Zh(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function Jh(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]=Jh(t[n],e)}return i}return m(t)?t.map((t=>Jh(t,e))):t}function Qh(t){const e=t;let i;if(!c(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof Vo||e.every((t=>i.includes(t)))}(e))return e;const n=m(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:o(e)||v(e)||f(e)?e:_(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=Qh(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(Gh||(Gh={}));var tc=function(t){return t&&t.Math==Math&&t},ec=tc("object"==typeof globalThis&&globalThis)||tc("object"==typeof window&&window)||tc("object"==typeof self&&self)||tc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),ic={},nc=function(t){try{return!!t()}catch(t){return!0}},sc=!nc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),rc=!nc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),ac=rc,oc=Function.prototype.call,lc=ac?oc.bind(oc):function(){return oc.apply(oc,arguments)},hc={},cc={}.propertyIsEnumerable,dc=Object.getOwnPropertyDescriptor,uc=dc&&!cc.call({1:2},1);hc.f=uc?function(t){var e=dc(this,t);return!!e&&e.enumerable}:cc;var pc,gc,fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},mc=rc,yc=Function.prototype,_c=yc.call,vc=mc&&yc.bind.bind(_c,_c),bc=mc?vc:function(t){return function(){return _c.apply(t,arguments)}},xc=bc,Sc=xc({}.toString),wc=xc("".slice),Ac=function(t){return wc(Sc(t),8,-1)},kc=nc,Mc=Ac,Cc=Object,Tc=bc("".split),Ec=kc((function(){return!Cc("z").propertyIsEnumerable(0)}))?function(t){return"String"==Mc(t)?Tc(t,""):Cc(t)}:Cc,Pc=function(t){return null==t},Rc=Pc,Bc=TypeError,Ic=function(t){if(Rc(t))throw Bc("Can't call method on "+t);return t},Dc=Ec,Lc=Ic,Oc=function(t){return Dc(Lc(t))},Fc="object"==typeof document&&document.all,zc={all:Fc,IS_HTMLDDA:void 0===Fc&&void 0!==Fc},Hc=zc.all,jc=zc.IS_HTMLDDA?function(t){return"function"==typeof t||t===Hc}:function(t){return"function"==typeof t},Nc=jc,Vc=zc.all,Wc=zc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Nc(t)||t===Vc}:function(t){return"object"==typeof t?null!==t:Nc(t)},Gc=ec,Uc=jc,Yc=function(t,e){return arguments.length<2?(i=Gc[t],Uc(i)?i:void 0):Gc[t]&&Gc[t][e];var i},Xc=bc({}.isPrototypeOf),$c=ec,Kc="undefined"!=typeof navigator&&String(navigator.userAgent)||"",qc=$c.process,Zc=$c.Deno,Jc=qc&&qc.versions||Zc&&Zc.version,Qc=Jc&&Jc.v8;Qc&&(gc=(pc=Qc.split("."))[0]>0&&pc[0]<4?1:+(pc[0]+pc[1])),!gc&&Kc&&(!(pc=Kc.match(/Edge\/(\d+)/))||pc[1]>=74)&&(pc=Kc.match(/Chrome\/(\d+)/))&&(gc=+pc[1]);var td=gc,ed=nc,id=ec.String,nd=!!Object.getOwnPropertySymbols&&!ed((function(){var t=Symbol();return!id(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&td&&td<41})),sd=nd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rd=Yc,ad=jc,od=Xc,ld=Object,hd=sd?function(t){return"symbol"==typeof t}:function(t){var e=rd("Symbol");return ad(e)&&od(e.prototype,ld(t))},cd=String,dd=function(t){try{return cd(t)}catch(t){return"Object"}},ud=jc,pd=dd,gd=TypeError,fd=function(t){if(ud(t))return t;throw gd(pd(t)+" is not a function")},md=fd,yd=Pc,_d=function(t,e){var i=t[e];return yd(i)?void 0:md(i)},vd=lc,bd=jc,xd=Wc,Sd=TypeError,wd={exports:{}},Ad=ec,kd=Object.defineProperty,Md=function(t,e){try{kd(Ad,t,{value:e,configurable:!0,writable:!0})}catch(i){Ad[t]=e}return e},Cd=Md,Td="__core-js_shared__",Ed=ec[Td]||Cd(Td,{}),Pd=Ed;(wd.exports=function(t,e){return Pd[t]||(Pd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Rd=wd.exports,Bd=Ic,Id=Object,Dd=function(t){return Id(Bd(t))},Ld=Dd,Od=bc({}.hasOwnProperty),Fd=Object.hasOwn||function(t,e){return Od(Ld(t),e)},zd=bc,Hd=0,jd=Math.random(),Nd=zd(1..toString),Vd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Nd(++Hd+jd,36)},Wd=Rd,Gd=Fd,Ud=Vd,Yd=nd,Xd=sd,$d=ec.Symbol,Kd=Wd("wks"),qd=Xd?$d.for||$d:$d&&$d.withoutSetter||Ud,Zd=function(t){return Gd(Kd,t)||(Kd[t]=Yd&&Gd($d,t)?$d[t]:qd("Symbol."+t)),Kd[t]},Jd=lc,Qd=Wc,tu=hd,eu=_d,iu=function(t,e){var i,n;if("string"===e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;if(bd(i=t.valueOf)&&!xd(n=vd(i,t)))return n;if("string"!==e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;throw Sd("Can't convert object to primitive value")},nu=TypeError,su=Zd("toPrimitive"),ru=function(t,e){if(!Qd(t)||tu(t))return t;var i,n=eu(t,su);if(n){if(void 0===e&&(e="default"),i=Jd(n,t,e),!Qd(i)||tu(i))return i;throw nu("Can't convert object to primitive value")}return void 0===e&&(e="number"),iu(t,e)},au=hd,ou=function(t){var e=ru(t,"string");return au(e)?e:e+""},lu=Wc,hu=ec.document,cu=lu(hu)&&lu(hu.createElement),du=function(t){return cu?hu.createElement(t):{}},uu=du,pu=!sc&&!nc((function(){return 7!=Object.defineProperty(uu("div"),"a",{get:function(){return 7}}).a})),gu=sc,fu=lc,mu=hc,yu=fc,_u=Oc,vu=ou,bu=Fd,xu=pu,Su=Object.getOwnPropertyDescriptor;ic.f=gu?Su:function(t,e){if(t=_u(t),e=vu(e),xu)try{return Su(t,e)}catch(t){}if(bu(t,e))return yu(!fu(mu.f,t,e),t[e])};var wu={},Au=sc&&nc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ku=Wc,Mu=String,Cu=TypeError,Tu=function(t){if(ku(t))return t;throw Cu(Mu(t)+" is not an object")},Eu=sc,Pu=pu,Ru=Au,Bu=Tu,Iu=ou,Du=TypeError,Lu=Object.defineProperty,Ou=Object.getOwnPropertyDescriptor,Fu="enumerable",zu="configurable",Hu="writable";wu.f=Eu?Ru?function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Hu in i&&!i[Hu]){var n=Ou(t,e);n&&n[Hu]&&(t[e]=i.value,i={configurable:zu in i?i[zu]:n[zu],enumerable:Fu in i?i[Fu]:n[Fu],writable:!1})}return Lu(t,e,i)}:Lu:function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),Pu)try{return Lu(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Du("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var ju=wu,Nu=fc,Vu=sc?function(t,e,i){return ju.f(t,e,Nu(1,i))}:function(t,e,i){return t[e]=i,t},Wu={exports:{}},Gu=sc,Uu=Fd,Yu=Function.prototype,Xu=Gu&&Object.getOwnPropertyDescriptor,$u=Uu(Yu,"name"),Ku={EXISTS:$u,PROPER:$u&&"something"===function(){}.name,CONFIGURABLE:$u&&(!Gu||Gu&&Xu(Yu,"name").configurable)},qu=jc,Zu=Ed,Ju=bc(Function.toString);qu(Zu.inspectSource)||(Zu.inspectSource=function(t){return Ju(t)});var Qu,tp,ep,ip=Zu.inspectSource,np=jc,sp=ec.WeakMap,rp=np(sp)&&/native code/.test(String(sp)),ap=Vd,op=Rd("keys"),lp=function(t){return op[t]||(op[t]=ap(t))},hp={},cp=rp,dp=ec,up=Wc,pp=Vu,gp=Fd,fp=Ed,mp=lp,yp=hp,_p="Object already initialized",vp=dp.TypeError,bp=dp.WeakMap;if(cp||fp.state){var xp=fp.state||(fp.state=new bp);xp.get=xp.get,xp.has=xp.has,xp.set=xp.set,Qu=function(t,e){if(xp.has(t))throw vp(_p);return e.facade=t,xp.set(t,e),e},tp=function(t){return xp.get(t)||{}},ep=function(t){return xp.has(t)}}else{var Sp=mp("state");yp[Sp]=!0,Qu=function(t,e){if(gp(t,Sp))throw vp(_p);return e.facade=t,pp(t,Sp,e),e},tp=function(t){return gp(t,Sp)?t[Sp]:{}},ep=function(t){return gp(t,Sp)}}var wp={set:Qu,get:tp,has:ep,enforce:function(t){return ep(t)?tp(t):Qu(t,{})},getterFor:function(t){return function(e){var i;if(!up(e)||(i=tp(e)).type!==t)throw vp("Incompatible receiver, "+t+" required");return i}}},Ap=bc,kp=nc,Mp=jc,Cp=Fd,Tp=sc,Ep=Ku.CONFIGURABLE,Pp=ip,Rp=wp.enforce,Bp=wp.get,Ip=String,Dp=Object.defineProperty,Lp=Ap("".slice),Op=Ap("".replace),Fp=Ap([].join),zp=Tp&&!kp((function(){return 8!==Dp((function(){}),"length",{value:8}).length})),Hp=String(String).split("String"),jp=Wu.exports=function(t,e,i){"Symbol("===Lp(Ip(e),0,7)&&(e="["+Op(Ip(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Cp(t,"name")||Ep&&t.name!==e)&&(Tp?Dp(t,"name",{value:e,configurable:!0}):t.name=e),zp&&i&&Cp(i,"arity")&&t.length!==i.arity&&Dp(t,"length",{value:i.arity});try{i&&Cp(i,"constructor")&&i.constructor?Tp&&Dp(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Rp(t);return Cp(n,"source")||(n.source=Fp(Hp,"string"==typeof e?e:"")),t};Function.prototype.toString=jp((function(){return Mp(this)&&Bp(this).source||Pp(this)}),"toString");var Np=Wu.exports,Vp=jc,Wp=wu,Gp=Np,Up=Md,Yp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Vp(i)&&Gp(i,r,n),n.global)s?t[e]=i:Up(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Wp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Xp={},$p=Math.ceil,Kp=Math.floor,qp=Math.trunc||function(t){var e=+t;return(e>0?Kp:$p)(e)},Zp=function(t){var e=+t;return e!=e||0===e?0:qp(e)},Jp=Zp,Qp=Math.max,tg=Math.min,eg=function(t,e){var i=Jp(t);return i<0?Qp(i+e,0):tg(i,e)},ig=Zp,ng=Math.min,sg=function(t){return t>0?ng(ig(t),9007199254740991):0},rg=function(t){return sg(t.length)},ag=Oc,og=eg,lg=rg,hg=function(t){return function(e,i,n){var s,r=ag(e),a=lg(r),o=og(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},cg={includes:hg(!0),indexOf:hg(!1)},dg=Fd,ug=Oc,pg=cg.indexOf,gg=hp,fg=bc([].push),mg=function(t,e){var i,n=ug(t),s=0,r=[];for(i in n)!dg(gg,i)&&dg(n,i)&&fg(r,i);for(;e.length>s;)dg(n,i=e[s++])&&(~pg(r,i)||fg(r,i));return r},yg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_g=mg,vg=yg.concat("length","prototype");Xp.f=Object.getOwnPropertyNames||function(t){return _g(t,vg)};var bg={};bg.f=Object.getOwnPropertySymbols;var xg=Yc,Sg=Xp,wg=bg,Ag=Tu,kg=bc([].concat),Mg=xg("Reflect","ownKeys")||function(t){var e=Sg.f(Ag(t)),i=wg.f;return i?kg(e,i(t)):e},Cg=Fd,Tg=Mg,Eg=ic,Pg=wu,Rg=nc,Bg=jc,Ig=/#|\.prototype\./,Dg=function(t,e){var i=Og[Lg(t)];return i==zg||i!=Fg&&(Bg(e)?Rg(e):!!e)},Lg=Dg.normalize=function(t){return String(t).replace(Ig,".").toLowerCase()},Og=Dg.data={},Fg=Dg.NATIVE="N",zg=Dg.POLYFILL="P",Hg=Dg,jg=ec,Ng=ic.f,Vg=Vu,Wg=Yp,Gg=Md,Ug=function(t,e,i){for(var n=Tg(e),s=Pg.f,r=Eg.f,a=0;ar;r++)if((o=y(t[r]))&&bm(Mm,o))return o;return new km(!1)}n=xm(t,s)}for(l=u?t.next:n.next;!(h=fm(l,n)).done;){try{o=y(h.value)}catch(t){wm(n,"throw",t)}if("object"==typeof o&&o&&bm(Mm,o))return o}return new km(!1)},Tm=Xc,Em=TypeError,Pm=function(t,e){if(Tm(e,t))return t;throw Em("Incorrect invocation")},Rm=Zd("iterator"),Bm=!1;try{var Im=0,Dm={next:function(){return{done:!!Im++}},return:function(){Bm=!0}};Dm[Rm]=function(){return this},Array.from(Dm,(function(){throw 2}))}catch(al){}var Lm=wu.f,Om=Fd,Fm=Zd("toStringTag"),zm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Om(t,Fm)&&Lm(t,Fm,{configurable:!0,value:e})},Hm=bc,jm=fd,Nm=jc,Vm=String,Wm=TypeError,Gm=function(t,e,i){try{return Hm(jm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Um=Tu,Ym=function(t){if("object"==typeof t||Nm(t))return t;throw Wm("Can't set "+Vm(t)+" as a prototype")},Xm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Gm(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Um(i),Ym(n),e?t(i,n):i.__proto__=n,i}}():void 0),$m=jc,Km=Wc,qm=Xm,Zm=Xg,Jm=ec,Qm=bc,ty=Hg,ey=Yp,iy=If,ny=Cm,sy=Pm,ry=jc,ay=Pc,oy=Wc,ly=nc,hy=function(t,e){if(!e&&!Bm)return!1;var i=!1;try{var n={};n[Rm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},cy=zm,dy=function(t,e,i){var n,s;return qm&&$m(n=e.constructor)&&n!==i&&Km(s=n.prototype)&&s!==i.prototype&&qm(t,s),t},uy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=Jm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=Qm(o[t]);ey(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!oy(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ty(t,!ry(a)||!(s||o.forEach&&!ly((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),iy.enable();else if(ty(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=ly((function(){d.has(1)})),g=hy((function(t){new a(t)})),f=!s&&ly((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){sy(t,o);var i=dy(new a,t,l);return ay(e)||ny(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,Zm({global:!0,constructor:!0,forced:l!=a},h),cy(l,t),s||i.setStrong(l,t,n),l},py={},gy=mg,fy=yg,my=Object.keys||function(t){return gy(t,fy)},yy=sc,_y=Au,vy=wu,by=Tu,xy=Oc,Sy=my;py.f=yy&&!_y?Object.defineProperties:function(t,e){by(t);for(var i,n=xy(e),s=Sy(e),r=s.length,a=0;r>a;)vy.f(t,i=s[a++],n[i]);return t};var wy,Ay=Yc("document","documentElement"),ky=Tu,My=py,Cy=yg,Ty=hp,Ey=Ay,Py=du,Ry="prototype",By="script",Iy=lp("IE_PROTO"),Dy=function(){},Ly=function(t){return"<"+By+">"+t+""},Oy=function(t){t.write(Ly("")),t.close();var e=t.parentWindow.Object;return t=null,e},Fy=function(){try{wy=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Fy="undefined"!=typeof document?document.domain&&wy?Oy(wy):(e=Py("iframe"),i="java"+By+":",e.style.display="none",Ey.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Ly("document.F=Object")),t.close(),t.F):Oy(wy);for(var n=Cy.length;n--;)delete Fy[Ry][Cy[n]];return Fy()};Ty[Iy]=!0;var zy,Hy,jy,Ny=Object.create||function(t,e){var i;return null!==t?(Dy[Ry]=ky(t),i=new Dy,Dy[Ry]=null,i[Iy]=t):i=Fy(),void 0===e?i:My.f(i,e)},Vy=Np,Wy=wu,Gy=function(t,e,i){return i.get&&Vy(i.get,e,{getter:!0}),i.set&&Vy(i.set,e,{setter:!0}),Wy.f(t,e,i)},Uy=Yp,Yy=function(t,e,i){for(var n in e)Uy(t,n,e[n],i);return t},Xy=!nc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),$y=Fd,Ky=jc,qy=Dd,Zy=Xy,Jy=lp("IE_PROTO"),Qy=Object,t_=Qy.prototype,e_=Zy?Qy.getPrototypeOf:function(t){var e=qy(t);if($y(e,Jy))return e[Jy];var i=e.constructor;return Ky(i)&&e instanceof i?i.prototype:e instanceof Qy?t_:null},i_=nc,n_=jc,s_=Wc,r_=e_,a_=Yp,o_=Zd("iterator"),l_=!1;[].keys&&("next"in(jy=[].keys())?(Hy=r_(r_(jy)))!==Object.prototype&&(zy=Hy):l_=!0);var h_=!s_(zy)||i_((function(){var t={};return zy[o_].call(t)!==t}));h_&&(zy={}),n_(zy[o_])||a_(zy,o_,(function(){return this}));var c_={IteratorPrototype:zy,BUGGY_SAFARI_ITERATORS:l_},d_=c_.IteratorPrototype,u_=Ny,p_=fc,g_=zm,f_=Nf,m_=function(){return this},y_=Xg,__=lc,v_=jc,b_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=u_(d_,{next:p_(+!n,i)}),g_(t,s,!1),f_[s]=m_,t},x_=e_,S_=Xm,w_=zm,A_=Vu,k_=Yp,M_=Nf,C_=Ku.PROPER,T_=Ku.CONFIGURABLE,E_=c_.IteratorPrototype,P_=c_.BUGGY_SAFARI_ITERATORS,R_=Zd("iterator"),B_="keys",I_="values",D_="entries",L_=function(){return this},O_=Yc,F_=Gy,z_=sc,H_=Zd("species"),j_=Ny,N_=Gy,V_=Yy,W_=jf,G_=Pm,U_=Pc,Y_=Cm,X_=function(t,e,i,n,s,r,a){b_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!P_&&t in p)return p[t];switch(t){case B_:case I_:case D_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[R_]||p["@@iterator"]||s&&p[s],f=!P_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=x_(m.call(new t)))!==Object.prototype&&o.next&&(x_(o)!==E_&&(S_?S_(o,E_):v_(o[R_])||k_(o,R_,L_)),w_(o,d,!0)),C_&&s==I_&&g&&g.name!==I_&&(T_?A_(p,"name",I_):(u=!0,f=function(){return __(g,this)})),s)if(l={values:c(I_),keys:r?f:c(B_),entries:c(D_)},a)for(h in l)(P_||u||!(h in p))&&k_(p,h,l[h]);else y_({target:e,proto:!0,forced:P_||u},l);return p[R_]!==f&&k_(p,R_,f,{name:s}),M_[e]=f,l},$_=function(t,e){return{value:t,done:e}},K_=function(t){var e=O_(t);z_&&e&&!e[H_]&&F_(e,H_,{configurable:!0,get:function(){return this}})},q_=sc,Z_=If.fastKey,J_=wp.set,Q_=wp.getterFor,tv={getConstructor:function(t,e,i,n){var s=t((function(t,s){G_(t,r),J_(t,{type:e,index:j_(null),first:void 0,last:void 0,size:0}),q_||(t.size=0),U_(s)||Y_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Q_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=Z_(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),q_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=Z_(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return V_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,q_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),q_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=W_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),V_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),q_&&N_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=Q_(e),r=Q_(n);X_(t,e,(function(t,e){J_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?$_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,$_(void 0,!0))}),i?"entries":"values",!i,!0),K_(e)}};uy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),tv);var ev=Ac,iv=Array.isArray||function(t){return"Array"==ev(t)},nv=bc,sv=nc,rv=jc,av=Jf,ov=ip,lv=function(){},hv=[],cv=Yc("Reflect","construct"),dv=/^\s*(?:class|function)\b/,uv=nv(dv.exec),pv=!dv.exec(lv),gv=function(t){if(!rv(t))return!1;try{return cv(lv,hv,t),!0}catch(t){return!1}},fv=function(t){if(!rv(t))return!1;switch(av(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pv||!!uv(dv,ov(t))}catch(t){return!0}};fv.sham=!0;var mv=!cv||sv((function(){var t;return gv(gv.call)||!gv(Object)||!gv((function(){t=!0}))||t}))?fv:gv,yv=iv,_v=mv,vv=Wc,bv=Zd("species"),xv=Array,Sv=function(t){var e;return yv(t)&&(e=t.constructor,(_v(e)&&(e===xv||yv(e.prototype))||vv(e)&&null===(e=e[bv]))&&(e=void 0)),void 0===e?xv:e},wv=jf,Av=Ec,kv=Dd,Mv=rg,Cv=function(t,e){return new(Sv(t))(0===e?0:e)},Tv=bc([].push),Ev=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=kv(l),f=Av(g),m=wv(h,c),y=Mv(f),_=0,v=d||Cv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Tv(b,u)}else switch(t){case 4:return!1;case 7:Tv(b,u)}return r?-1:n||s?s:b}},Pv={forEach:Ev(0),map:Ev(1),filter:Ev(2),some:Ev(3),every:Ev(4),find:Ev(5),findIndex:Ev(6),filterReject:Ev(7)},Rv=bc,Bv=Yy,Iv=If.getWeakData,Dv=Pm,Lv=Tu,Ov=Pc,Fv=Wc,zv=Cm,Hv=Fd,jv=wp.set,Nv=wp.getterFor,Vv=Pv.find,Wv=Pv.findIndex,Gv=Rv([].splice),Uv=0,Yv=function(t){return t.frozen||(t.frozen=new Xv)},Xv=function(){this.entries=[]},$v=function(t,e){return Vv(t.entries,(function(t){return t[0]===e}))};Xv.prototype={get:function(t){var e=$v(this,t);if(e)return e[1]},has:function(t){return!!$v(this,t)},set:function(t,e){var i=$v(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Wv(this.entries,(function(e){return e[0]===t}));return~e&&Gv(this.entries,e,1),!!~e}};var Kv,qv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Dv(t,r),jv(t,{type:e,id:Uv++,frozen:void 0}),Ov(s)||zv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Nv(e),o=function(t,e,i){var n=a(t),s=Iv(Lv(e),!0);return!0===s?Yv(n).set(e,i):s[n.id]=i,t};return Bv(r,{delete:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).delete(t):i&&Hv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).has(t):i&&Hv(i,e.id)}}),Bv(r,i?{get:function(t){var e=a(this);if(Fv(t)){var i=Iv(t);return!0===i?Yv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},Zv=yf,Jv=ec,Qv=bc,tb=Yy,eb=If,ib=uy,nb=qv,sb=Wc,rb=wp.enforce,ab=nc,ob=rp,lb=Object,hb=Array.isArray,cb=lb.isExtensible,db=lb.isFrozen,ub=lb.isSealed,pb=lb.freeze,gb=lb.seal,fb={},mb={},yb=!Jv.ActiveXObject&&"ActiveXObject"in Jv,_b=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},vb=ib("WeakMap",_b,nb),bb=vb.prototype,xb=Qv(bb.set);if(ob)if(yb){Kv=nb.getConstructor(_b,"WeakMap",!0),eb.enable();var Sb=Qv(bb.delete),wb=Qv(bb.has),Ab=Qv(bb.get);tb(bb,{delete:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),Sb(this,t)||e.frozen.delete(t)}return Sb(this,t)},has:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)||e.frozen.has(t)}return wb(this,t)},get:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)?Ab(this,t):e.frozen.get(t)}return Ab(this,t)},set:function(t,e){if(sb(t)&&!cb(t)){var i=rb(this);i.frozen||(i.frozen=new Kv),wb(this,t)?xb(this,t,e):i.frozen.set(t,e)}else xb(this,t,e);return this}})}else Zv&&ab((function(){var t=pb([]);return xb(new vb,t,1),!db(t)}))&&tb(bb,{set:function(t,e){var i;return hb(t)&&(db(t)?i=fb:ub(t)&&(i=mb)),xb(this,t,e),i==fb&&pb(t),i==mb&&gb(t),this}});var kb=Yc,Mb=bc,Cb=Rd,Tb=kb("Map"),Eb=kb("WeakMap"),Pb=Mb([].push),Rb=Cb("metadata"),Bb=Rb.store||(Rb.store=new Eb),Ib=function(t,e,i){var n=Bb.get(t);if(!n){if(!i)return;Bb.set(t,n=new Tb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Tb)}return s},Db={store:Bb,getMap:Ib,has:function(t,e,i){var n=Ib(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Ib(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Ib(i,n,!0).set(t,e)},keys:function(t,e){var i=Ib(t,e,!1),n=[];return i&&i.forEach((function(t,e){Pb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Lb=Tu,Ob=Db.toKey,Fb=Db.set;Xg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Ob(arguments[3]);Fb(t,e,Lb(i),n)}});var zb=Tu,Hb=Db.toKey,jb=Db.getMap,Nb=Db.store;Xg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Hb(arguments[2]),n=jb(zb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=Nb.get(e);return s.delete(i),!!s.size||Nb.delete(e)}});var Vb=Tu,Wb=e_,Gb=Db.has,Ub=Db.get,Yb=Db.toKey,Xb=function(t,e,i){if(Gb(t,e,i))return Ub(t,e,i);var n=Wb(e);return null!==n?Xb(t,n,i):void 0};Xg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Yb(arguments[2]);return Xb(t,Vb(e),i)}});var $b=bc,Kb=Map.prototype,qb={Map:Map,set:$b(Kb.set),get:$b(Kb.get),has:$b(Kb.has),remove:$b(Kb.delete),proto:Kb},Zb=lc,Jb=bc,Qb=function(t,e,i){for(var n,s,r=i||t.next;!(n=Zb(r,t)).done;)if(void 0!==(s=e(n.value)))return s},tx=qb.Map,ex=qb.proto,ix=Jb(ex.forEach),nx=Jb(ex.entries),sx=nx(new tx).next,rx=fd,ax=Pc,ox=rg,lx=Dd,hx=function(t,e,i){return i?Qb(nx(t),(function(t){return e(t[1],t[0])}),sx):ix(t,e)},cx=qb.Map,dx=qb.has,ux=qb.set,px=bc([].push),gx=Xg,fx=bc,mx=Db,yx=Tu,_x=e_,vx=function(t){var e,i,n,s=lx(this),r=ox(s),a=[],o=new cx,l=ax(t)?function(t){return t}:rx(t);for(e=0;e= than the number of constructor arguments of its base class."},yS=function(t,e){return"@postConstruct error in class "+t+": "+e},_S=function(t,e){return"@preDestroy error in class "+t+": "+e},vS=function(t,e){return"onDeactivation() error in class "+t+": "+e},bS="Maximum call stack size exceeded",xS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(Zx,t),userGeneratedMetadata:Reflect.getMetadata(Kx,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(qx,t)||[]},t}(),SS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function wS(t){return t instanceof RangeError||t.message===bS}function AS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function kS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=TS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function MS(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||MS(t.parentRequest,e))}function CS(t){t.childRequests.forEach((function(t){if(MS(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=AS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(gS+" "+e)}CS(t)}))}function TS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ES=function(){function t(t){this.id=rS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),PS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Wx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),RS=function(t,e){this.parentContext=t,this.rootRequest=e},BS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),IS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),DS=function(){function t(t,e,i,n){this.id=rS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new IS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new PS(Wx,n):n instanceof PS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:jS(t,i)}return 0}function NS(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Xx],multiInject:e[$x],targetName:e[Gx],unmanaged:e[Ux]}}var VS=function(){function t(t,e,i,n,s){this.id=rS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function WS(t){return t._bindingDictionary}function GS(t,e,i,n,s){var r=YS(i.container,s.serviceIdentifier),a=[];return r.length===SS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=YS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new VS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case SS.NoBindingsAvailable:if(i.isOptional())return e;var s=AS(t),r=dS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=kS(n,s,YS),new Error(r);case SS.OnlyOneBindingAvailable:return e;case SS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=AS(t),r=cS+" "+s;throw r+=kS(n,s,YS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function US(t,e,i,n,s,r){var a,o;if(null===s){a=GS(t,e,n,null,r),o=new VS(i,n,null,a,r);var l=new RS(n,o);n.addPlan(l)}else a=GS(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===iS.Instance&&null!==e.implementationType){var s=function(t,e){return OS(t,TS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=jS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===nS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=KS(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=iw(iw({},s),{constr:t});n=s.isAsync?function(t){return nw(this,void 0,void 0,(function(){var e,i;return sw(this,(function(n){switch(n.label){case 0:return[4,lw(t.constructorInjections)];case 1:return e=n.sent(),[4,lw(t.propertyInjections)];case 2:return i=n.sent(),[2,ow(iw(iw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):ow(r)}else n=new t;return n}function ow(t){var e,i=new((e=t.constr).bind.apply(e,rw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function lw(t){return nw(this,void 0,void 0,(function(){var e,i,n,s;return sw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Ow=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Lw,onDeactivations:new Lw}},t}(),Fw=function(){return Fw=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new iA(e,i)})).inSingletonScope().whenTargetNamed(e)}class sA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class rA extends sA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const aA=Symbol.for("EnvContribution"),oA=Symbol.for("Global");var lA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,n){e(i,n,t)}};let dA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new rA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};dA=lA([Xw(),cA(0,qw(eA)),cA(0,$w(aA)),hA("design:paramtypes",[Object])],dA);const uA=kt-1e-8;class pA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>uA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=kt)<0&&(n+=kt),(s%=kt)<0&&(s+=kt),ss;++o,a-=At)g(a);else for(a=n-n%At+At,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const fA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,mA={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},yA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let _A,vA,bA,xA,SA,wA;var AA,kA,MA,CA,TA,EA,PA,RA,BA;function IA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function DA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Gt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=kt:T>0&&0===r&&(T-=kt);const E=Math.ceil(Math.abs(T/(At+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*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 FA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class XA extends YA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function $A(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class KA{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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function qA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new KA(s,n),t),s}function ZA(t,e,i,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,n)}class JA{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&&ZA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(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):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:ZA(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}tryUpdateLength(){return this.context.tryUpdateLength()}}function QA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("basis",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new JA(s,n),t),s}function tk(t){return t<0?-1:1}function ek(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(tk(r)+tk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function ik(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function nk(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class sk{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._lastDefined2);break;case 3:nk(this,this._t0,ik(this,this._t0),!1!==this._lastDefined2)}(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;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,nk(this,ik(this,e=ek(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:nk(this,this._t0,e=ek(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}}tryUpdateLength(){return this.context.tryUpdateLength()}}class rk extends sk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ak(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("monotoneX",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new sk(s,n),t),s}function ok(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new XA("monotoneY",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new rk(s,n),t),s}let lk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function hk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new YA("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new lk(r,e,s),t),r}class ck{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.context.closePath()}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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function dk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new ck(s,n),t),s}function uk(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}class pk extends gA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new pA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([yA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([yA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([yA.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([yA.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([yA.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([yA.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([yA.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([yA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([yA.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}toString(){if(!this.toStringCbList){const t=[];t[yA.M]=t=>`M${t[1]} ${t[2]}`,t[yA.L]=t=>`L${t[1]} ${t[2]}`,t[yA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[yA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[yA.A]=t=>{const e=[];LA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;twA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),FA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===PA.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===PA.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)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const gk=["l",0,0,0,0,0,0,0];function fk(t,e,i){const n=gk[0]=t[0];if("a"===n||"A"===n)gk[1]=e*t[1],gk[2]=i*t[2],gk[3]=t[3],gk[4]=t[4],gk[5]=t[5],gk[6]=e*t[6],gk[7]=i*t[7];else if("h"===n||"H"===n)gk[1]=e*t[1];else if("v"===n||"V"===n)gk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Pk=Object.assign(Object.assign({},Sk),{points:[],cornerRadius:0}),Rk=Object.assign(Object.assign({},Sk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Bk=Object.assign(Object.assign({},Sk),{width:0,height:0,cornerRadius:0,length:0}),Ik=Object.assign(Object.assign({},Sk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Dk=Object.assign(Object.assign(Object.assign({},Sk),bk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Lk=Object.assign(Object.assign({},Sk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ok=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Sk),{fill:!0}),Fk=Object.assign(Object.assign({},Ok),{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});var zk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Hk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Dk.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(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._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};Hk=zk([Xw()],Hk);var jk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Nk=Symbol.for("TextMeasureContribution");let Vk=class extends Hk{};Vk=jk([Xw()],Vk);const Wk=new Nw;const Gk=new class{},Uk=Symbol.for("CanvasFactory"),Yk=Symbol.for("Context2dFactory");function Xk(t){return Wk.getNamed(Uk,Gk.global.env)(t)}const $k=1e-4,Kk=Math.sqrt(3),qk=1/3;function Zk(t){return t>-dM&&tdM||t<-dM}const Qk=[0,0],tM=[0,0],eM=[0,0];function iM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function nM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function sM(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 rM(t){return(t%=Mt)<0&&(t+=Mt),t}function aM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function oM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Mt);let d=Math.atan2(l,o);return d<0&&(d+=Mt),d>=n&&d<=s||d+Mt>=n&&d+Mt<=s}function cM(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(Zk(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 pM=[-1,-1,-1],gM=[-1,-1];function fM(){const t=gM[0];gM[0]=gM[1],gM[1]=t}function mM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Zk(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,qk):Math.pow(i,qk),n=n<0?-Math.pow(-n,qk):Math.pow(n,qk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Kk*Math.sin(e)))/(3*a),h=(-o+i*(n-Kk*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,pM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&fM(),p=sM(e,n,r,o,gM[0]),u>1&&(g=sM(e,n,r,o,gM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(Zk(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,pM);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=nM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);pM[0]=-l,pM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Mt-1e-4){n=0,s=Mt;const e=r?1:-1;return a>=pM[0]+t&&a<=pM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Mt,s+=Mt);let c=0;for(let e=0;e<2;e++){const i=pM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=s||t+Mt>=n&&t+Mt<=s)&&(t>wt/2&&t<1.5*wt&&(e=-e),c+=e)}}return c}function vM(t){return Math.round(t/wt*1e8)/1e8%2*wt}function bM(t,e){let i=vM(t[0]);i<0&&(i+=Mt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Mt?s=i+Mt:e&&i-s>=Mt?s=i-Mt:!e&&i>s?s=i+(Mt-vM(i-s)):e&&i1&&(i||(h+=aM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;xM[0]=S,xM[1]=w,bM(xM,Boolean(a[6])),S=xM[0],w=xM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case yA.M:u=m,p=y,c=u,d=p;break;case yA.L:if(i){if(cM(c,d,m,y,e,n,s))return!0}else h+=aM(c,d,m,y,n,s)||0;c=m,d=y;break;case yA.C:if(i){if(lM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=mM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case yA.Q:if(i){if(oM(c,d,m,y,_,v,e,n,s))return!0}else h+=yM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case yA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=aM(c,d,o,l,n,s),i){if(hM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=_M(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case yA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(cM(u,p,o,p,e,n,s)||cM(o,p,o,l,e,n,s)||cM(o,l,u,l,e,n,s)||cM(u,l,u,p,e,n,s))return!0}else h+=aM(o,p,o,l,n,s),h+=aM(u,l,u,p,n,s);break;case yA.Z:if(i){if(cM(c,d,u,p,e,n,s))return!0}else h+=aM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kM=function(t,e){return function(i,n){e(i,n,t)}};let MM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Xk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:bk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new He(Object.assign({defaultFontParams:{fontFamily:bk.fontFamily,fontSize:bk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var CM;MM=wM([Xw(),kM(0,qw(eA)),kM(0,$w(Nk)),kM(1,qw(oA)),AM("design:paramtypes",[Object,Object])],MM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(CM||(CM={}));const TM=new qt;let EM=class{constructor(){this.matrix=new qt}init(t){return this.mode=CM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=CM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(TM.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(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}scale(t,e,i){return this.mode===CM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return TM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}translate(t,e){return this.mode===CM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===CM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};EM=wM([Xw(),AM("design:paramtypes",[])],EM);const PM={arc:wk,area:Ak,circle:kk,line:Tk,path:Ek,symbol:Ik,text:Dk,rect:Rk,rect3d:Bk,polygon:Pk,richtext:Lk,richtextIcon:Fk,image:Ok,group:Mk,glyph:Ck},RM=Object.keys(PM);function BM(){return{arc:Object.assign({},PM.arc),area:Object.assign({},PM.area),circle:Object.assign({},PM.circle),line:Object.assign({},PM.line),path:Object.assign({},PM.path),symbol:Object.assign({},PM.symbol),text:Object.assign({},PM.text),rect:Object.assign({},PM.rect),rect3d:Object.assign({},PM.rect3d),polygon:Object.assign({},PM.polygon),richtext:Object.assign({},PM.richtext),richtextIcon:Object.assign({},PM.richtextIcon),image:Object.assign({},PM.image),group:Object.assign({},PM.group),glyph:Object.assign({},PM.glyph)}}function IM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const DM=new Array(60).fill(0).map((()=>BM()));class LM{constructor(){this._defaultTheme=DM.pop()||BM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?IM(this.userTheme,t.userTheme,!1):this.userTheme=P(t.userTheme),IM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);RM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const OM=new LM;function FM(t,e){return t.glyphHost?FM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):OM.getTheme()}return null}(t)||OM.getTheme()}class zM{static GenAutoIncrementId(){return zM.auto_increment_id++}}zM.auto_increment_id=0;var HM=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 jM extends r{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=zM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return HM(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){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof WM))return void console.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(XM(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=XM(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");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),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 WM))return void console.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=XM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=XM(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.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=YM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(XM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(XM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,XM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof WM))return void console.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"):XM(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 GM))return void console.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.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;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.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){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=0&&t<=C(this.rootTarget,"width")&&e>=0&&e<=C(this.rootTarget,"height")?this.rootTarget:null,i}}const KM={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof NM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new UM(t,e))}},qM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class ZM{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(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,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new $M(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new WM,this.rootWheelEvent=new GM,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&f(t)&&!E(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class JM{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const QM=(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"},tC=(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 eC extends r{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=YM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=YM.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||QM(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=tC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=YM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=tC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=QM(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=YM.now()-i>this.config.press.time&&tC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class nC{static Avaliable(){return!0}avaliable(){return nC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class sC{static Avaliable(){return!!Gk.global.getRequestAnimationFrame()}avaliable(){return sC.Avaliable()}tick(t,e){Gk.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var rC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(rC||(rC={}));class aC{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-aC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*aC.bounceIn(2*t):.5*aC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}aC.quadIn=aC.getPowIn(2),aC.quadOut=aC.getPowOut(2),aC.quadInOut=aC.getPowInOut(2),aC.cubicIn=aC.getPowIn(3),aC.cubicOut=aC.getPowOut(3),aC.cubicInOut=aC.getPowInOut(3),aC.quartIn=aC.getPowIn(4),aC.quartOut=aC.getPowOut(4),aC.quartInOut=aC.getPowInOut(4),aC.quintIn=aC.getPowIn(5),aC.quintOut=aC.getPowOut(5),aC.quintInOut=aC.getPowInOut(5),aC.backIn=aC.getBackIn(1.7),aC.backOut=aC.getBackOut(1.7),aC.backInOut=aC.getBackInOut(1.7),aC.elasticIn=aC.getElasticIn(1,.3),aC.elasticOut=aC.getElasticOut(1,.3),aC.elasticInOut=aC.getElasticInOut(1,.3*1.5);const oC=new class{constructor(){this.id=zM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===CA.END?this.removeAnimate(e):e.status===CA.RUNNING||e.status===CA.INITIAL?(this.animateCount++,e.advance(t)):e.status===CA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class lC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class hC extends lC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let cC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oC;this.id=t,this.timeline=e,this.status=CA.INITIAL,this.tailAnimate=new dC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&TA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:MA.ANIMATE_PLAY})}runCb(t){const e=new hC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===CA.RUNNING&&(this.status=CA.PAUSED)}resume(){this.status===CA.PAUSED&&(this.status=CA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new dC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===CA.RUNNING&&(this.status=CA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=CA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};cC.mode=TA.NORMAL,cC.interpolateMap=new Map;class dC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new uC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?aC[i]:i,s=this._addStep(e,null,n);return s.type=EA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?aC[i]:i,r=this._addStep(e,null,s);return r.type=EA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=EA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=EA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new uC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class uC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const pC=200,gC="cubicOut",fC=1e3,mC="quadInOut";var yC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(yC||(yC={}));const _C=[!1,!1,!1,!1],vC=[0,0,0,0],bC=t=>t?m(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(vC[0]=t[0],vC[2]=t[0],vC[1]=t[1],vC[3]=t[1],vC):t:t:0,xC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],SC=[1,2,3,0,1,2,3,0];function wC(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;xC[0].x=i,xC[1].y=i,xC[2].x=-i,xC[3].y=-i;const s=Math.ceil(t/At)%4,r=Math.ceil(e/At)%4;if(n.add(Et(t)*i,Bt(t)*i),n.add(Et(e)*i,Bt(e)*i),s!==r||e-t>wt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ht(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=AC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class RC extends lC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:MA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class BC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=Gk.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class IC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=Gk.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class DC extends lC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Mt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+wt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z}}class LC extends lC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class OC extends lC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?aC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function FC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function zC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{rt(e,n)&&rt(i,s)||t.push(e,i,n,s,n,s)};function GC(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function UC(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 i=t.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),qC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ZC=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return qC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return qC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);ZC(s[0],n,i),ZC(s[1],e-n,i)}};var JC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const QC={};for(const t in JC)E(JC,t)&&(QC[JC[t]]=t);const tT={to:{},get:{}};function eT(t,e,i){return Math.min(Math.max(e,t),i)}function iT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}tT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=tT.get.hsl(t,n),i="hsl";break;case"hwb":e=tT.get.hwb(t,n),i="hwb";break;default:e=tT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},tT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=JC[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=eT(e[n],0,255);return e[3]=eT(e[3],0,1),e},tT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},tT.to.keyword=function(t){return QC[t.slice(0,3)]};const nT=tT;var sT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(sT||(sT={}));class rT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===sT.Color1){let e=rT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=tT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];rT.store1[t]=s,rT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=rT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=tT.get(t),n&&n.value){const e=n.value;rT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],rT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===sT.Color1){if(rT.store1[t])return;rT.store1[t]=i,rT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(rT.store255[t])return;rT.store255[t]=i,rT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function aT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 oT(t,e,i,n,s){if(!t||!e)return t&&aT(t)||e&&aT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=rT.Get(t,sT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=rT.Get(e,sT.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:aT(a)})))});return o?oT(r,l,i,n,s):oT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),aT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}rT.store255={},rT.store1={};const lT=[0,0,0,0],hT=[0,0,0,0];function cT(t,e,i){return rT.Get(t,sT.Color255,lT),rT.Get(e,sT.Color255,hT),`rgba(${Math.round(lT[0]+(hT[0]-lT[0])*i)},${Math.round(lT[1]+(hT[1]-lT[1])*i)},${Math.round(lT[2]+(hT[2]-lT[2])*i)},${lT[3]+(hT[3]-lT[3])*i})`}const dT=(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=oT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},uT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?GC(t):[],s=GC(e);i&&n&&(i.fromTransform&&UC(n,i.fromTransform.clone().getInverse()),UC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},gT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],fT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!gT.includes(s))return;const r=e[s];h(r)||h(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?rT.Get(t[s],sT.Color255):t[s],to:"string"==typeof r?rT.Get(r,sT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class mT extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;uT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&dT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const yT=(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=pT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=fT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new mT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:fC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:mC)),c};class _T extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;uT(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&&dT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const vT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>MC.includes(t))(i)||(e[i]=t[i])})),e},bT=(t,e,i)=>{const n=vT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Gk.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},xT=(t,e,i)=>{const n=[],s=i?null:vT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:vT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=XC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Gk.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=XC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=XC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return $C(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 $C(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Gk.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:KC(i)}];const n=[];return ZC(i,e,n),n})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&v(t.x)&&v(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 ZC(r,e,h),h})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=GC(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Gk.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&bT(t,n,e),n};class wT{static GetImage(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=wT.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},wT.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gk.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gk.global.loadBlob(t):"json"===e&&(i.dataPromise=Gk.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}wT.cache=new Map;const AT=new qt,kT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],MT=["x","y"],CT=["scaleX","scaleY"],TT=["angle"],ET=new Ht;class PT extends jM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Wt,this._updateTag=AA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=FM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;ET.x=i+e,ET.y=n+s}else ET.x=i,ET.y=n;return ET}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new qt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&AA.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&AA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=AA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===kA.GLOBAL){const i=new Ht(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Gk.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!h(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:pC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:gC)}else this.setAttributes(t,!1,{type:MA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();E(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=AA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=AA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&AA.UPDATE_SHAPE_AND_BOUNDS)===AA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=AA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=AA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=mk.x,y:e=mk.y,scaleX:i=mk.scaleX,scaleY:n=mk.scaleY,angle:s=mk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Et(a),f=Bt(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(mk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=AT.setValue(a.a,a.b,a.c,a.d,a.e,a.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:MA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=oT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return FM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gk.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return f(t,!0)?this.pathProxy=(new pk).fromString(t):this.pathProxy=new pk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",x(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(wT.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new UM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}PT.mixin(KM);var RT=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 BT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let IT=0;function DT(){return IT++}const LT=DT(),OT=DT(),FT=DT(),zT=DT(),HT=DT(),jT=DT(),NT=DT(),VT=DT(),WT=DT(),GT=DT(),UT=DT(),YT=DT(),XT=DT(),$T=DT(),KT=DT(),qT=DT(),ZT=Symbol.for("GraphicService"),JT=Symbol.for("GraphicCreator");var QT;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(QT||(QT={}));let tE=class t extends PT{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=jT,this._childUpdateTag=AA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new LM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new LM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===kA.GLOBAL){const i=new Ht(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&AA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=FM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Gk.graphicService.updateGroupAABBBounds(t,FM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=bC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS,this._childUpdateTag&=AA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&AA.UPDATE_BOUNDS||(this._childUpdateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Gk.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Gk.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Gk.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Gk.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&AA.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=Gk.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const eE=Symbol.for("LayerHandlerContribution");class iE extends tE{get offscreen(){return this.layerHandler.offscreen}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=Wk.get(eE),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 LM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Gk.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Gk.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var nE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rE=function(t,e){return function(i,n){e(i,n,t)}};let aE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new iE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};aE=nE([Xw(),rE(0,qw(oA)),sE("design:paramtypes",[Object])],aE);var oE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hE=function(t,e){return function(i,n){e(i,n,t)}};const cE=Symbol.for("Window"),dE=Symbol.for("WindowHandlerContribution");let uE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new rA(["x","y","width","height"])},this._uid=zM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Wk.getNamed(dE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};oE([tA(),lE("design:type",Function),lE("design:paramtypes",[]),lE("design:returntype",void 0)],uE.prototype,"postInit",null),uE=oE([Xw(),hE(0,qw(oA)),lE("design:paramtypes",[Object])],uE);const pE=Symbol.for("TransformUtil"),gE=Symbol.for("GraphicUtil"),fE=Symbol.for("LayerService");var mE=new Vw((t=>{t(dA).toSelf().inSingletonScope(),t(oA).toService(dA),t(uE).to(uE),t(cE).toService(uE),t(MM).toSelf().inSingletonScope(),t(gE).toService(MM),t(EM).toSelf().inSingletonScope(),t(pE).toService(EM),t(aE).toSelf().inSingletonScope(),t(fE).toService(aE)}));function yE(t){return!!t}function _E(t,e){let i;return i=m(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function vE(t,e){return t*e>0}function bE(t,e,i,n){return t*e>0&&i>0&&n>0}function xE(t,e){return t*e>0}function SE(t,e,i,n){return t*e>0&&i>0&&n>0}function wE(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=FM(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,m=vE(d,u),y=xE(d,g),_=yE(h),v=_E(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return FA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function AE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function ME(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(s=Mt-St)e.moveTo(i+s*Et(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>St&&(e.moveTo(i+r*Et(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*Et(f),T=s*Bt(f),E=r*Et(y),P=r*Bt(y);let R,B,I,D;if((A>St||w>St)&&(R=s*Et(m),B=s*Bt(m),I=r*Et(_),D=r*Bt(_),hSt){const t=Rt(v,k),r=Rt(b,k),o=kE(I,D,C,T,s,t,Number(c)),l=kE(R,B,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Et(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+R,n+s*Bt(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>St)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>St){const t=Rt(S,M),s=Rt(x,M),o=kE(E,P,R,B,r,-s,Number(c)),l=kE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Et(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*Et(_),n+r*Bt(_))}return a?a[3]&&e.lineTo(i+s*Et(l),n+s*Et(l)):e.closePath(),d}class CE{static GetCanvas(){try{return CE.canvas||(CE.canvas=Gk.global.createCanvas({})),CE.canvas}catch(t){return null}}static GetCtx(){if(!CE.ctx){const t=CE.GetCanvas();CE.ctx=t.getContext("2d")}return CE.ctx}}class TE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=CE.GetCanvas(),n=CE.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=TE.dataMap.get(i);return n||(n=new TE(t,e),TE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){TE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return TE.dataMap.get(t)}}TE.dataMap=new Map;class EE{static GetSize(t){for(let e=0;e=t)return EE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=EE.GenKey(t,e,i,n,s),l=EE.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=EE.GenKey(t,e,i,n,s);EE.cache[l]?EE.cache[l].push({width:a,height:o,pattern:r}):EE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}EE.cache={},EE.ImageSize=[20,40,80,160,320,640,1280,2560];const PE=Symbol.for("ArcRenderContribution"),RE=Symbol.for("AreaRenderContribution"),BE=Symbol.for("CircleRenderContribution"),IE=Symbol.for("GroupRenderContribution"),DE=Symbol.for("ImageRenderContribution"),LE=Symbol.for("PathRenderContribution"),OE=Symbol.for("PolygonRenderContribution"),FE=Symbol.for("RectRenderContribution"),zE=Symbol.for("SymbolRenderContribution"),HE=Symbol.for("TextRenderContribution"),jE=Symbol.for("InteractiveSubRenderContribution");var NE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WE=function(t,e){return function(i,n){e(i,n,t)}};let GE=class{constructor(t){this.arcRenderContribitions=t,this.numberType=LT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Ct(d-c),p=d>c;let g=!1;if(sSt||M>St)&&(D=s*Et(v),L=s*Bt(v),O=r*Et(x),F=r*Bt(x),uSt){const t=Rt(S,T),r=Rt(w,T),a=kE(O,F,P,R,s,t,Number(p)),o=kE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>St)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>St){const t=Rt(k,E),s=Rt(A,E),a=kE(B,I,D,L,r,-s,Number(p)),o=kE(P,R,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Et(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,l){const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x:_=h.x,y:v=h.y}=t.attribute,b=vE(p,g),x=xE(p,m),S=yE(c),w=_E(u,f);if(!t.valid||!y)return;if(!(S||w||d))return;if(!(b||x||a||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=!1;const{isFullStroke:E,stroke:P}=(t=>{var e;let i=!0;if(o(t,!0)){for(let n=0;n<4;n++)_C[n]=t,i&&(i=!(null!==(e=_C[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)_C[e]=!!t[e],i&&(i=!!_C[e]);else _C[0]=!1,_C[1]=!1,_C[2]=!1,_C[3]=!1;return{isFullStroke:i,stroke:_C}})(u);if(S||E||d){if(e.beginPath(),ME(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,_-i,v-n,h),e.fill())),w&&E&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,_-i,v-n,h),e.stroke()))}if(!E&&w){if(e.beginPath(),ME(t,e,i,n,A,k,P),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if(M&&C){const{startAngle:r,endAngle:o}=t.getParsedAngle();if(Ct(o-r)>=Mt-St){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:o=h.endAngle,fill:c=h.fill}=t.attribute,d=o;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;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),oT(o.color,l.color,h,!1)}(0,0,o,s);a||vE&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};GE=NE([Xw(),WE(0,qw(eA)),WE(0,$w(PE)),VE("design:paramtypes",[Object])],GE);var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XE=function(t,e){return function(i,n){e(i,n,t)}};let $E=class{constructor(t){this.circleRenderContribitions=t,this.numberType=zT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(y,f),w=xE(y,m),A=yE(h),k=_E(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};$E=UE([Xw(),XE(0,qw(eA)),XE(0,$w(BE)),YE("design:paramtypes",[Object])],$E);const KE=["radius","startAngle","endAngle",...kT];class qE extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=zT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=FM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateCircleAABBBounds(i,FM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function JE(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function QE(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class tP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=qT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=FM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=FM(this).text,n=Gk.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=JE(c,s),e=QE(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=JE(c,s),_=QE(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=FM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;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 g=Gk.graphicUtil.textMeasure,f=new tP(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).text[t]}needUpdateTags(t){for(let e=0;e{WP[t.type]=t}));const GP=["symbolType","size",...kT];let UP=class t extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=KT}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return m(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=FM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=WP[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new pk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Pt(r,a);return s.transform(0,0,o,o),this._parsedPath=new VP(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=FM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateSymbolAABBBounds(i,FM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=VT}isValid(){return super.isValid()&&this._isValid()}_isValid(){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=kC(i,n,e))}doUpdateAABBBounds(){const t=FM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateLineAABBBounds(e,FM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const $P=["width","height","cornerRadius",...kT];class KP extends PT{constructor(t){super(t),this.type="rect",this.numberType=YT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=FM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRectAABBBounds(e,FM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).rect[t]}needUpdateTags(t){for(let e=0;e<$P.length;e++){const i=$P[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$P.length;e++)if(t===$P[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=t.width,i=t.height,n=new pk;return n.moveTo(0,0),n.rect(0,0,e,i),n}clone(){return new KP(Object.assign({},this.attribute))}}const qP=[[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 ZP extends KP{constructor(t){super(t),this.type="rect3d",this.numberType=XT}findFace(){const t={polygons:[],vertices:[],edges:[]},e=FM(this).rect3d,{width:i=e.width,height:n=e.width,length:s=Rt(e.width,e.height)}=this.attribute;for(let e=0;e{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){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=Gk.graphicService.updateGlyphAABBBounds(this.attribute,FM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new JP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const QP={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"}},tR=!0,eR=!1,iR=/\w|\(|\)/,nR=/[.?!,;:/,。?!、;:]/,sR=/\S/;function rR(t,e,i,n,s){if(!e||e<=0)return 0;const r=Gk.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=function(t,e){let i=e;for(;iR.test(t[i-1])&&iR.test(t[i])||nR.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function aR(t,e){const i=Gk.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class oR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=QP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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,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=this.lines[i].getWidthWithEllips();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((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=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(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=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class lR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=aR(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=aR(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=rR(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=aR(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||eR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||tR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=rR(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=aR(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const hR=["width","height","image",...kT];class cR extends PT{constructor(t){super(t),this.type="image",this.numberType=NT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=FM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateImageAABBBounds(e,FM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ok[t]}needUpdateTags(t){for(let e=0;e{if(m(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=bC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Ok.width,height:e=Ok.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 uR{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 dR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=QP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof lR){const e=sR.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof dR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof dR?t.width:t.getWidthWithEllips(this.direction)})),e}}class pR{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=QP[this.direction]}store(t){if(t instanceof dR){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 uR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof dR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=rR(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new lR(i,t.newLine,t.character),new lR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const gR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...kT];class fR extends PT{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=$T}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=FM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRichTextAABBBounds(e,FM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new pR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const mR=["path","customPath",...kT];class yR extends PT{constructor(t){super(t),this.type="path",this.numberType=WT}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=FM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pk?e.path:(h(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pk?this.cache:t.path)}doUpdateAABBBounds(){const t=FM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePathAABBBounds(e,FM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;f(t.path,!0)?this.cache=(new pk).fromString(t.path):t.customPath&&(this.cache=new pk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).path[t]}needUpdateTags(t){for(let e=0;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 vR(Object.assign({},this.attribute))}}const bR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kT];class xR extends PT{constructor(t){super(t),this.type="arc",this.numberType=LT}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=FM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(v(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=FM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Xt(e),i=e+r,n&&Ct(r)St&&o>St)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=FM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=It(n*n+s*s)}=this.attribute,o=Ct(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>St&&a>St){const i=e>t?1:-1;let r=Ot(Number(a)/s*Bt(u)),o=Ot(Number(a)/n*Bt(u));return(p-=2*r)>St?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>St?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateArcAABBBounds(i,FM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Mt-St)o.moveTo(0+s*Et(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>St&&(o.moveTo(0+n*Et(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Et(e),r=s*Bt(e),l=n*Et(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new xR(Object.assign({},this.attribute))}}class SR extends xR{constructor(t){super(t),this.type="arc3d",this.numberType=OT}doUpdateAABBBounds(){const t=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateArc3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const wR=["points","cornerRadius",...kT];class AR extends PT{constructor(t){super(t),this.type="polygon",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePolygonAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=kC(i,n,e))}getDefaultAttribute(t){return FM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new AR(Object.assign({},this.attribute))}}class kR extends AR{constructor(t){super(t),this.type="pyramid3d",this.numberType=UT}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePyramid3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}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}}var MR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CR=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};CR=MR([Xw()],CR);var TR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ER=Symbol.for("RectBoundsContribution");let PR=class extends CR{};PR=TR([Xw()],PR);var RR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const BR=Symbol.for("SymbolBoundsContribution");let IR=class extends CR{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;BT(i,n+r+o/2,!0,a)}return i}};IR=RR([Xw()],IR);var DR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const LR=Symbol.for("CircleBoundsContribution");let OR=class extends CR{};OR=DR([Xw()],OR);var FR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const zR=Symbol.for("ArcBoundsContribution");let HR=class extends CR{};HR=FR([Xw()],HR);var jR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const NR=Symbol.for("PathBoundsContribution");let VR=class extends CR{};VR=jR([Xw()],VR);class WR{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return WR.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$R=function(t,e){return function(i,n){e(i,n,t)}};function KR(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=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]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function qR(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 ZR(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function JR(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),KR(t,t,[s+o,r+l,a+h]),KR(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),KR(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=UR.allocate(),n=[0,0];if(y){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]}KR(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),KR(i,i,[-n[0],-n[1],0]),ZR(t,t,i)}}let QR=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new rA(["graphic"]),onSetStage:new rA(["graphic","stage"]),onRemove:new rA(["graphic"]),onAddIncremental:new rA(["graphic","group","stage"]),onClearIncremental:new rA(["graphic","group","stage"]),beforeUpdateAABBBounds:new rA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new rA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Wt,this.tempAABBBounds2=new Wt}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)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new pA(t);return FA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),Nt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Mt-St?i.set(-a,-a,a,a):wC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=St?i.set(0,0,0,0):Math.abs(a-o)>Mt-St?i.set(-s,-s,s,s):(wC(o,a,s,i),wC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(m(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){BT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){BT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Nt(e,e,s.transMatrix)}};QR=YR([Xw(),$R(0,qw(JT)),$R(1,qw(eA)),$R(1,$w(ER)),$R(2,qw(eA)),$R(2,$w(BR)),$R(3,qw(eA)),$R(3,$w(LR)),$R(4,qw(eA)),$R(4,$w(zR)),$R(5,qw(eA)),$R(5,$w(NR)),XR("design:paramtypes",[Object,Object,Object,Object,Object,Object])],QR);class tB extends tE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const eB=["heightLimit","lineClamp"];class iB extends iP{_isValid(){const{text:t}=this.attribute;return m(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=FM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;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),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=Gk.graphicUtil.textMeasure,f=new tP(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=UR.allocate(),s=UR.allocate();JR(s,t,e),ZR(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),UR.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,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()}};function xB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),SB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=PA.ROW:"y"===n?c=PA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let AB=class extends bB{constructor(){super(...arguments),this.numberType=VT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const y=null!==(f=this.z)&&void 0!==f?f:0;xB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:y}),u.cache&&!m(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:_=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,_-c,v-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,_-c,v-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=vE(d,u),y=xE(d,p),_=yE(h),v=_E(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(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),s=uk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=uk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],Rt(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function kB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),MB(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),MB(t,l,1,n),o=!1):o=!0}t.closePath()}function MB(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]=VA(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)}}AB=wB([Xw()],AB);var CB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EB=function(t,e){return function(i,n){e(i,n,t)}};function PB(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}let RB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=FT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=FM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=vE(y,m),A=yE(f),k=_E(b,x),M=xE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=PB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=PB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=PB(i,n),a=PB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],Rt(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=FM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?PA.ROW:PA.COLUMN,Number.isFinite(c)||(o=PA.COLUMN),Number.isFinite(d)||(o=PA.ROW);const u=i*(o===PA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===BA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,y-h,_-c,o),t.fill())),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;m(i)&&i[0]&&!1===i[1]&&(t.beginPath(),xB(t.camera?t:t.nativeContext,e.top,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,y-h,_-c,o),t.stroke()}return this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===BA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1}};RB=CB([Xw(),EB(0,qw(eA)),EB(0,$w(RE)),TB("design:paramtypes",[Object])],RB);var BB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DB=function(t,e){return function(i,n){e(i,n,t)}};let LB=class extends bB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=FM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=vE(f,p),w=xE(f,g),A=yE(d),k=_E(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)FA(t.pathShape.commandList,e,i,n,1,1,x);else{FA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};LB=BB([Xw(),DB(0,qw(eA)),DB(0,$w(LE)),IB("design:paramtypes",[Object])],LB);const OB=wt/2;function FB(t,e,i,n,s,r){let a;if(v(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!G(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-OB,0,!1)}if(t.lineTo(_[0],_[1]),!G(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,OB,!1)}if(t.lineTo(b[0],b[1]),!G(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],OB,wt,!1)}if(t.lineTo(g[0],g[1]),!G(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],wt,wt+OB,!1)}return t.closePath(),t}var zB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jB=function(t,e){return function(i,n){e(i,n,t)}};let NB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:y=l.fillOpacity,lineWidth:_=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=bE(f,y,u,p),A=SE(f,v,u,p),k=yE(h),M=_E(d,_);if(!t.valid||!b)return;if(!(k||M||c))return;if(!(w||A||a||o||c))return;0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),FB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};NB=zB([Xw(),jB(0,qw(eA)),jB(0,$w(FE)),HB("design:paramtypes",[Object])],NB);var VB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class extends bB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=vE(f,p),A=xE(f,g),k=yE(d),M=_E(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};UB=VB([Xw(),GB(0,qw(eA)),GB(0,$w(zE)),WB("design:paramtypes",[Object])],UB);var YB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$B=function(t,e){return function(i,n){e(i,n,t)}};let KB=class extends bB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=qT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=vE(f,p),C=xE(f,g),T=yE(d),E=_E(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const P=!b,R=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===BA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,R,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,R);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,R,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,R);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,R))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,R),this.drawUnderLine(_,v,t,i,n+r,R,h,e)))}P&&this.restoreTransformUseContext2d(t,h,R,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=JE(l,g),m=QE(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=JE(h,a),f=QE("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};KB=YB([Xw(),$B(0,qw(eA)),$B(0,$w(HE)),XB("design:paramtypes",[Object])],KB);var qB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZB=class{};function JB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nI=function(t,e){return function(i,n){e(i,n,t)}};let sI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:y=l.lineWidth,opacity:_=l.opacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(_,p),w=xE(_,f),A=yE(c),k=_E(d,y);t.valid&&v&&(A||k||g)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||m(u)&&u.every((t=>0===t))?JB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)JB(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=tI(l,y,_,c,d),S=tI(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=QB(w,A),M=tI(l,QB(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};sI=eI([Xw(),nI(0,qw(eA)),nI(0,$w(OE)),iI("design:paramtypes",[Object])],sI);var rI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oI=function(t,e){return function(i,n){e(i,n,t)}};const lI=["","repeat-x","repeat-y","repeat"];let hI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=NT}drawShape(t,e,i,n,s,r,a){const o=FM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=vE(d,u),_=yE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,lI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=FM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};hI=rI([Xw(),oI(0,qw(eA)),oI(0,$w(DE)),aI("design:paramtypes",[Object])],hI);const cI=Symbol.for("IncrementalDrawContribution"),dI=Symbol.for("ArcRender"),uI=Symbol.for("Arc3dRender"),pI=Symbol.for("AreaRender"),gI=Symbol.for("CircleRender"),fI=Symbol.for("GraphicRender"),mI=Symbol.for("GroupRender"),yI=Symbol.for("LineRender"),_I=Symbol.for("PathRender"),vI=Symbol.for("PolygonRender"),bI=Symbol.for("RectRender"),xI=Symbol.for("Rect3DRender"),SI=Symbol.for("SymbolRender"),wI=Symbol.for("TextRender"),AI=Symbol.for("RichTextRender"),kI=Symbol.for("Pyramid3dRender"),MI=Symbol.for("GlyphRender"),CI=Symbol.for("ImageRender"),TI=Symbol.for("RenderSelector"),EI=Symbol.for("DrawContribution");function PI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function RI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(m(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const BI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(t)},t));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};return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(e)},e))}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(){this.pools=[]}};var II=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LI=function(t,e){return function(i,n){e(i,n,t)}};let OI=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};OI=II([Xw()],OI);let FI=class{constructor(t){this.subRenderContribitions=t,this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};FI=II([Xw(),LI(0,qw(eA)),LI(0,$w(jE)),DI("design:paramtypes",[Object])],FI);let zI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=BI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return BI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Mt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};zI=II([Xw()],zI);var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),ME(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),ME(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};jI=HI([Xw()],jI);let NI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};NI=HI([Xw()],NI);let VI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};VI=HI([Xw()],VI);var WI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let GI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};GI=WI([Xw()],GI);let UI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};UI=WI([Xw()],UI);let YI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};YI=WI([Xw()],YI);var XI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $I=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};$I=XI([Xw()],$I);var KI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};qI=KI([Xw()],qI);var ZI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),FB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),FB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};JI=ZI([Xw()],JI);let QI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};QI=ZI([Xw()],QI);let tD=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};tD=ZI([Xw()],tD);let eD=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};eD=ZI([Xw()],eD);let iD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};iD=ZI([Xw()],iD);var nD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};sD=nD([Xw()],sD);class rD extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}}class aD extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}}var oD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hD=function(t,e){return function(i,n){e(i,n,t)}};const cD=Symbol.for("RenderService");let dD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}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)}};dD=oD([Xw(),hD(0,qw(EI)),lD("design:paramtypes",[Object])],dD);var uD=new Vw((t=>{t(dD).toSelf(),t(cD).toService(dD)})),pD=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 gD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return pD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function mD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var yD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const _D=Symbol.for("PickItemInterceptor");let vD=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===OT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};vD=yD([Xw()],vD);var bD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SD=function(t,e){return function(i,n){e(i,n,t)}};const wD=Symbol.for("PickerService");let AD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new qt(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=UR.allocate();if(qR(i,e),a){if(i){const t=UR.allocate();r.modelMatrix=ZR(t,a,i),UR.free(i)}}else qR(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Ht(e.x,e.y),a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Ht(e.x,e.y);l.transformPoint(r,r);const a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&UR.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),GR.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};AD=bD([Xw(),SD(0,qw(oA)),SD(1,qw(eA)),SD(1,$w(_D)),xD("design:paramtypes",[Object,Object])],AD);var kD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CD=function(t,e){return function(i,n){e(i,n,t)}};const TD=Symbol.for("GlobalPickerService");let ED=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new qt(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 Ht(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function PD(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function RD(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}ED=kD([Xw(),CD(0,qw(oA)),MD("design:paramtypes",[Object])],ED);class BD{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=UR.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=UR.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const LD=[0,0,0],OD=new qt(1,0,0,1,0,0);let FD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},yk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},vk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new qt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.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&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Mt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),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&&EE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gk.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Gk.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:bk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:bk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[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={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=RI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}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={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=ZE(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=ZE(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(OD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};FD.env="browser",FD=ID([Xw(),DD("design:paramtypes",[Object,Number])],FD);var zD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const jD={WIDTH:500,HEIGHT:500,DPR:1};let ND=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=jD.WIDTH,height:n=jD.HEIGHT,dpr:s=jD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=Gk.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new FD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}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.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};ND.env="browser",ND=zD([Xw(),HD("design:paramtypes",[Object])],ND);const VD=Symbol.for("CanvasArcPicker"),WD=Symbol.for("CanvasArc3dPicker"),GD=Symbol.for("CanvasAreaPicker"),UD=Symbol.for("CanvasCirclePicker"),YD=Symbol.for("CanvasImagePicker"),XD=Symbol.for("CanvasLinePicker"),$D=Symbol.for("CanvasPathPicker"),KD=Symbol.for("CanvasRectPicker"),qD=Symbol.for("CanvasRect3dPicker"),ZD=Symbol.for("CanvasSymbolPicker"),JD=Symbol.for("CanvasTextPicker"),QD=Symbol.for("CanvasPolygonPicker"),tL=Symbol.for("CanvasPyramid3dPicker"),eL=Symbol.for("CanvasRichTextPicker"),iL=Symbol.for("CanvasGlyphPicker"),nL=Symbol.for("CanvasPickerContribution"),sL=Symbol.for("MathArcPicker"),rL=Symbol.for("MathAreaPicker"),aL=Symbol.for("MathCirclePicker"),oL=Symbol.for("MathLinePicker"),lL=Symbol.for("MathPathPicker"),hL=Symbol.for("MathRectPicker"),cL=Symbol.for("MathSymbolPicker"),dL=Symbol.for("MathTextPicker"),uL=Symbol.for("MathPolygonPicker"),pL=Symbol.for("MathGlyphPicker"),gL=Symbol.for("MathPickerContribution");var fL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yL=function(t,e){return function(i,n){e(i,n,t)}};let _L=class extends AD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new ND(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xL=new qt(1,0,0,1,0,0),SL={x:0,y:0};let wL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0),this.path=new pk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},SL),function(t,e,i){return SM(t,0,!1,e,i)}(this.path.commandList,SL.x,SL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},SL);const i=PI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return SM(t,e,!0,i,n)}(this.path.commandList,i,SL.x,SL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(xL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};wL=vL([Xw(),bL("design:paramtypes",[Object,Number])],wL);var AL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ML=function(t,e){return function(i,n){e(i,n,t)}};let CL=class extends AD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new wL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};AL([tA(),kL("design:type",Function),kL("design:paramtypes",[]),kL("design:returntype",void 0)],CL.prototype,"init",null),CL=AL([Xw(),ML(0,qw(eA)),ML(0,$w(gL)),ML(1,qw(oA)),ML(2,qw(eA)),ML(2,$w(_D)),kL("design:paramtypes",[Object,Object,Object])],CL);var TL=new Vw((t=>{t(_L).toSelf().inSingletonScope(),t(CL).toSelf().inSingletonScope(),t(wD).toService(_L),t(ED).toSelf().inSingletonScope(),t(TD).toService(ED),t(vD).toSelf().inSingletonScope(),t(_D).toService(vD),nA(t,_D)})),EL=new Vw((t=>{t(QR).toSelf().inSingletonScope(),t(ZT).toService(QR),t(PR).toSelf().inSingletonScope(),t(ER).toService(PR),nA(t,ER),t(IR).toSelf().inSingletonScope(),t(BR).toService(IR),nA(t,BR),t(OR).toSelf().inSingletonScope(),t(LR).toService(OR),nA(t,LR),t(HR).toSelf().inSingletonScope(),t(zR).toService(HR),nA(t,zR),t(VR).toSelf().inSingletonScope(),t(NR).toService(VR),nA(t,NR),t(JT).toConstantValue(mB)}));const PL=Symbol.for("AutoEnablePlugins"),RL=Symbol.for("PluginService");var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DL=function(t,e){return function(i,n){e(i,n,t)}};let LL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Wk.isBound(PL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};LL=BL([Xw(),DL(0,qw(eA)),DL(0,$w(PL)),IL("design:paramtypes",[Object])],LL);var OL=new Vw((t=>{t(LL).toSelf(),t(RL).toService(LL),nA(t,PL)})),FL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};zL=FL([Xw()],zL);var HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function NL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let VL=class extends zL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(b(o)?o:1),y:(s-r.top)/(b(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return NL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return NL(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:zM.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(){}};function WL(){Wk.rebind(wD).toService(CL)}VL=HL([Xw(),jL("design:paramtypes",[])],VL);var GL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YL=class extends zL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};YL=GL([Xw(),UL("design:paramtypes",[])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KL=class extends zL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Wk.rebind(wD).toService(CL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=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){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}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(){}};KL=XL([Xw(),$L("design:paramtypes",[])],KL);var qL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JL=!1;try{JL=!!lynx.createCanvasNG}catch(t){}let QL=class extends zL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=JL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,JL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(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(){}};QL=qL([Xw(),ZL("design:paramtypes",[])],QL);var tO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eO=class extends zL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};eO=tO([Xw()],eO);var iO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let rO=class extends zL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return sO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{WL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};rO=iO([Xw(),nO("design:paramtypes",[])],rO);var aO=new Vw((t=>{t(VL).toSelf().inSingletonScope(),t(aA).toService(VL),t(YL).toSelf().inSingletonScope(),t(aA).toService(YL),t(KL).toSelf().inSingletonScope(),t(aA).toService(KL),t(QL).toSelf().inSingletonScope(),t(aA).toService(QL),t(rO).toSelf().inSingletonScope(),t(aA).toService(rO),t(eO).toSelf().inSingletonScope(),t(aA).toService(eO),nA(t,aA)})),oO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hO=class{constructor(){this._uid=zM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};hO=oO([Xw(),lO("design:paramtypes",[])],hO);var cO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uO=function(t,e){return function(i,n){e(i,n,t)}};let pO=class extends hO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}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 this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ND(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new ND({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};pO.env="browser",pO=cO([Xw(),uO(0,qw(oA)),dO("design:paramtypes",[Object])],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}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;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};fO.env="feishu",fO=gO([Xw()],fO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _O={WIDTH:500,HEIGHT:500,DPR:1};let vO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=_O.WIDTH,height:n=_O.HEIGHT,dpr:s=_O.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new fO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};vO.env="feishu",vO=mO([Xw(),yO("design:paramtypes",[Object])],vO);var bO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SO=function(t,e){return function(i,n){e(i,n,t)}};let wO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 vO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};wO.env="feishu",wO=bO([Xw(),SO(0,qw(oA)),xO("design:paramtypes",[Object])],wO);var AO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kO=class extends FD{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(RI(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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(PI(this,l,this.dpr)),r.setStrokeStyle(RI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=ZE(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=ZE(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}};kO.env="taro",kO=AO([Xw()],kO);var MO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const TO={WIDTH:500,HEIGHT:500,DPR:1};let EO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=TO.WIDTH,height:n=TO.HEIGHT,dpr:s=TO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new kO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};EO.env="taro",EO=MO([Xw(),CO("design:paramtypes",[Object])],EO);var PO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BO=function(t,e){return function(i,n){e(i,n,t)}};let IO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 EO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};IO.env="taro",IO=PO([Xw(),BO(0,qw(oA)),RO("design:paramtypes",[Object])],IO);var DO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let LO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};LO.env="lynx",LO=DO([Xw()],LO);var OO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zO={WIDTH:500,HEIGHT:500,DPR:1};let HO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=zO.WIDTH,height:n=zO.HEIGHT,dpr:s=zO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new LO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};HO.env="lynx",HO=OO([Xw(),FO("design:paramtypes",[Object])],HO);var jO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VO=function(t,e){return function(i,n){e(i,n,t)}};let WO=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",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:zM.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)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 HO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};WO.env="lynx",WO=jO([Xw(),VO(0,qw(oA)),NO("design:paramtypes",[Object])],WO);var GO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YO=class extends FD{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 qt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};YO.env="node",YO=GO([Xw(),UO("design:paramtypes",[Object,Number])],YO);var XO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$O=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const KO={WIDTH:500,HEIGHT:500,DPR:1};let qO=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=KO.WIDTH,height:n=KO.HEIGHT,canvasControled:s=!0,dpr:r=KO.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new YO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&l(this._nativeCanvas.release)&&this._nativeCanvas.release()}};qO.env="node",qO=XO([Xw(),$O("design:paramtypes",[Object])],qO);var ZO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QO=function(t,e){return function(i,n){e(i,n,t)}};let tF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new qO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new qO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};tF.env="node",tF=ZO([Xw(),QO(0,qw(oA)),JO("design:paramtypes",[Object])],tF);var eF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iF=class extends FD{draw(){}createPattern(t,e){return null}};iF.env="wx",iF=eF([Xw()],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rF={WIDTH:500,HEIGHT:500,DPR:1};let aF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=rF.WIDTH,height:n=rF.HEIGHT,dpr:s=rF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new iF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};aF.env="wx",aF=nF([Xw(),sF("design:paramtypes",[Object])],aF);var oF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hF=function(t,e){return function(i,n){e(i,n,t)}};class cF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let dF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new cF}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:zM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new aF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new aF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};dF.env="wx",dF=oF([Xw(),hF(0,qw(oA)),lF("design:paramtypes",[Object])],dF);var uF=new Vw((t=>{t(pO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(pO))).whenTargetNamed(pO.env),t(wO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(wO))).whenTargetNamed(wO.env),t(IO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(IO))).whenTargetNamed(IO.env),t(WO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(WO))).whenTargetNamed(WO.env),t(dF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(dF))).whenTargetNamed(dF.env),t(tF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(tF))).whenTargetNamed(tF.env)})),pF=new Vw((t=>{t(Vk).toSelf().inSingletonScope(),t(Nk).toService(Vk),nA(t,Nk)})),gF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mF=function(t,e){return function(i,n){e(i,n,t)}};let yF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Xk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,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()}};yF=gF([Xw(),mF(0,qw(oA)),fF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bF=function(t,e){return function(i,n){e(i,n,t)}};let xF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=Xk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};xF=_F([Xw(),bF(0,qw(oA)),vF("design:paramtypes",[Object])],xF);var SF=new Vw((t=>{t(yF).toSelf(),t(xF).toSelf(),t(eE).toService(yF)}));var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const AF=Symbol.for("DrawItemInterceptor"),kF=new Wt;let MF=class{constructor(){this.order=1}afterDrawItem(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){kF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(kF),!0}};MF=wF([Xw()],MF);let CF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=UR.allocate();qR(l,o);const h=r.modelMatrix;if(h){if(l){const t=UR.allocate();r.modelMatrix=ZR(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===OT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&UR.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};CF=wF([Xw()],CF);var TF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},EF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PF=function(t,e){return function(i,n){e(i,n,t)}};let RF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=be(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=mD(e,i,Sk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Se(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):gD(t,Sk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_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||Wk.get(cI);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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IF=class{selector(t){return null}};IF=BF([Xw()],IF);var DF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let FF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:y=l.fillOpacity,strokeOpacity:_=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=bE(u,y,p,g),A=SE(u,_,p,g),k=yE(h),M=_E(d,x);if(!t.valid||!S)return;if(!f){if(!(k||M||c))return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===v||m(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),FB(e,i,n,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=FM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=UR.allocate(),i=UR.allocate();JR(i,t,a),ZR(e,o||e,i),s.modelMatrix=e,UR.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&UR.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};FF=DF([Xw(),OF(0,qw(eA)),OF(0,$w(IE)),LF("design:paramtypes",[Object])],FF);var zF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HF=class extends AB{constructor(){super(...arguments),this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=FM(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,y=vE(u,p),_=xE(u,g),v=yE(c),b=_E(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};HF=zF([Xw()],HF);var jF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NF=class extends RB{constructor(){super(...arguments),this.numberType=FT}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=FM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=vE(u,d),f=yE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};NF=jF([Xw()],NF);var VF,WF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UF=function(t,e){return function(i,n){e(i,n,t)}},YF=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"}(VF||(VF={}));let XF=class extends RF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=VF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new rA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return YF(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,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.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 YF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return YF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>YF(this,void 0,void 0,(function*(){if(2!==t.count)yield fD(t,Sk.zIndex,((i,n)=>{if(this.status===VF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return YF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return YF(this,void 0,void 0,(function*(){this.rendering&&(this.status=VF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=VF.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 YF(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:()=>YF(this,void 0,void 0,(function*(){yield fD(t,Sk.zIndex,(t=>YF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};WF([qw(oA),GF("design:type",Object)],XF.prototype,"global",void 0),XF=WF([Xw(),UF(0,Zw(fI)),UF(1,qw(TI)),UF(2,qw(HF)),UF(3,qw(NF)),UF(4,qw(fE)),UF(5,qw(eA)),UF(5,$w(AF)),GF("design:paramtypes",[Array,Object,Object,Object,Object,Object])],XF);var $F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KF=class extends bB{constructor(){super(...arguments),this.type="rect3d",this.numberType=XT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=bE(g,f,u,p),x=SE(g,y,u,p),S=yE(c),w=_E(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}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){const l=nT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};KF=$F([Xw()],KF);var qF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZF=class{constructor(){this.numberType=$T}drawShape(t,e,i,n,s){const r=FM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&vE(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=FM(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:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),FB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).richtext;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);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};ZF=qF([Xw()],ZF);var JF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let QF=class{constructor(){this.numberType=HT}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=FM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};QF=JF([Xw()],QF);var tz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ez=class extends bB{constructor(){super(...arguments),this.numberType=OT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=vE(p,g),v=xE(p,m),b=yE(c),x=_E(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=nT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(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 d=!1;if(r=Mt-St)e.moveTo(i+r*Et(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>St&&(e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*Et(p),_=r*Bt(p),v=a*Et(f),b=a*Bt(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>St)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Mt,!0,E.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),d=h>l;let u=!1;if(a<=St)e.moveTo(i,n,s);else if(c>=Mt-St)e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Et(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Et(c),f=a*Bt(c),m=a*Et(p),y=a*Bt(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};ez=tz([Xw()],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let nz=class extends bB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=UT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=vE(u,p),x=xE(u,f),S=yE(c),w=_E(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=nT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={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+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};nz=iz([Xw()],nz);var sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};rz=sz([Xw()],rz);let az=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};az=sz([Xw()],az);var oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};lz=oz([Xw()],lz);let hz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};hz=oz([Xw()],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};dz=cz([Xw()],dz);let uz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:CC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:CC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:CC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:CC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};uz=cz([Xw()],uz);var pz=new Vw((t=>{t(RF).toSelf(),t(EI).toService(RF),t(XF).toSelf(),t(cI).toService(XF),t(IF).toSelf(),t(TI).toService(IF),t($E).toSelf().inSingletonScope(),t(gI).to($E),t(fI).to($E),t(GI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(YI).toSelf().inSingletonScope(),t(BE).toService(GI),t(BE).toService(UI),t(BE).toService(YI),nA(t,BE),t(NB).toSelf().inSingletonScope(),t(bI).to(NB),t(fI).to(NB),t(KF).toSelf().inSingletonScope(),t(xI).toService(KF),t(fI).toService(xI),t(JI).toSelf().inSingletonScope(),t(QI).toSelf().inSingletonScope(),t(tD).toSelf().inSingletonScope(),t(eD).toSelf().inSingletonScope(),t(iD).toSelf().inSingletonScope(),t(FE).toService(JI),t(FE).toService(QI),t(FE).toService(tD),t(FE).toService(eD),t(FE).toService(iD),nA(t,FE),t(KB).toSelf().inSingletonScope(),t(wI).to(KB),t(fI).to(KB),nA(t,HE),t(LB).toSelf().inSingletonScope(),t(_I).to(LB),t(fI).to(LB),t(lz).toSelf().inSingletonScope(),t(hz).toSelf().inSingletonScope(),t(LE).toService(lz),t(LE).toService(hz),nA(t,LE),t(UB).toSelf().inSingletonScope(),t(SI).to(UB),t(fI).to(UB),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(aD).toSelf().inSingletonScope(),t(zE).toService(sD),t(zE).toService(rD),t(zE).toService(aD),nA(t,zE),t(GE).toSelf().inSingletonScope(),t(dI).to(GE),t(fI).to(GE),t(ez).toSelf().inSingletonScope(),t(uI).toService(ez),t(fI).toService(uI),t(jI).toSelf().inSingletonScope(),t(NI).toSelf().inSingletonScope(),t(VI).toSelf().inSingletonScope(),t(PE).toService(jI),t(PE).toService(NI),t(PE).toService(VI),nA(t,PE),t(AB).toSelf().inSingletonScope(),t(yI).to(AB),t(fI).to(AB),t(HF).toSelf().inSingletonScope(),t(NF).toSelf().inSingletonScope(),t(RB).toSelf().inSingletonScope(),t(pI).to(RB),t(fI).to(RB),t(dz).toSelf().inSingletonScope(),t(uz).toSelf().inSingletonScope(),t(RE).toService(dz),t(RE).toService(uz),nA(t,RE),t(FF).toSelf().inSingletonScope(),t(mI).to(FF),t(fI).to(FF),t($I).toSelf().inSingletonScope(),t(IE).toService($I),nA(t,IE),t(sI).toSelf().inSingletonScope(),t(vI).to(sI),t(fI).to(sI),t(rz).toSelf().inSingletonScope(),t(az).toSelf().inSingletonScope(),t(OE).toService(rz),t(OE).toService(az),nA(t,OE),t(QF).toSelf().inSingletonScope(),t(MI).toService(QF),t(fI).toService(MI),t(hI).toSelf().inSingletonScope(),t(CI).toService(hI),t(fI).toService(CI),t(qI).toSelf().inSingletonScope(),t(DE).toService(qI),nA(t,DE),t(ZF).toSelf().inSingletonScope(),t(AI).toService(ZF),t(fI).toService(AI),t(nz).toSelf().inSingletonScope(),t(kI).toService(nz),t(fI).toService(kI),t(FI).toSelf().inSingletonScope(),t(HE).toService(FI),t(PE).toService(FI),t(LE).toService(FI),t(zE).toService(FI),t(FE).toService(FI),t(DE).toService(FI),t(BE).toService(FI),t(RE).toService(FI),t(OE).toService(FI),nA(t,jE),nA(t,fI),t(MF).toSelf().inSingletonScope(),t(AF).toService(MF),t(CF).toSelf().inSingletonScope(),t(AF).toService(CF),nA(t,AF)}));var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mz=function(t,e){return function(i,n){e(i,n,t)}};let yz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};yz=gz([Xw(),mz(0,qw(gI)),fz("design:paramtypes",[Object])],yz);var _z=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bz=function(t,e){return function(i,n){e(i,n,t)}};const xz=new Wt;let Sz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=PI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;xz.setValue(i.x1,i.y1,i.x2,i.y2),xz.expand(-r/2),h=!xz.containsPoint(e)}}return n.highPerformanceRestore(),h}};Sz=_z([Xw(),bz(0,qw(bI)),vz("design:paramtypes",[Object])],Sz);var wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Az=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kz=function(t,e){return function(i,n){e(i,n,t)}};let Mz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Mz=wz([Xw(),kz(0,qw(dI)),Az("design:paramtypes",[Object])],Mz);var Cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ez=function(t,e){return function(i,n){e(i,n,t)}};let Pz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Pz=Cz([Xw(),Ez(0,qw(pI)),Tz("design:paramtypes",[Object])],Pz);var Rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Bz=class{constructor(){this.type="image",this.numberType=NT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Bz=Rz([Xw()],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dz=class extends bB{};Dz=Iz([Xw()],Dz);var Lz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fz=function(t,e){return function(i,n){e(i,n,t)}};let zz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};zz=Lz([Xw(),Fz(0,qw(yI)),Oz("design:paramtypes",[Object])],zz);var Hz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nz=function(t,e){return function(i,n){e(i,n,t)}};let Vz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Vz=Hz([Xw(),Nz(0,qw(_I)),jz("design:paramtypes",[Object])],Vz);var Wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Yz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=KT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=FM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Yz=Wz([Xw(),Uz(0,qw(SI)),Gz("design:paramtypes",[Object])],Yz);var Xz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kz=function(t,e){return function(i,n){e(i,n,t)}};let qz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=qT}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=FM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=QE(a,u,s),y=JE(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&UR.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};qz=Xz([Xw(),Kz(0,qw(wI)),$z("design:paramtypes",[Object])],qz);var Zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qz=function(t,e){return function(i,n){e(i,n,t)}};let tH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};tH=Zz([Xw(),Qz(0,qw(vI)),Jz("design:paramtypes",[Object])],tH);var eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let sH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=$T}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};sH=eH([Xw(),nH(0,qw(AI)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};lH=rH([Xw(),oH(0,qw(MI)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let uH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=XT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};uH=hH([Xw(),dH(0,qw(xI)),cH("design:paramtypes",[Object])],uH);var pH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let mH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mH=pH([Xw(),fH(0,qw(kI)),gH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let bH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=OT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};bH=yH([Xw(),vH(0,qw(uI)),_H("design:paramtypes",[Object])],bH);var xH=new Vw(((t,e,i,n)=>{t(yz).toSelf().inSingletonScope(),t(UD).toService(yz),t(nL).toService(UD),t(Sz).toSelf().inSingletonScope(),t(KD).toService(Sz),t(nL).toService(KD),t(uH).toSelf().inSingletonScope(),t(qD).toService(uH),t(nL).toService(qD),t(Mz).toSelf().inSingletonScope(),t(VD).toService(Mz),t(nL).toService(VD),t(Pz).toSelf().inSingletonScope(),t(GD).toService(Pz),t(nL).toService(GD),t(Bz).toSelf().inSingletonScope(),t(YD).toService(Bz),t(nL).toService(YD),t(zz).toSelf().inSingletonScope(),t(XD).toService(zz),t(nL).toService(XD),t(Vz).toSelf().inSingletonScope(),t($D).toService(Vz),t(nL).toService($D),t(Yz).toSelf().inSingletonScope(),t(ZD).toService(Yz),t(nL).toService(ZD),t(qz).toSelf().inSingletonScope(),t(JD).toService(qz),t(nL).toService(JD),t(tH).toSelf().inSingletonScope(),t(QD).toService(tH),t(nL).toService(QD),t(mH).toSelf().inSingletonScope(),t(tL).toService(mH),t(nL).toService(tL),t(bH).toSelf().inSingletonScope(),t(WD).toService(bH),t(nL).toService(WD),t(sH).toSelf().inSingletonScope(),t(eL).toService(sH),t(nL).toService(eL),t(lH).toSelf().inSingletonScope(),t(iL).toService(lH),t(nL).toService(iL),nA(t,nL)})),SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([Xw(),AH(0,qw(_I)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([Xw(),TH(0,qw(gI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BH=function(t,e){return function(i,n){e(i,n,t)}};const IH=new Wt;let DH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;IH.setValue(i.x1,i.y1,i.x2,i.y2),IH.expand(-r/2),h=!IH.containsPoint(e)}}return n.highPerformanceRestore(),h}};DH=PH([Xw(),BH(0,qw(bI)),RH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FH=function(t,e){return function(i,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};zH=LH([Xw(),FH(0,qw(dI)),OH("design:paramtypes",[Object])],zH);var HH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NH=function(t,e){return function(i,n){e(i,n,t)}};let VH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};VH=HH([Xw(),NH(0,qw(pI)),jH("design:paramtypes",[Object])],VH);var WH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let YH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};YH=WH([Xw(),UH(0,qw(yI)),GH("design:paramtypes",[Object])],YH);var XH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KH=function(t,e){return function(i,n){e(i,n,t)}};let qH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=KT}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=FM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qH=XH([Xw(),KH(0,qw(SI)),$H("design:paramtypes",[Object])],qH);var ZH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JH=class{constructor(){this.type="text",this.numberType=qT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};JH=ZH([Xw()],JH);var QH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ej=function(t,e){return function(i,n){e(i,n,t)}};let ij=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ij=QH([Xw(),ej(0,qw(vI)),tj("design:paramtypes",[Object])],ij);var nj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rj=function(t,e){return function(i,n){e(i,n,t)}};let aj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};aj=nj([Xw(),rj(0,qw(MI)),sj("design:paramtypes",[Object])],aj);var oj=new Vw((t=>{t(EH).toSelf().inSingletonScope(),t(aL).toService(EH),t(gL).toService(aL),t(DH).toSelf().inSingletonScope(),t(hL).toService(DH),t(gL).toService(hL),t(zH).toSelf().inSingletonScope(),t(sL).toService(zH),t(gL).toService(sL),t(VH).toSelf().inSingletonScope(),t(rL).toService(VH),t(gL).toService(rL),t(YH).toSelf().inSingletonScope(),t(oL).toService(YH),t(gL).toService(oL),t(kH).toSelf().inSingletonScope(),t(lL).toService(kH),t(gL).toService(lL),t(qH).toSelf().inSingletonScope(),t(cL).toService(qH),t(gL).toService(cL),t(JH).toSelf().inSingletonScope(),t(dL).toService(JH),t(gL).toService(dL),t(ij).toSelf().inSingletonScope(),t(uL).toService(ij),t(gL).toService(uL),t(aj).toSelf().inSingletonScope(),t(pL).toService(aj),t(aj).toService(pL),nA(t,gL)}));var lj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new ND(t))).whenTargetNamed(ND.env),t(Yk).toDynamicValue((()=>(t,e)=>new FD(t,e))).whenTargetNamed(FD.env)})),hj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new EO(t))).whenTargetNamed(EO.env),t(Yk).toDynamicValue((()=>(t,e)=>new kO(t,e))).whenTargetNamed(kO.env)})),cj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new vO(t))).whenTargetNamed(vO.env),t(Yk).toDynamicValue((()=>(t,e)=>new fO(t,e))).whenTargetNamed(fO.env)})),dj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new HO(t))).whenTargetNamed(HO.env),t(Yk).toDynamicValue((()=>(t,e)=>new LO(t,e))).whenTargetNamed(LO.env)})),uj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new aF(t))).whenTargetNamed(aF.env),t(Yk).toDynamicValue((()=>(t,e)=>new iF(t,e))).whenTargetNamed(iF.env)})),pj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new qO(t))).whenTargetNamed(qO.env),t(Yk).toDynamicValue((()=>(t,e)=>new YO(t,e))).whenTargetNamed(YO.env)}));Wk.load(mE),Wk.load(EL),Wk.load(uD),Wk.load(TL),Wk.load(OL),function(t){t.load(aO),t.load(uF),t.load(pF),t.load(SF)}(Wk),function(t){t.load(pz)}(Wk),function(t){t.load(xH),t.load(oj)}(Wk),function(t){t.load(lj),t.load(cj),t.load(hj),t.load(dj),t.load(uj),t.load(pj)}(Wk);const gj=Wk.get(oA);Gk.global=gj;const fj=Wk.get(gE);Gk.graphicUtil=fj;const mj=Wk.get(pE);Gk.transformUtil=mj;const yj=Wk.get(ZT);Gk.graphicService=yj,Wk.get(TD);const _j=Wk.get(fE);Gk.layerService=_j;class vj{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Gk.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Gk.graphicService.hooks.onAttributeUpdate.taps=Gk.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onSetStage.taps=Gk.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class bj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class xj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.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))})),Gk.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){Gk.graphicService.hooks.onAddIncremental.taps=Gk.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onClearIncremental.taps=Gk.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gk.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({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Sj=new Wt;class wj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Gk.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&&(Sj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Sj,t.parent&&t.parent.globalTransMatrix)))})),Gk.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))})),Gk.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Gk.graphicService.hooks.beforeUpdateAABBBounds.taps=Gk.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.afterUpdateAABBBounds.taps=Gk.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onRemove.taps=Gk.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Aj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===rC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=rC.INITIAL,Gk.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Gk.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:sC},{mode:"timeout",cons:nC},{mode:"manual",cons:iC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==rC.INITIAL&&(this.status=rC.PAUSE,!0)}resume(){return this.status!==rC.INITIAL&&(this.status=rC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===rC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===rC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=rC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=rC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Aj.addTimeline(oC),Aj.setFPS(60);class kj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=nT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=It(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=Rt(Pt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=f(e)?nT.get(e).value:e;const r=this.colorRgb;return nT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const Mj="white";class Cj extends tE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:Mj}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new LM,this.hooks={beforeRender:new rA(["stage"]),afterRender:new rA(["stage"])},this.global=Wk.get(oA),this.window=Wk.get(cE),this.renderService=Wk.get(cD),this.pickerService=Wk.get(wD),this.pluginService=Wk.get(RL),this.layerService=Wk.get(fE),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Wt,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Mj,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new ZM({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Aj,!1!==t.interactiveLayer&&this.initInteractiveLayer()}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new kj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new BD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new bj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new vj))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new xj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new wj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}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))}initInteractiveLayer(){this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive"}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Ht(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Wk.get(cE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Tj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Tj||(Tj={}));const Ej="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Pj=Ej,Rj=14,Bj=18,Ij=4,Dj={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Rj}}},Lj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Oj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Rj,offset:12,position:"outside"}}},Fj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},zj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},Hj="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",jj={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:Hj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Hj,fill:"#ddd"}}},Nj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Vj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Wj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},Gj={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj}}},Uj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Yj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Xj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Rj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Rj}}},$j={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Rj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Rj,textBaseline:"middle",textAlign:"center"}}},Kj="__VCHART",qj=500,Zj=500,Jj=`${Kj}_LABEL_LIMIT`,Qj=`${Kj}_LABEL_ALIGN`,tN=`${Kj}_LABEL_TEXT`,eN=`${Kj}_LABEL_VISIBLE`,iN=`${Kj}_LABEL_X`,nN=`${Kj}_LABEL_Y`,sN=`${Kj}_ARC_RATIO`,rN=`${Kj}_ARC_START_ANGLE`,aN=`${Kj}_ARC_END_ANGLE`,oN=`${Kj}_ARC_K`,lN=`${Kj}_ARC_LABEL_HOVER_AX`,hN=`${Kj}_ARC_LABEL_HOVER_AY`,cN=`${Kj}_ARC_LABEL_POINT_AX`,dN=`${Kj}_ARC_LABEL_POINT_AY`,uN=`${Kj}_ARC_LABEL_POINT_BX`,pN=`${Kj}_ARC_LABEL_POINT_BY`,gN=`${Kj}_ARC_LABEL_POINT_CX`,fN=`${Kj}_ARC_LABEL_POINT_CY`,mN=`${Kj}_ARC_LABEL_SELECTED_AX`,yN=`${Kj}_ARC_LABEL_SELECTED_AY`,_N=`${Kj}_ARC_MIDDLE_ANGLE`,vN=`${Kj}_ARC_QUADRANT`,bN=`${Kj}_ARC_RADIAN`,xN=-Math.PI/2,SN=3*Math.PI/2,wN=-90,AN=270,kN=.6,MN={},CN=[],TN=(t,e,i)=>{MN[t]=Object.assign(e,{type:t}),i||CN.push(t)},EN=()=>{CN.slice().forEach((t=>{(t=>{delete MN[t];const e=CN.indexOf(t);e>=0&&CN.splice(e,1)})(t)}))};function PN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:f(t)?t:h(s=t)?null:s.fname})):null}function RN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function BN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const IN=":vGrammar_identifier:";function DN(t,e){return N(t).reduce(((t,i)=>{const n=f(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function LN(t,e){if(h(t))return[];if(!l(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(f(i))return N(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!l(t)&&!!(null==t?void 0:t.callback)}(t))return DN(t.dependency,e);var i;return[]}function ON(t){return l(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function FN(t,e,i,n){if(h(t))return t;if(l(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return f(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function zN(t,e){return HN(t)?t.output():e[t]}const HN=t=>t&&!h(t.grammarType),jN=t=>l(t)?t:e=>e[t],NN=t=>f(t)&&se.parseColorString(t)?t:null;function VN(t){return!!(null==t?void 0:t.scale)}function WN(t){return!!(null==t?void 0:t.field)}function GN(t,e){if(!t)return[];let i=[];return t.scale&&(i=HN(t.scale)?[t.scale]:N(e.getScaleById(t.scale))),i.concat(LN(t,e))}class UN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return f(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=N(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const YN={},XN=t=>YN[t],$N=(t,e,i,n,s)=>(YN[t]=new UN(e,i,n,s),YN[t]);function KN(t){return null===t?0:t}function qN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const ZN=["fillOpacity","x","y","dx","dy"],JN=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=KN(i.x),["x"]):"y"===e?(t.y=KN(i.y),["y"]):"dx"===e?(t.dx=KN(i.dx),["dx"]):"dy"===e?(t.dy=KN(i.dy),["dy"]):[]};var QN,tV,eV,iV,nV,sV,rV,aV,oV,lV,hV,cV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(QN||(QN={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(tV||(tV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(eV||(eV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(iV||(iV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(nV||(nV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(sV||(sV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(rV||(rV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(aV||(aV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(oV||(oV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(lV||(lV={})),function(t){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_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"}(hV||(hV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(cV||(cV={}));const dV={[tV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),b(e.length)||!b(e.z1)&&b(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):b(e.z1)||!b(e.length)&&b(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[tV.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[tV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return b(e)&&b(i)&&b(n)&&b(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[tV.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const uV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=f(t)?dV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(ZN.includes(r)?JN(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{ZN.includes(t)?JN(s,t,e):s[t]=e[t]}));return s},pV=(t,e,i)=>!(!h(t)||!h(e))||!h(t)&&!h(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(f(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function gV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case tV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case tV.group:case tV.rect:case tV.image:return["width","height","y1"].includes(e);case tV.path:case tV.shape:return["path","customPath"].includes(e);case tV.line:return"defined"===e;case tV.area:return["x1","y1","defined"].includes(e);case tV.rule:return["x1","y1"].includes(e);case tV.symbol:return"size"===e;case tV.polygon:return"points"===e;case tV.text:return"text"===e}return!1}function fV(t,e,i,n,s){i&&(ON(i)?e.forEach((e=>{const s=FN(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],c=s&&!gV(t.mark.markType,r)?[e[0]]:e;if(VN(l)){const t=zN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!h(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=f(null==l?void 0:l.field),d=s?ll(l.field):null;let u=s?null:h(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=v(u)||v(i)?u+e+i:u}))}else if(WN(l)){const t=ll(l.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=FN(l,n,e.datum,t)}))})))}function mV(t,e,i,n){if(!t)return null;if(ON(t))return FN(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const c=t[r];if(VN(c)){const t=zN(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!h(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=f(null==c?void 0:c.field),p=u?ll(c.field):null,g=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):h(null==c?void 0:c.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,c.value);s[r]=v(g)||v(d)?g+i+d:g}else if(WN(c)){const t=ll(c.field);s[r]=t(e)}else s[r]=FN(c,n,e,i)})),s}function yV(t){if(t)return t.type===Fl.Band?t.bandwidth():t.type===Fl.Point?t.step():void 0}const _V={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=l(i)?i:pl(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!h(s)){if(h(t))return;t[s]=e}return e})),e;const r=n(e,i);return h(s)||h(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=We.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=ll(a),c=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),d=h(t.default)?null:t.default,u=s.map((t=>ll(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),h(n)&&(n=o);const t=o.map((t=>ll(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],l=o.length;return(h(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=h(r)?d:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=PN(i,t.as||[]),s=i.map((t=>f(t)?ll(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Y(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],x=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),w=b(S*_)?S/_:null,A=b(_*_)?_/x:null;return d&&(y[d]=x),p&&(y[p]=S),r&&(y[r]=w),a&&(y[a]=0===i?1:A),o&&(y[o]=!0===g?w:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:S/v[1]),c&&(y[c]=0===i?1:x/v[1]),u&&(y[u]=_),y}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=RN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=BN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return BN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;h(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=h(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=h(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{h(n[IN])&&(n[IN]=0);let s=n[IN];const r=t.as;return e.forEach((t=>{t&&h(t[r])&&(s+=1,t[r]=s)})),n[IN]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=yV(a.y),l="y"===t.dodgeChannel||h(t.dodgeChannel)&&o>0?"y":"x",c="y"===l?o:yV(a.x);if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!h(t.dodgeBy)){const e=rl(N(t.dodgeBy));o=t=>e(t.getDatum())}const d=[];e.forEach((t=>{const e=o(t);d.includes(e)||d.push(e)}));const u=d.length;if(u<1)return e;const p=ml(a,c);let g=p>=c?c:c-p;const f=ml(i,g);let m=(g-Math.max(u-1,0)*f)/u;m>t.maxWidth?(g-=(m-t.maxWidth)*u,m=t.maxWidth):m{y[t]=-g/2+e*(m+f)}));const _=r.markType;"rect"===_||"interval"===_?e.forEach((t=>{const e=o(t),i=y[e],n=t.getItemAttribute();if("x"===l){const e={x:(h(n.width)&&!h(n.x1)?Math.min(n.x,n.x1):n.x)+(h(n.width)?h(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};h(n.width)?e.x1=e.x+m:e.width=m,t.setItemAttributes(e)}else if("y"===l){const e={y:(h(n.height)&&!h(n.y1)?Math.min(n.y,n.y1):n.y)+(h(n.height)?h(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};h(n.height)?e.y1=e.y+m:e.height=m,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=y[e];if("x"===l){const e=t.getItemAttribute("x")+c/2;t.setItemAttributes({x:e+i+m/2})}else if("y"===l){const e=t.getItemAttribute("y")+c/2;t.setItemAttributes({y:e+i+m/2})}}))}return e},markPhase:"afterEncodeItems"}},vV="__vgrammar_scene_item__",bV=[tV.line,tV.area],xV=[tV.arc3d,tV.rect3d,tV.pyramid3d],SV="key",wV=[{}],AV=["key"],kV="VGRAMMAR_IMMEDIATE_ANIMATION",MV=0,CV=1e3,TV=0,EV=!1,PV=!1,RV="quintInOut",BV={stopWhenStateChange:!1,immediatelyApply:!0},IV={},DV=t=>IV[t],LV=(t,e)=>{IV[t]={creator:e}};class OV extends tE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new pk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Ik.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new pk;let a,o;r.clear();const l=v(s)?s:Pt(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(hV.BEFORE_CREATE_VRENDER_MARK),e===tV.largeRects)return new OV(i);if(e===tV.largeSymbols)return new FV(i);const n=zV[e]?zV[e](i):DV(e)?DV(e).creator(i):null;return t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}function jV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(hV.BEFORE_CREATE_VRENDER_MARK);const n=new JP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=zV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}const NV=t=>{t&&(t[vV]=null,t.release(),t.parent&&t.parent.removeChild(t))};class VV{constructor(t){this.data=null,this.states=[],this.diffState=QN.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if(l(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));fV(this,o,a,this.mark.parameters());const h=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?uV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),h(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===QN.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(hV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=jN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(hV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=N(FN(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===QN.unChange&&(this.diffState=QN.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||this.useStates(this.states),this.mark.markType===tV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new pk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===QN.enter?(r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.update?(n&&r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.exit&&a&&fV(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=o(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=N(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&f(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=N(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=o(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)fl(n,i,t)&&E(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let c=null==l?void 0:l.nextAttrs;if(t&&t.length&&h(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||qN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[tV.line,tV.area,tV.largeRects,tV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===tV.line||e===tV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>qN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=KN(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=KN(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=KN(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=KN(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===tV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>pV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=uV(tV.line,t.attrs,i);return n.points=e.slice(t.startIndex,h(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?Object.assign(c,{segments:e,points:null}):Object.assign(c,{points:t,segments:null})}else p?Object.assign(c,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(c,{points:s,segments:null})}else e===tV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=KN(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=KN(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=KN(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=KN(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===tV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=KN(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=KN(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!M(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!h(e=C(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return C(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!E(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!E(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(NV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(NV(this.graphicItem),this.graphicItem[vV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?h(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):h(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?m(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const WV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(b(e.center.x)&&(s.x=e.center.x),b(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},GV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),UV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const YV=["visible","path","text","lineWidth","textBaseline","textAlign"],XV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:c+u/2,width:h(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:d+p/2,height:h(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:c+u/2,x1:c+u/2,y:d+p/2,y1:d+p/2,width:h(o)?void 0:0,height:h(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:h(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:h(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:h(n)?void 0:0,height:h(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:h(n)?void 0:0}}:{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:h(n)?void 0:0}}:{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:WV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:GV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:GV(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:UV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:UV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return YV.forEach((t=>{delete n[t],delete s[t]})),N(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{fl(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},$V=Object.assign({},XV),KV=t=>$V[t],qV=(t,e)=>{$V[t]=e},ZV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.from.min=l,m.to.min=d),b(u)&&(m.from.max=l,m.to.max=u),b(p)&&(m.from.q1=l,m.to.q1=p),b(g)&&(m.from.q3=l,m.to.q3=g),b(f)&&(m.from.median=l,m.to.median=f),m},JV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.to.min=l,m.from.min=d),b(u)&&(m.to.max=l,m.from.max=u),b(p)&&(m.to.q1=l,m.from.q1=p),b(g)&&(m.to.q3=l,m.from.q3=g),b(f)&&(m.to.median=l,m.from.median=g),m},QV=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(b(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return b(f)?f:b(_)&&b(v)?(_+v)/2:b(m)&&b(y)?(m+y)/2:b(y)?y:b(m)?m:NaN},tW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),b(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(b(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),b(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const eW=(t,e,i)=>{var n,s,r,a;if(b(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return b(o)?o:b(c)&&b(d)?(c+d)/2:b(l)&&b(h)?(l+h)/2:b(h)?h:b(l)?l:NaN},iW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),b(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(b(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),b(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const nW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},sW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},rW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sW:nW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function hW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(SV,i?t.slice().sort(i):t.slice()),{keys:AV,data:n};const s=jN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class cW{constructor(t,e,i){this.prevData=hW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const dW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const uW=(t,e,i,n,s)=>l(i)?i(t.getDatum(),t,s):i;class pW extends lC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class gW extends lC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{h(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}cC.mode|=TA.SET_ATTR_IMMEDIATELY;let fW=0;const mW=t=>!h(t)&&t.prototype instanceof lC;class yW{constructor(t,e,i){this.id=fW++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),b(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=l(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!KV(e.type))return null;const r=KV(e.type)(t,s,i);return dW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return m(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):d(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!h(null===(r=s[i])||void 0===r?void 0:r.from),l=!h(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?uW(t,0,s[i].from,0,n):void 0,e.to[i]=l?uW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),dW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),c=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=mW(o);return h(o)||mW(o)?u?new o(a.from,a.to,r,t.easing,c):a.to?new gW(a.from,a.to,r,t.easing):void 0:new pW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:c})})).filter((t=>!h(t)));1===e.length?t.play(e[0]):t.play(new OC(r,e))}}}function _W(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(vW(i,t[i]))})),e}function vW(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return N(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,c,d,u;if(h(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:MV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:PV,loop:null!==(n=l.loop)&&void 0!==n?n:EV,controlOptions:L({},BV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:CV,delay:null!==(a=l.delay)&&void 0!==a?a:TV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:RV,customParameters:l.customParameters,options:l.options}]}]}}const p=N(t.timeSlices).filter((t=>t.effects&&N(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:MV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:PV,loop:null!==(d=t.loop)&&void 0!==d?d:EV,controlOptions:L({},BV,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:TV,effects:N(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:RV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function bW(t,e,i){return l(t)?t.call(null,e.getDatum(),e,i):t}class xW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!h(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class SW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=_W(null!=e?e:{})}updateConfig(t){this.configs=_W(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==QN.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=vW(kV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return h(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=N(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===QN.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(h(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},o),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new yW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===QN.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(hV.ANIMATION_START,d),this.mark.emit(hV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=FN(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=bW(t.startTime,e,s),o=bW(t.totalTime,e,s),l=bW(t.oneByOne,e,s),h=bW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=bW(t.delay,e,s),l=null!==(i=bW(t.duration,e,s))&&void 0!==i?i:o/n,h=N(t.effects).map((t=>Object.assign({},t,{customParameters:bW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=v(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:v(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===QN.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===QN.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===kV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===QN.exit&&0===a[QN.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(hV.ANIMATION_END,h),this.mark.emit(hV.ELEMENT_ANIMATION_END,h,i)}}const wW=(t,e)=>HN(t)?t.output():t&&d(t)?l(t.callback)?i=>t.callback(i,e):l(t.value)?t.value(e):t:t,AW=(t,e)=>t?d(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=wW(s,e),i}),{}):t.map((t=>wW(t,e))):t;var kW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let MW=-1;class CW extends r{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=N(this.spec.dependency).map((t=>f(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=N(t).map((t=>f(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((i=>{var n;h(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return h(this.spec[e])||this.detach(LN(this.spec[e],this.view)),this.spec[e]=t,this.attach(LN(t,this.view)),this.commit(),this}}const TW=(t,e,i)=>{var n,s;if("callback"===t&&l(e))return{references:[],value:{callback:e,dependency:[]}};if(!h(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!h(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!h(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=LN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},EW=(t,e)=>{const i=(n=t.type,MN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(DN(a,e))));const o=((t,e,i)=>{if(h(e))return{value:e};if(m(e)){const n=e.map((e=>TW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return TW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},PW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=EW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class RW extends VV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if(l(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return fV(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?uV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=o(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===QN.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!h(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===QN.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=uV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{E(this.items[0].nextAttrs,e)||E(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=dV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{E(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===tV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return bV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&E(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),E(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),E(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)fl(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[vV]=null})),this.glyphGraphicItems=null),super.release()}}const BW=t=>t.markType===tV.glyph?new RW(t):new VV(t);function IW(t){return h(t.offsetX)?h(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function DW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return b(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),b(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&b(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&b(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const LW="window",OW="view",FW={trap:!1},zW="default",HW="width",jW="height",NW="viewWidth",VW="viewHeight",WW="padding",GW="viewBox",UW="autoFit";function YW(t,e,i,n,s){if(s===LW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{DW(t,IW(t),!1)}))}));const e=IW(t);DW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var XW=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 $W extends CW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new SW(this,{}),this.differ=new cW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=f(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=f(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!h(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===QN.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===lV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:wV,e);let n=i;i.progressive&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(hV.AFTER_MARK_ENCODE)}return this.emit(hV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(hV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>h(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return XW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,h(t)||(f(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return f(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];ON(i)?this.detach(GN(i,this.view)):f(e)?this.detach(GN(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(GN(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return f(e)?(this.spec.encode[t][e]=i,this.attach(GN(i,this.view))):ON(e)?(this.spec.encode[t]=e,this.attach(GN(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(GN(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=PW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{h(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{h(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return bV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!h(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===QN.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];ON(s)||Object.keys(s).forEach((t=>{VN(s[t])&&(e[t]=zN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV];if((null==n?void 0:n.mark)===this){const i=YW(this.view,t,n,e,OW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new SW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=zN(this.spec.group,e);this.group=t,t&&(this.emit(hV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(hV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==tV.group){if(!this.graphicItem){const t=HV(this,tV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||xV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==tV.group?(h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=jN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>SV),a=jN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>SV),o=this.spec.sort,l=this.spec.groupSort,c=this.isCollectionMark(),d=new Set(this.elements.filter((t=>t.diffState===QN.enter))),u=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(h(e))s=this.elementMap.get(n),s&&(s.diffState=QN.exit);else if(h(i)){s=this.elementMap.has(n)?this.elementMap.get(n):BW(this),s.diffState===QN.exit&&(s.diffState=QN.enter,this.animate.getElementAnimators(s,QN.exit).forEach((t=>t.stop("start")))),s.diffState=QN.enter;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),u.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=QN.update;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),u.push(s)}d.delete(s)}));const p=null!=t?t:wV;this.differ.setCurrentData(hW(p,c?a:t=>`${a(t)}-${r(t)}`,c?l:void 0)),this.differ.doDiff(),d.forEach((t=>{this.elementMap.delete(c?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=u,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:HV(this,this.markType,t);if(this.emit(hV.BEFORE_ADD_VRENDER_MARK),this.markType===tV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(hV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==tV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=hW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=jN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>SV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=BW(this);e.diffState=QN.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=BW(this);i.diffState=QN.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(ON(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===tV.glyph&&XN(i)){const t=XN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>gV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{gV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(gV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(hV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(hV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(hV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||AV).forEach((t=>{const e=HV(this,tV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(hV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==QN.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return dV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=QN.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&NV(this.graphicItem),this.detachAll(),super.release()}}class KW extends $W{constructor(t,e,i){super(t,tV.component,i),this._componentDatum={[SV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:DV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,SV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[SV]+=1}evaluateJoin(t){return this.spec.key=SV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=f(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=f(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const qW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class ZW extends tE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){p(this.attribute[t])?L(this.attribute[t],e):this.attribute[t]=e,qW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>qW.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){h(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ct(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ct(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onSliderPointerMove),gj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onSliderPointerMove),gj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=dt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ge(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]=Ge(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new UM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function QW(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&QW(t,e)}))}JW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const tG=t=>!h(t)&&!1!==t.visible,eG=["#ffffff","#000000"];function iG(t,e,i,n,s){const r=aG(t),a=aG(e);return nG(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...eG);for(const s of r)if(t!==s&&nG(s,e,i,n))return s}(r,a,i,n,s)}function nG(t,e,i,n){return n?sG(t,e)>n:"largeText"===i?sG(t,e)>3:sG(t,e)>4.5}function sG(t,e){const i=rG(t),n=rG(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function rG(t){const e=ae(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 aG(t){if(null==t?void 0:t.includes("#"))return t;const e=new se(t),{r:i,g:n,b:s}=e.color;return"#"+oe(i,n,s)}function oG(t,e){return[t[0]*e,t[1]*e]}function lG(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const hG=-.5*Math.PI,cG=1.5*Math.PI,dG="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var uG;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uG||(uG={}));const pG={[uG.selectedReverse]:{},[uG.selected]:{},[uG.hover]:{},[uG.hoverReverse]:{}},gG=(t,e,i)=>new He(Object.assign({defaultFontParams:{fontFamily:dG,fontSize:11},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function fG(t,e){var i,n;if(!t)return{width:0,height:0};const s=_B({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var mG=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);sl&&(y=l,k.setAttribute("maxLineWidth",l-g[1]-g[2])));let D=0,L=0;"center"===B?(D-=y/2,m&&m.setAttribute("x",(m.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===B||"end"===B?(D-=y,m&&m.setAttribute("x",(m.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==B&&"start"!==B||f.setAttribute("x",g[3]),"middle"===I?(L-=_/2,m&&m.setAttribute("y",0)):"bottom"===I?(L-=_,m&&m.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===I&&(f.setAttribute("y",g[0]),m&&m.setAttribute("y",E/2));const{visible:O}=s,F=mG(s,["visible"]);if(u&&o(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:O&&!!e,x:D,y:L,width:y,height:_}),"rect");M(null==p?void 0:p.panel)||(t.states=p.panel)}}}yG.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var _G=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);sf?H=f:Hde&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>ge&&deme&&pece&&feue&&ye=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wG=class{render(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;this.poptipComponent||(this.poptipComponent=new vG(t.attribute.poptip));let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};g=n,L(e,xG.poptip,g),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const s=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:s.e,y:s.f}));const r=h.stage.getLayer("_builtin_interactive");r&&r.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wG=SG([Xw()],wG);var AG=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kG=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kG=AG([Xw()],kG);let MG=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MG=AG([Xw()],MG);const CG=new Vw((t=>{t(wG).toSelf().inSingletonScope(),t(jE).toService(wG),t(kG).toSelf().inSingletonScope(),t(PL).toService(kG),t(MG).toSelf().inSingletonScope(),t(PL).toService(MG)}));class TG extends ZW{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EG extends TG{constructor(t){super(L({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PG extends TG{constructor(t){super(L({},PG.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})}}PG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RG extends TG{constructor(t){super(L({},RG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}RG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class BG extends TG{constructor(t){super(L({},BG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=hG,endAngle:n=cG}=this.attribute,s=n-i,r=Ut(Kt(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}BG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class IG extends TG{constructor(t){super(L({},IG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=$t(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}IG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const DG=new Uint32Array(33),LG=new Uint32Array(33);LG[0]=0,DG[0]=~LG[0];for(let t=1;t<=32;++t)LG[t]=LG[t-1]<<1|1,DG[t]=~LG[t];function OG(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.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:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&DG[31&n]&LG[1+(31&s)])return!0}else{if(i[r]&DG[31&n])return!0;if(i[a]&LG[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,DG[31&i]&LG[1+(31&s)]);else for(n(r,DG[31&i]),n(a,LG[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,LG[31&i]|DG[1+(31&n)]);else for(s(r,LG[31&i]),s(a,DG[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FG(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function zG(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=FG(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function HG(t,e){return!(!t||!e)&&e.encloses(t)}function jG(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return jG(t,e,s,h,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return jG(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}if("moveX"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return jG(t,e,s,r,null===(c=n.overlap)||void 0===c?void 0:c.clampForce)}return!1}const VG=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],WG=["top","inside-top","inside"];const GG={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UG(t,e){var i,n;return null!==(n=null===(i=GG[e])||void 0===i?void 0:i.call(GG,t))&&void 0!==n?n:{from:{},to:{}}}const YG="same-time",XG=300,$G="linear";class KG extends ZW{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||M(e.states)||(e.addState(uG.hover,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this,(t=>{M(t.states)||(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void QW(this,(t=>{M(t.states)||(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));M(e.states)||(e.addState(uG.selected,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!M(e)&&(t.states=e)}_createLabelText(t){const e=dB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if(l(s)&&(s=s({})),!s||0===s.length)return[];let r=[];l(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],h=this.getBaseMarkGroup(),c=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==h?void 0:h.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==h?void 0:h.AABBBounds.height())&&void 0!==s?s:0};if(0===c.width||0===c.height)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:p=!0,clampForce:g=!0}=e,f=this._bmpTool||OG(c.width,c.height),m=this._bitmap||f.bitmap(),y=u.some((t=>"bound"===t.type));d&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&m.setRange(FG(f,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:YG,h=null!==(n=a.duration)&&void 0!==n?n:XG,c=null!==(s=a.easing)&&void 0!==s?s:$G,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=UG(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&b(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new TC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(UG(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==MA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===MA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=iG(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=iG(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=iG(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class qG extends KG{constructor(t){super(L({},qG.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZG extends KG{constructor(t){super(L({},ZG.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}ZG.tag="rect-label",ZG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const JG={rect:ZG,symbol:qG};class QG extends ZW{constructor(t){super(L({},QG.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!b(n*i))return;this._componentMap||(this._componentMap=new Map);const s=OG(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function tU(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 eU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=jt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function iU(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=tU(t,!!s),o=tU(r,!!s);const h=jt.distancePP(n,l),c=jt.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=eU(e,t,!1,!!s),o=eU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=tU(t,!!s),o=tU(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}QG.defaultAttributes={pickable:!1};class nU extends ZW{constructor(t){super(L({},nU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!M(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let h="";if("line"===t||"polygon"===t)h=tU(o,!!n);else if("circle"===t){const{center:t}=this.attribute;h=eU(t,o,!1,!!n)}const c=lB(Object.assign({path:h,z:r},l(i)?L({},nU.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;o.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=tU(o,!!n),g=Ct(o[0].x-o[1].x),f=Ct(o[0].y-o[1].y),m=lB(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*wt/2:0,beta:gf?[o[0].x,0]:[0,o[0].y]},l(i)?L({},nU.defaultAttributes.style,i(t,e)):i));m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${s}`),this.add(m)})),e.length>1&&s)){const t=m(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=oB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),M(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=uB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),M(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var rU,aU;sU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(rU||(rU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(aU||(aU={}));const oU={[aU.selectedReverse]:{},[aU.selected]:{},[aU.hover]:{},[aU.hoverReverse]:{}},lU={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var hU=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.name&&!M(e.states)&&(e.addState(uG.hover,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(uG.selected))return this._lastSelect=null,void QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));e.name&&!M(e.states)&&(e.addState(uG.selected,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);L(this.attribute,t);const i=aB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=aB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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,grid:r,items:a,panel:o}=this.attribute,l=aB({x:0,y:0,zIndex:1});if(l.name=rU.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=aB({x:0,y:0,pickable:!1});t.name=rU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=hB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=rU.background,e.id=this._getNodeId("background"),M(o.state)||(e.states=L({},pG,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){const e=this.getTickLineItems(),i=aB({x:0,y:0,pickable:!1});i.name=rU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=oB(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=rU.tick,r.id=this._getNodeId(t.id),M(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=null;else{const t=this.data[n],e=L({},pG,this.attribute.tick.state);Object.keys(e).forEach((i=>{l(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(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=oB(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=rU.subTick,r.id=this._getNodeId(`${s}`),M(n.state))r.states=null;else{const i=L({},pG,n.state);Object.keys(i).forEach((n=>{l(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&&l(n)&&(e=n(e,i));const s=this._transformItems(e),r=aB({x:0,y:0,pickable:!1});r.name=`${rU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,o=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=dB(u);if(p.name=rU.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),M(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=null;else{const n=L({},pG,this.attribute.label.state);Object.keys(n).forEach((r=>{l(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),o=Math.max(o,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),o=Math.abs(o*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new yG(Object.assign({},e));i.name=rU.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return rt(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&l(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=wt/2*(l.x>e.x?1:-1):h=wt/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===_[1]?m+=(this.axisLabelLayerSize[n-1].height+C(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+C(this.attribute,"label.space",4))*n);const v=this.getVerticalCoord(t.point,m,p),b=this.getVerticalVector(m,p,v),x=g?g(t.label,t,e,i,n):t.label;let{style:S}=f;return S=l(S)?L({},lU.label.style,S(t,e,i,n)):S,S=L({textAlign:this.getTextAlign(b),textBaseline:this.getTextBaseline(b,p)},S),l(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},v),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new nU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${rU.grid}-sub`:`${rU.grid}`,n.id=this._getNodeId(t),e.add(n)}}const dU={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&&uU(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function uU(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function pU(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function fU(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ce(t,i),r=Ce(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Me(t),l=Me(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:ke(t.angle);let f=i?t.angle+At:ke(90-t.angle);const m=i?e.angle:ke(e.angle);let y=i?e.angle+At:ke(90-e.angle);f>Mt&&(f-=Mt),y>Mt&&(y-=Mt);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(we(s,i)+we(s,n))/2>we(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function mU(t,e){"bottom"!==t&&"top"!==t||function(t,e){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"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var yU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return oG([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:m}=l,y=yU(l,["position","space","textStyle","autoRotate","shape","background","state"]);let _=.5;"start"===c?_=0:"end"===c&&(_=1);const{verticalFactor:v=1}=this.attribute,b=-1*v,x=this.getTickCoord(_),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+C(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,T=this.getVerticalCoord(x,k,!1),E=this.getVerticalVector(k,!1);let P,R,{angle:B}=y;if(P="start"===c?"start":"end"===c?"end":"center",h(B)&&p){B=lG(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else P=this.getTextAlign(E),R=this.getTextBaseline(E,!1);const I=Object.assign(Object.assign(Object.assign({},T),y),{textStyle:Object.assign({textAlign:P,textBaseline:R},u),state:M(m)?null:{text:m.text,shape:m.shape,panel:m.background}});return I.angle=B,g&&g.visible&&(I.shape=Object.assign({visible:!0},g.style),g.space&&(I.space=g.space)),f&&f.visible&&(I.panel=Object.assign({visible:!0},f.style)),I}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=hG,endAngle:r=cG}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(M(t))return;const{verticalLimitSize:o,label:c,title:d,line:u,tick:p,orient:g}=this.attribute,f=null!==(s=c.space)&&void 0!==s?s:4;let m=o,y=0,_=0;const v=(null==u?void 0:u.visible)?null!==(r=u.style.lineWidth)&&void 0!==r?r:1:0,x=(null==p?void 0:p.visible)?null!==(a=p.length)&&void 0!==a?a:4:0;(null==d?void 0:d.visible)&&(y=fG(d.text,d.textStyle).height,_=d.space),m&&(m=(m-f-_-y-v-x)/n);const{layoutFunc:S,autoRotate:w,autoRotateAngle:A,autoLimit:k,limitEllipsis:C,autoHide:T,autoHideMethod:E,autoHideSeparation:P}=c;l(S)?S(t,e,i,this):(w&&function(t,e){if(M(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Gt(e)})),mU(i,t),!fU(t))break}}(t,{labelRotateAngle:A,orient:g}),k&&b(m)&&m>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!M(t)&&b(i)&&t.forEach((t=>{const e=0===t.attribute.angle||h(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:m,ellipsis:C,orient:g}),T&&function(t,e){if(M(t))return;const i=t.filter(gU);if(M(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=l(s)?s:dU[s]||dU.parity;if(n.length>=3&&pU(n,r)){do{n=a(n,r)}while(n.length>=3&&pU(n,r));n.length<3&&!V(i).attribute.opacity&&(n.length>1&&V(n).setAttribute("opacity",0),V(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:g,method:E,separation:P}))}}_U.defaultAttributes=lU;var vU,bU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=rB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=rU.line,c.id=this._getNodeId("line"),M(null==a?void 0:a.state)||(c.states=L({},oU,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=hG,endAngle:i=cG}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=hG,endAngle:i=cG,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return $t(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return oG(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:m,state:y}=u,_=bU(u,["space","textStyle","shape","background","state"]);let v=l,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=C(this.attribute.label,"style.fontSize",12)+C(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;h(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",v={x:l.x,y:l.y-S}):"end"===A&&(w="top",v={x:l.x,y:l.y+S});const k=Object.assign(Object.assign(Object.assign({},v),_),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:M(y)?null:{text:y.text,shape:y.shape,panel:y.background}}),{angle:T}=_;return k.angle=T,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}xU.defaultAttributes=lU;class SU extends lC{constructor(){super(...arguments),this.mode=TA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return QW(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},QW(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=b(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=_t.lastIndex=vt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=_t.exec(t))&&(n=vt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=vt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=vU.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=vU.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=vU.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===vU.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===vU.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=vU.endHandler):this.state.start=this.state.start+o:this._activeTag===vU.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===gj.env&&(gj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),gj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===vU.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ct(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ct(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=AU(t,["formatMethod"]),{formatMethod:s}=e,r=AU(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const m=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,y=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(m+y)/2,f={x:f.x+m/2,y:f.y}):(g-=(m+y)/2,f={x:f.x,y:f.y+m})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+P*I,y:B.y,width:(R-P)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+P*D,width:I,height:(R-P)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+P*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(P+R)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+P*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(P+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i}=this.attribute,{start:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new yG(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;c(t)&&c(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...N(a))}setUpdateStateCallback(t){l(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){l(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){l(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){l(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){l(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){l(t)&&(this._statePointToData=t)}};var MU,CU,TU;kU.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(MU||(MU={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(CU||(CU={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(TU||(TU={}));class EU extends ZW{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=aB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const PU={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:MU.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]}},RU={start:{textAlign:"right",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:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},BU={label:{position:CU.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}},IU={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"}},DU={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"}};let LU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},RU[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new sU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new yG(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};LU.defaultAttributes=PU;let OU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},IU[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=gB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new yG(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};OU.defaultAttributes=BU;let FU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=TU.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},DU[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=uB(Object.assign(Object.assign({},e),n)):"text"===i?o=new yG(Object.assign({},e)):"richText"===i?o=fB(Object.assign(Object.assign({},e),s)):"image"===i?o=pB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new sU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=oB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};FU.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const zU={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class HU extends ZW{getCurrent(){return this._current}constructor(t){super(L({},HU.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new UM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new UM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.hasState(WU.selected)?this._setLegendItemState(t,WU.selectedHover):this._setLegendItemState(t,WU.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(GU.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(GU.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=a.delegate;if(a.name===UU.focus){const e=t.hasState(WU.focus);t.toggleState(WU.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover,WU.focus]),this._setLegendItemState(t,WU.selected)})):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover,WU.focus]),this._setLegendItemState(e,WU.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(WU.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(WU.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(GU.legendItemClick,t);n?(this._removeLegendItemState(t,[WU.selected,WU.selectedHover]),this._setLegendItemState(t,WU.unSelected)):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]))}else this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}this._dispatchEvent(GU.legendItemClick,t)}}}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,WU.selected),this._removeLegendItemState(e,[WU.unSelected,WU.unSelectedHover])):(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||M(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=aB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=jU,spaceRow:f=NU,maxWidth:m,width:y,height:_}=t;c(m)?c(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:c(y)&&(this._itemWidthByUser=y),c(_)&&(this._itemHeightByUser=_);let v=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!M(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,c(l)&&(o>=l?(v=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,c(h)&&h0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;v&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:l=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:m={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),m=this._handleStyle(m,t,e,i,n);const y=Ge(l);let _;!1===m.visible?(_=aB({x:0,y:0,cursor:(null==m?void 0:m.style).cursor}),this._appendDataToShape(_,UU.item,t,_)):(_=aB(Object.assign({x:0,y:0},null==m?void 0:m.style)),this._appendDataToShape(_,UU.item,t,_,null==m?void 0:m.state)),_.addState(e?WU.selected:WU.unSelected);const v=aB({x:0,y:0,pickable:!1});_.add(v);let b=0;const x=C(p,"style.size",10),S=C(p,"space",8),w=uB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&h(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&h(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,UU.itemShape,t,_,null==p?void 0:p.state),w.addState(e?WU.selected:WU.unSelected),v.add(w);let k=0;if(d){const e=C(u,"size",10);A=uB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:y})),this._appendDataToShape(A,UU.focus,t,_),k=e}const M=dB(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,UU.itemLabel,t,_,null==g?void 0:g.state),M.addState(e?WU.selected:WU.unSelected),v.add(M);const T=C(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+T,c(a)){const n=C(f,"space",d?8:0),s=dB(Object.assign(Object.assign({x:b+T,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));this._appendDataToShape(s,UU.itemValue,t,_,null==f?void 0:f.state),s.addState(e?WU.selected:WU.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-M.AABBBounds.width()-T-k-n),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-y[1]-y[3]-k-n})),b=s.AABBBounds.x2+n,v.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-k);A&&(A.setAttribute("x",b),v.add(A));const E=v.AABBBounds,P=E.width(),R=E.height(),B=this._itemWidthByUser||P+y[1]+y[3],I=this._itemHeightByUser||R+y[0]+y[2];return _.attribute.width=B,_.attribute.height=I,v.translateTo(-E.x1+y[3],-E.y1+y[0]),_}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=jU,spaceRow:h=NU}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=VU}=o,f=XU(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new HU(Object.assign({layout:1===r?"horizontal":"vertical",total:99},L({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new HU(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=aB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(WU.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=L({},$U,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new UM(t,{item:e,data:e.data,selected:e.hasState(WU.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=L({},t);return t.style&&l(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&l(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var qU;function ZU(t){return m(t)?t:[t,t]}function JU(t){return t?"ew-resize":"ns-resize"}KU.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:jU,spaceRow:NU,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:VU,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"}(qU||(qU={}));let QU=class t extends ZW{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(L({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onHandlerPointerMove),gj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ct(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===gj.env)gj.removeEventListener("pointermove",this._onHandlerPointerMove),gj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onTrackPointerMove),gj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ct(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ct(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onTrackPointerMove),gj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,d;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,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(c(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=N(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;h(u)&&(u=[o,l]),this._currentValue={startValue:ZU(u)[0],endValue:ZU(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=aB({x:0,y:0});g.name=qU.innerView,this.add(g),this._innerView=g;let f,m=0;if(r&&r.visible){f=dB(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=qU.startText,g.add(f);const e=c(r.space)?r.space:0;m+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const y=aB({x:p?m:0,y:p?0:m});g.add(y);const _=aB({x:0,y:0});let v;if(_.name=qU.railContainer,this._railContainer=_,y.add(_),this._renderRail(_),m+=p?n:s,a&&a.visible){const t=c(a.space)?a.space:0;v=dB(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),v.name=qU.endText,g.add(v)}this._renderTrack(_),d&&(this._renderHandlers(y),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=hB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=qU.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:c}=this.attribute;let{value:d}=this.attribute;h(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?l:o,[f,m]=ZU(d),y=(f-i)/(n-i)*g,_=this._renderHandler(Object.assign({x:p?y:l/2,y:p?o/2:y,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(_.name=qU.startHandler,this._startHandler=_,t.add(_),this._currentValue.startPos=y,u){const e=this._renderHandlerText(f);e.name=qU.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(m-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(a.name=qU.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(m);e.name=qU.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:c}=this.attribute;h(c)&&(c=[i,n]);const u=this._isHorizontal,p=u?r:s;let[g,f]=ZU(c);e||(g=i);const m=aB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=qU.trackContainer;const y=d(e)&&!0===e.draggableTrack;let _;_=!1===l?"default":!1===e||!1===y?"pointer":JU(u);const v=(f-g)/(n-i)*p,b=hB(Object.assign({x:u?(g-i)/(n-i)*p:0,y:u?0:(g-i)/(n-i)*p,width:u?v:r,height:u?s:v,cursor:_},a));b.name=qU.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return uB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":JU(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),dB(f)}_bindEvents(){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),d(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===qU.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===qU.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===qU.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===qU.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new UM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};QU.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},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}}};class tY extends YU{constructor(t){super(L({},tY.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,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:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function eY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}tY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class iY extends YU{constructor(t){super(L({},iY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,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:y,sizeBackground:_}=this.attribute,v=aB({x:0,y:0});this._innerView.add(v);const b=new QU({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:eY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=lB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}iY.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)"}};let nY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,P,R,B,I,D,L,O,F,z,H,j,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:mt,minHeight:yt,maxHeight:_t,align:vt,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ge(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&c(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else c(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(h=null==ct?void 0:ct.maxLineWidth)&&void 0!==h?h:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&c(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(m=ut.y)&&void 0!==m?m:At,width:null!==(_=null!==(y=ut.width)&&void 0!==y?y:pt)&&void 0!==_?_:0,height:null!==(b=null!==(v=ut.height)&&void 0!==v?v:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else c(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(c(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),c(gt)&&(Et=gt),c(ft)&&Ttmt&&(Tt=mt)),c(yt)&&Et_t&&(Et=_t)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],c(vt)||c(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:vt,e=null!==(O=null==ct?void 0:ct.width)&&void 0!==O?O:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","left")):"center"===t?(null===(H=this._mainTitle)||void 0===H||H.setAttribute("x",e/2),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(c(vt)||c(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:vt,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};nY.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 sY={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"}}};let rY=class extends ZW{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(c(i))if(!1!==i.visible){const t=L({},C(sY,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:c(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&b(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&b(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(c(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=N(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=L({},C(sY,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:c(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&b(a)&&this._setAutoFit(a,d,e),e.autoLimit&&b(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;h+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=fG(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",c(i.style.lineHeight)?i.style.lineHeight:s)}}};class aY extends UP{constructor(t){super(t)}}var oY,lY;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oY||(oY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lY||(lY={}));class hY extends ZW{constructor(t){super(L({},hY.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style: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"},hY.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style: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"},hY.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{h(this._playController)&&(this._playController=new aY(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{h(this._backwardController)&&(this._backwardController=new aY(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{h(this._forwardController)&&(this._forwardController=new aY(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new UM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(oY.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(oY.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(oY.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(oY.OnBackward);this.dispatchEvent(t)},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()}}hY.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hY.defaultAttributes={visible:!0,[lY.Start]:{},[lY.Pause]:{},[lY.Backward]:{},[lY.Forward]:{}};const cY={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dY=[200,10];var uY,pY;!function(t){t.Default="default",t.Reverse="reverse"}(uY||(uY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(pY||(pY={}));const gY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},fY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},mY=t=>"top"===t||"bottom"===t;class yY extends ZW{constructor(t){super(L({},yY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;b(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Pt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:b(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(mY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:dY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:dY[1];s.layout="vertical",s.railWidth=e,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 QU(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return mY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},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 hY(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=mY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=v(i)?i:Pt(i[0],i[1]);return t+e.space+n}),0),l=(mY(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,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new UM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}yY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},cY),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cY),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cY),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cY),{key:"backward",position:"start"})}};class _Y extends yY{constructor(t){super(L({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:uY.Default,this._dataIndex=h(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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(pY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=gj.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(pY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(pY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=gj.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(),gj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var vY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class bY extends yY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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,n=i/this._maxIndex;this._elapsed=n*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(pY.OnChange))},this.play=()=>vY(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(pY.OnPlay),this._rafId=gj.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=gj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},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(pY.OnBackward)},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(pY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const xY={debounce:gt,throttle:ft};let SY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",xY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=gB(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return L(t,...i,{shape:s.every(h)?void 0:L({},...s),key:r.every(h)?void 0:L({},...r),value:a.every(h)?void 0:L({},...a)})},AY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},kY={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:dG,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Wt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},MY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let CY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=Ge(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",L({symbolType:"circle"},d.shape,{visible:tG(d)&&tG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:tG(d)&&tG(d.value)},AY(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:tG(d)&&tG(d.value)},d.value),"text");const u=tG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-h[3]-h[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const m=tG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+m);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!tG(l))return;const h=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let u=0;if(tG(l.shape)&&d.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),tG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},AY(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(tG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},AY(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";c(l.value.textAlign)?e=l.value.textAlign:tG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>MY.includes(t)))?(this._mergeAttributes(e,n),h(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&tG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=tG(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=gG(u),v=gG(p);let b=0;if(tG(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(tG(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&WP[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return wY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};CY.defaultAttributes=kY;const TY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class EY extends KW{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=f(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}LV(nV.lineAxis,((t,e)=>new _U(t,e))),LV(nV.circleAxis,(t=>new xU(t)));class PY extends EY{constructor(t,e,i){super(t,eV.axis,e),this.spec.componentType=eV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=L({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=DV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=mV(s,e,i,n);const c=FN(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=FN(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=FN(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case nV.lineAxis:return((t,e,i)=>{var n,s;const r=TY.axis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p);case nV.circleAxis:return((t,e,i)=>{var n,s;const r=TY.circleAxis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(h(e)){const i=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?nV.circleAxis:nV.lineAxis,this._axisComponentType}}LV(sV.discreteLegend,(t=>new KU(t))),LV(sV.colorLegend,(t=>new tY(t))),LV(sV.sizeLegend,(t=>new iY(t)));class RY extends EY{constructor(t,e){super(t,eV.legend,e),this.spec.componentType=eV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==sV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":GU.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=f(t)?this.view.getDataById(t):t,l=f(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,iV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=DV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=mV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case sV.discreteLegend:return((t,e)=>{const i=TY.discreteLegend;return t?L({},i,{items:Array.from(new Set(N(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=NN(n),r=s?Object.assign(Object.assign({},TY.discreteLegend.items[0].shape),{fill:s,stroke:s}):TY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):L({},i,null!=e?e:{})})(o,a);case sV.colorLegend:return((t,e)=>{const i=TY.colorLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{colors:t.range().slice(),min:n[0],max:V(n)},null!=e?e:{})})(o,a);case sV.sizeLegend:return((t,e)=>{const i=TY.sizeLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&zl(i)){const t=e.getScale().range();NN(null==t?void 0:t[0])?this._legendComponentType=sV.colorLegend:this._legendComponentType=sV.sizeLegend}else this._legendComponentType=sV.discreteLegend}return this._legendComponentType}}LV(rV.lineCrosshair,(t=>new EG(t))),LV(rV.rectCrosshair,(t=>new PG(t))),LV(rV.sectorCrosshair,(t=>new BG(t))),LV(rV.circleCrosshair,(t=>new RG(t))),LV(rV.polygonCrosshair,(t=>new IG(t)));const BY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(jl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Yt(Kt(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else zl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Kt(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class IY extends EY{constructor(t,e){super(t,eV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case rV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return L({},l,BY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case rV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=BY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=L({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case rV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(jl(e.type)){const i=Yt(Kt(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else zl(e.type)&&(f=Kt(u,t));return L({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=TY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(jl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else zl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return L({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(jl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else zl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return L({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=DV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?rV.sectorCrosshair:rV.rectCrosshair:"radius"===n?rV.circleCrosshair:"radius-polygon"===n?rV.polygonCrosshair:rV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}LV(eV.slider,(t=>new QU(t)));class DY extends KW{constructor(t,e){super(t,eV.slider,e),this.spec.componentType=eV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=f(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=f(t)?this.view.getDataById(t):t,a=f(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,iV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>L({},TY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(h(this.spec.min)?0:FN(this.spec.min,i,t,e),h(this.spec.max)?1:FN(this.spec.max,i,t,e),mV(n,t,e,i))}),e}),{});this._encoders=e}}LV(eV.label,(t=>new QG(t)));let LY=class extends KW{constructor(t,e){super(t,eV.label,e),this.spec.componentType=eV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=FN(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=TY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case tV.line:r=TY.lineLabel;break;case tV.rect:r=TY.rectLabel;break;case tV.symbol:r=TY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[vV],n=mV(i,e.getDatum(),e,s),o=L({},r.data[0],n);a.push(o)}}));const o=FN(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return L({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!h(t)));return L({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};LV(eV.datazoom,(t=>new kU(t)));class OY extends KW{constructor(t,e){super(t,eV.datazoom,e),this.spec.componentType=eV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!h(this.spec.preview)){const t=this.spec.preview.data,e=f(t)?this.view.getDataById(t):t;this.detach(e),this.detach(GN(this.spec.preview.x,this.view)),this.detach(GN(this.spec.preview.y,this.view)),this.detach(GN(this.spec.preview.x1,this.view)),this.detach(GN(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=f(t)?this.view.getDataById(t):t;this.attach(r),this.attach(GN(e,this.view)),this.attach(GN(i,this.view)),this.attach(GN(n,this.view)),this.attach(GN(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t,c=f(e)?(t,i)=>{if(h(i.start)||h(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,iV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},TY.datazoom,t),n=DV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=f(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=mV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=TY.datazoom;return t?L({},l,{previewData:t,previewXCallback:e?t=>mV({x:e},t,r,a).x:null,previewYCallback:i?t=>mV({y:i},t,r,a).y:null,previewX1Callback:n?t=>mV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>mV({y1:s},t,r,a).y1:null},null!=o?o:{}):L({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=f(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}LV(oV.continuousPlayer,(t=>new bY(t))),LV(oV.discretePlayer,(t=>new _Y(t)));let FY=class extends KW{constructor(t,e){super(t,eV.player,e),this.spec.componentType=eV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=m(t)?null:f(t)?this.view.getDataById(t):t;this.detach(e)}const r=m(e)?null:f(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=f(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(pY.OnChange,this._filterCallback),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t;return this._filterData(o,l,iV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(pY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=L({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:DV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=mV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=m(o)?null:f(o)?this.view.getDataById(o):o,h=m(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>L({},TY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>L({},TY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};LV(eV.tooltip,(t=>new CY(t)));let zY=class extends KW{constructor(t,e){super(t,eV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ft(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Wt).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>L({},TY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!h(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return N(t).reduce(((t,e)=>(t=t.concat(LN(e.visible,this.view)),WN(e.key)||(t=t.concat(LN(e.key,this.view))),WN(e.value)||(t=t.concat(LN(e.value,this.view))),WN(e.symbol)||(t=t.concat(LN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=FN(t.visible,n,e,i);return o=!!h(o)||!!o,s=WN(t.key)?ll(t.key.field)(e):FN(t.key,n,e,i),s=h(s)?void 0:u(s)?s:{text:s},r=WN(t.value)?ll(t.value.field)(e):FN(t.value,n,e,i),r=h(r)?void 0:u(r)?r:{text:r},a=WN(t.symbol)?ll(t.symbol.field)(e):FN(t.symbol,n,e,i),a=h(a)?void 0:u(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?N(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var HY=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 jY extends CW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],h(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=LN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];N(t.source).forEach((t=>{const i=HN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return HY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return h(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return h(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=N(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=PW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(N(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=N(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function NY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function VY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,NY(t,e,s,n)}class WY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}return this.nodes.push(t),NY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,VY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class GY{constructor(t){this.list=[],this.ids={},this.idFunc=t||hl}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var UY=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 YY{constructor(){this.grammars=[],this.logger=We.getInstance(),this._curRank=0,this._committed=new GY((t=>t.uid)),this._heap=new WY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return UY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>h(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new GY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return UY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const XY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===tV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class $Y{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(hV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return RT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gk.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(hV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Cj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(hV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(hV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(hV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new JM(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=d(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new eC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class KY extends CW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?FN(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(m(t)&&m(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function rX(t,e,i){FN(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=FN(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),h(null==n?void 0:n.clamp)||(l(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function aX(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i),rX(t,e,i)}function oX(t,e,i){t.round&&e.round(FN(t.round,i,e),!0),t.padding&&e.padding(FN(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(FN(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(FN(t.paddingOuter,i,e),!0),t.align&&e.align(FN(t.align,i,e),!0)}function lX(t,e,i,n){const s=t.field,r=zN(t.data,i),a=f(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),zl(e.type)?(n&&a.filter((t=>v(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function hX(t,e,i){if(ZY(t.domain)?e.domain(lX(t.domain,e,i,!0),!0):e.domain(FN(t.domain,i,e),!0),ZY(t.range))e.range(lX(t.range,e,i),!0);else if(JY(t.range)){const n=zN(t.range.coordinate,i);!function(t){switch(t){case Fl.Quantile:case Fl.Quantize:case Fl.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(FN(t.range,i,e),!0);switch(t.type){case"linear":aX(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){oX(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){aX(t,e,i);const n=FN(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i);const n=FN(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){aX(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){aX(t,e,i);const n=FN(t.constant,i,e);b(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class cX extends CW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=qY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=qY(this.spec.type)),hX(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return h(this.spec.domain)||this.detach(tX(this.spec.domain,this.view)),this.spec.domain=t,this.attach(tX(t,this.view)),this.commit(),this}range(t){return h(this.spec.range)||this.detach(tX(this.spec.range,this.view)),this.spec.range=t,this.attach(tX(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!h(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!h(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return h(e)?null:this.parameters()[e]}configure(t){return this.detach(eX(this.spec.type,t,this.view)),h(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(eX(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let dX=-1;const uX=[HW,jW,WW,NW,VW,GW,UW],pX=t=>{var e,i,n,s;return v(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},gX=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:RV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:TV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:CV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:PV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},fX=(t,e)=>(null==e?void 0:e.debounce)?gt(t,e.debounce):(null==e?void 0:e.throttle)?ft(t,e.throttle):t,mX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:OW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):zV[t]?(i.markType=t,i.source=e):i.source=t===LW?LW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},yX={},_X=()=>yX;let vX=class extends $W{constructor(t,e){super(t,tV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return dV.rect}evaluateJoin(t){return super.evaluateJoin(wV)}};function bX(t,e){if(b(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return b(t)?t*e:0}return 0}function xX(t,e){return Math.min(t<0?t+e:t-1,e)}function SX(t,e,i){let n=xX(t,i),s=xX(e,i);if(b(t)||b(e)?b(t)?b(e)||(n=xX(Math.max(0,s-1),i)):s=xX(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const wX=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>bX(t,i))),u=l.map((t=>bX(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=SX(e,i,r),{start:h,end:c}=SX(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},AX=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=ml(r.maxChildWidth,s.width()),o=ml(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=pX(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==tV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(l(r))r.call(null,t,s,a,e);else if(l(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=AX(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(NW,o),i.updateSignal(VW,l),i.updateSignal(WW,h)}else AX(t,s,a,e);else"grid"===r.display&&wX(t,s,a);kX(s,e,i)}))};class MX extends $W{constructor(t,e,i){super(t,tV.glyph,i),this.glyphType=e,this.glyphMeta=XN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=jV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let CX=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return h(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return h(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return m(t)?(i.x=t[0],i.y=t[1]):v(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new qt,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class TX extends CX{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=h(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=h(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=m(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class EX extends CX{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Yt(s);const r=rt(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function PX(t){switch(t){case"cartesian":default:return new TX;case"polar":return new EX}}class RX extends CW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=PX(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=PX(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,c;!h(t.start)&&e.start(null!==(n=FN(t.start,i))&&void 0!==n?n:[0,0]),!h(t.end)&&e.end(null!==(s=FN(t.end,i))&&void 0!==s?s:[0,0]),!h(t.origin)&&e.origin(null!==(r=FN(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!h(t.translate)){const e=FN(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!h(t.rotate)){const e=FN(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!h(t.scale)){const e=FN(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}h(t.transpose)||FN(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const BX=Symbol.for("key");class IX{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i[0]}):h(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=hW(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=hW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!h(e.morphElementKey)){const i=jN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i}):h(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:BX})),r=hW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:BX}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==BX){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=FN(i.animation.delay,s,o,l),d=FN(i.animation.duration,s,o,l),u=FN(i.animation.oneByOne,s,o,l),p=FN(i.animation.splitPath,s,o,l),g=b(u)&&u>0?t=>v(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(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);yT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>pT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>fT(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:MA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new mT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:fC,null!==(l=i.easing)&&void 0!==l?l:mC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:MA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new _T({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:fC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:mC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):yT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class DX{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=f(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),h(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),h(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),h(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),h(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class LX{constructor(t){this.view=t}stop(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.stop()})),this}pause(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.pause()})),this}resume(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.resume()})),this}enable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.enable()})),this}disable(){return this.view.traverseMarkTree((t=>{var e;null===(e=t.animate)||void 0===e||e.disable()})),this}enableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.enableAnimationState(t)})),this}disableAnimationState(t){return this.view.traverseMarkTree((e=>{var i;null===(i=e.animate)||void 0===i||i.disableAnimationState(t)})),this}animate(){return this.view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){}}class OX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=mV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===Fl.Band){if(!h(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===Fl.Band){if(!h(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:dV.rect}addGraphicItem(t,e){const i=HV(this,this.coord&&"polar"===this.coord.output().type?tV.arc:tV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class FX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=mV(e,t,i,s);if(h(r.size)){const t=n.x?yV(n.x):void 0,e=n.y?yV(n.y):void 0;h(t)&&h(e)?r.size=10:h(t)?r.size=e:h(e)&&(r.size=t),r.size=[t,e]}return h(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(v(i.padding)&&i.padding>0)t.size=m(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(m(i.padding)&&2===i.padding.length){const e=m(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(dV.symbol)}release(){super.release(),this._encoders=null}}var zX=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 HX extends r{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV],s=YW(0,t,n,e,OW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){f(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new KY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new jY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new cX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new RX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=f(e)?this.getMarkById(e):e;let s;switch(t){case tV.group:s=new vX(this,n);break;case tV.glyph:s=new MX(this,null==i?void 0:i.glyphType,n);break;case tV.component:s=((t,e,i,n)=>{switch(e){case eV.axis:return new PY(t,i,n);case eV.legend:return new RY(t,i);case eV.crosshair:return new IY(t,i);case eV.slider:return new DY(t,i);case eV.label:return new LY(t,i);case eV.datazoom:return new OY(t,i);case eV.player:return new FY(t,i);case eV.tooltip:return new zY(t,i)}return new KW(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case tV.interval:s=new OX(this,t,n);break;case tV.cell:s=new FX(this,t,n);break;default:s=new $W(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(tV.group,t)}glyph(t,e){return this.mark(tV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(tV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(tV.component,t,{componentType:eV.axis,mode:e})}legend(t){return this.mark(tV.component,t,{componentType:eV.legend})}crosshair(t){return this.mark(tV.component,t,{componentType:eV.crosshair})}slider(t){return this.mark(tV.component,t,{componentType:eV.slider})}label(t){return this.mark(tV.component,t,{componentType:eV.label})}datazoom(t){return this.mark(tV.component,t,{componentType:eV.datazoom})}player(t){return this.mark(tV.component,t,{componentType:eV.player})}tooltip(t){return this.mark(tV.component,t,{componentType:eV.tooltip})}customized(t,e){const i=(t=>yX[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=f(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&uX.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(hV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++dX;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(HW,t.width),this.updateSignal(jW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=_X();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(hV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=lV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:HW,value:null!==(i=t[HW])&&void 0!==i?i:0},{id:jW,value:null!==(n=t[jW])&&void 0!==n?n:0},{id:WW,value:pX(null!==(s=t[WW])&&void 0!==s?s:e[WW])},{id:NW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[HW]-i.left-i.right},dependency:[HW,WW]}},{id:VW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[jW]-i.top-i.bottom},dependency:[jW,WW]}},{id:GW,update:{callback:(t,e)=>{const i=pX(e[WW]);return(t||new Vt).setValue(i.left,i.top,i.left+e[NW],i.top+e[VW])},dependency:[NW,VW,WW]}},{id:UW,value:null!==(r=t[UW])&&void 0!==r?r:e[UW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===tV.glyph?{glyphType:t.glyphType}:t.type===tV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(HW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(NW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(VW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(WW);if(arguments.length){const i=pX(t);return this.updateSignal(e,i),i}return pX(e.output())}autoFit(t){const e=this.getSignalById(UW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(GW);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=lV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===tV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||kX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(hV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(hV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(hV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{XY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(hV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(hV.BEFORE_MARK_RENDER_END),XY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(hV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return zX(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return zX(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(hV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(hV.AFTER_DO_RENDER)}evaluate(t){var e,i;return zX(this,void 0,void 0,(function*(){const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!uX.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return XY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=en(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return zX(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(HW,t)),e!==this.height()&&(n=!0,this.updateSignal(jW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,c=mX(e);if(!c)return;const{source:u,type:p}=c,g=h((v=c).markId)?t=>t&&t.mark.id()===v.markId:h(v.markName)?t=>t&&t.mark.name()===v.markName:h(v.type)?t=>t&&t.mark.markType===v.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:f(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),y=DN(l,this),_=fX(((t,e)=>{const n=u===OW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===LW&&(t=YW(0,t,e,p,LW));let s=!1;if((!i||i(t))&&(!g||g(e))&&m.length){const e=y.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var v;if(u===OW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||d(n)&&!n[i])}(this._eventConfig,OW,p))return this.addEventListener(p,_,FW),()=>{this.removeEventListener(p,_)}}else if(u===LW)return gj.addEventListener(p,_),this._eventListeners.push({type:p,source:gj,handler:_}),()=>{gj.removeEventListener(p,_);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===gj&&t.handler===_));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);f(e)?i.type=e:d(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:zW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?f(r)?r:r.user:zW,o=r&&a===r.user&&(s===r.element||h(s)&&h(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==zW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!h(document)&&document.body:this.container;return e?h(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new $Y(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new DX((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new DX((t=>t.id())),this._options.logger&&We.setInstance(this._options.logger),this.logger=We.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new YY,this.animate=new LX(this),this._morph=new IX,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{m(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[OW,LW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&gj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=lV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==tV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=gj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&gj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),EN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const jX=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{TN(e,t[e],!0)}))}))};jX(_V);const NX=["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 VX,WX,GX;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(VX||(VX={})),function(t){t.chart="chart",t.window="window"}(WX||(WX={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(GX||(GX={}));const UX=`${Kj}_waterfall_default_seriesField`,YX=`${Kj}_DEFAULT_DATA_INDEX`,XX=`${Kj}_DEFAULT_DATA_KEY`,$X=`${Kj}_DEFAULT_DATA_SERIES_FIELD`,KX=`${Kj}_DEFAULT_SERIES_STYLE_NAME`;var qX;!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.Built_In=99]="Built_In"}(qX||(qX={}));const ZX=`${Kj}_STACK_START`,JX=`${Kj}_STACK_END`,QX=`${Kj}_STACK_START_PERCENT`,t$=`${Kj}_STACK_END_PERCENT`,e$=`${Kj}_STACK_START_OffsetSilhouette`,i$=`${Kj}_STACK_END_OffsetSilhouette`,n$=`${Kj}_SEGMENT_START`,s$=`${Kj}_SEGMENT_END`;var r$,a$;!function(t){t[t.Axis_Grid=100]="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"}(r$||(r$={})),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"}(a$||(a$={}));const o$=["linear","radial","conical"],l$={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}},h$={innerRadius:0,outerRadius:1,startAngle:wN,endAngle:AN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var c$,d$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(c$||(c$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(d$||(d$={}));const u$={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,tickSize:Ij,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Ij/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Rj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Rj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},p$={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},g$={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},f$={name:"light",padding:12,fontFamily:Pj,colorScheme:{default:{dataScheme:[{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"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Yj,line:Nj,area:Dj,bar:Lj,bar3d:Oj,pie:Wj,pie3d:Gj,map:Vj,radar:Uj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:Fj,funnel3d:zj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:Xj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:jj,treemap:$j,sunburst:h$,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Rj},minLabel:{position:d$.end},maxLabel:{position:d$.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Rj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...g$,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...g$,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...g$},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...g$}},axis:u$,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10},maxHeight:"30%"},axisY:{label:{space:20},title:{space:20,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Rj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Rj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!0,background:{size:6,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:4,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:p$,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Bj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Rj,lineHeight:Bj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:12,fontWeight:"bold",fill:"#4E5969"},contentStyle:{fontSize:12,fill:"#4E5969"},panel:{visible:!0,fill:"#fff",stroke:"#ffffff",lineWidth:0,cornerRadius:3,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:"rgba(0, 0, 0, 0.1)",size:0,space:12}}}},m$=new Map([[f$.name,f$]]),y$=f$.name;class _${static instances=new Map;static registerInstance(t){_$.instances.set(t.id,t)}static unregisterInstance(t){_$.instances.delete(t.id)}static getInstance(t){return _$.instances.get(t)}static instanceExist(t){return _$.instances.has(t)}static forEach(t,e=[],i){const n=N(e);return _$.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class v${static themes=new Map;static _currentThemeName=y$;static registerTheme(t,e){t&&v$.themes.set(t,L({},v$.getDefaultTheme(),e))}static getTheme(t){return v$.themes.get(t)||v$.getDefaultTheme()}static removeTheme(t){return v$.themes.delete(t)}static themeExist(t){return v$.themes.has(t)}static getDefaultTheme(){return v$.themes.get(y$)}static setCurrentTheme(t){v$.themeExist(t)&&(v$._currentThemeName=t,_$.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return v$.getTheme(v$._currentThemeName)}static getCurrentThemeName(){return v$._currentThemeName}}v$.registerTheme(y$,m$.get(y$)),m$.forEach(((t,e)=>{e!==y$&&v$.registerTheme(e,t)}));const b$=(t,e,i)=>new He({defaultFontParams:{fontFamily:Ej,fontSize:14},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),x$=fB({});function S$(t,e){for(let i=0;it.key===e))}function A$(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const k$=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sP$(t.style(e,i,n,s)):M(t.style)||(e.style=P$(t.style)),!M(t.state)){const i={};Object.keys(t.state).forEach((e=>{l(t.state[e])?i[e]=(i,n,s,r)=>P$(t.state[e](i,n,s,r)):M(t.state[e])||(i[e]=P$(t.state[e]))})),e.state=i}return e}function T$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e,n,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function E$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e.rawValue,n,e,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function P$(t){return M(t)||t.angle&&(t.angle=Gt(t.angle)),t}var R$;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.image="image",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(R$||(R$={}));class B${static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Qa,fields:io,filter:pn,fold:eo};static dataParser={csv:fo,dsv:go,tsv:mo};static _layout={};static registerChart(t,e){B$._charts[t]=e}static registerSeries(t,e){B$._series[t]=e}static registerComponent(t,e){B$._components[t]=e}static registerMark(t,e){B$._marks[t]=e}static registerRegion(t,e){B$._regions[t]=e}static registerTransform(t,e){B$.transforms[t]=e}static registerLayout(t,e){B$._layout[t]=e}static createChart(t,e,i){if(!B$._charts[t])return null;return new(0,B$._charts[t])(e,i)}static createRegion(t,e,i){if(!B$._regions[t])return null;return new(0,B$._regions[t])(e,i)}static createSeries(t,e,i){if(!B$._series[t])return null;return new(0,B$._series[t])(e,i)}static createMark(t,e,i){if(!B$._marks[t])return null;const n=new(0,B$._marks[t])(e,i);return n.type===R$.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(B$._components)}static getComponentInKey(t){return B$._components[t]}static getLayout(t){return B$._layout[t]}static getSeries(t){return B$._series[t]}}const I$=(t,e,i)=>{const n=t.getRegionsInIds(N(e.layoutBindRegionID));return 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})}))},D$=(t,e)=>t===e||!h(t)&&!h(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),L$=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},O$="monotone",F$="linearClosed";var z$;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(z$||(z$={}));var H$;function j$(t){return"bottom"===t||"top"===t}function N$(t){return"left"===t||"right"===t}function V$(t){return"z"===t}function W$(t,e){return Uh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(H$||(H$={}));const G$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&I$(t,n,i)));return n.length?n:null},U$=t=>t.fieldX[0],Y$=t=>t.fieldY[0],X$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=$$(t,n,"x",U$);e&&o.push(e)})),a&&a.forEach((t=>{const e=$$(t,s,"y",Y$);e&&o.push(e)})),o.length?o:null},$$=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return K$(t,a,n)},K$=(t,e,i)=>{const n=t.getScale();if(!n||!jl(n.type))return null;if(h(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=L$(e,t,"cartesian",i??(j$(t.orient)?U$:Y$));return{index:s,value:e,axis:t,data:r}},q$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&I$(t,n,i)));return n.length?n:null},Z$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&jl(e.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=Il({x:1,y:0},d);u=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(u,r);const p=Dl(d),g=a[0]?.getScale(),f=g?.range();if((u-r?.[0])*(u-r?.[1])>0||(p-f?.[0])*(p-f?.[1])>0)return;const m=Math.abs(r[0]-r[1])/i.length/2,y=e.invert(u+m);if(h(y))return;let _=e.domain().findIndex((t=>t?.toString()===y.toString()));_<0&&(_=void 0);const v=L$(y,t,"polar",l);o.push({index:_,value:y,axis:t,data:v})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&jl(e.type)){const a=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let d=Il({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const u=Dl(c),p=r[0]?.getScale(),g=p?.range();if((d-g?.[0])*(d-g?.[1])>0||(u-i?.[0])*(u-i?.[1])>0)return;const f=e.invert(u);if(h(f))return;let m=e.domain().findIndex((t=>t?.toString()===f.toString()));m<0&&(m=void 0);const y=L$(f,t,"polar",l);o.push({index:m,value:f,axis:t,data:y})}})),o.length?o:null};class J${_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=X$(this._chart,{x:t,y:e})??[],n=Z$(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!jl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=K$(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var Q$;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Q$||(Q$={}));const tK={[Q$.dimensionHover]:class extends J${_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:WX.chart},callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:WX.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!D$(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[Q$.dimensionClick]:class extends J${constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:WX.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let eK=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(tK[t]){const e=new tK[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(tK[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class iK{_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(GX.vchart,[]),this._levelNodes.set(GX.chart,[]),this._levelNodes.set(GX.model,[]),this._levelNodes.set(GX.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),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=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const nK={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 sK{globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||WX.chart),n=this.getEventListeners(e.filter?.source||WX.chart);i.get(t)||i.set(t,new iK);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||WX.chart),s=this.getEventListeners(e?.filter?.source||WX.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||WX.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||WX.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(GX.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(GX.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(WX.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(WX.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if(l(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&C(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return nK[n]&&(n=nK[n]),(!t.type||n===t.type)&&(!c(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=c(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=c(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&c(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();c(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:C(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:c(t.id)?GX.model:GX.vchart:GX.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ft(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=gt(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=WX.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==GX.model&&i!==GX.mark||(n=e.type),e?.source&&(s=e.source),c(e?.id)&&(o=e?.id,i=GX.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case WX.chart:return this._viewBubbles;case WX.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case WX.chart:return this._viewListeners;case WX.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return NX.includes(t)||Object.values(hV).includes(t)||Object.values(VX).includes(t)}}function rK(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function aK(t,e,i){t.getParser(e)||t.registerParser(e,i)}const oK=new Map;let lK;function hK(t,e,i={type:"geojson",centroid:!0}){oK.has(t)&&Yo(`map type of '${t}' already exists, will be overwritten.`),lK||(lK=new jo,aK(lK,"geojson",Do),aK(lK,"topojson",Oo),rK(lK,"simplify",Qa));const n=new Vo(lK),s=L({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),oK.set(t,n)}function cK(t,e=!1){let i=e;return t.latestData instanceof Vo&&(i=!1),i?R(t.latestData):t.latestData.slice()}const dK=(t,e)=>0===t.length?[]:1===t.length?cK(t[0],e?.deep):t.map((t=>cK(t,e?.deep)));function uK(t,e,i){rK(e=e instanceof jo?e:t.dataSet,"copyDataView",dK);const n=new Vo(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function pK(t,e,i=[]){if(t instanceof Vo)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new Vo(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!f(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Xo("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const gK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)}}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!f(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&gj.getCancelAnimationFrame()(this._rafId),this._rafId=gj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const n=function(n,s){const r=s?.mark?.context??{},a=c(r.modelId)?r.modelId:null,o=c(r.markId)?r.markId:null,l=c(r.modelUserId)?r.modelUserId:null,h=c(r.markUserId)?r.markUserId:null,d={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,d)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===WX.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();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===WX.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(h(e))return;const i=e.id(),n=t.grammarType;h(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(h(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];c(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return c(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return Zo(this._option.mode)?globalThis:this.getStage()?.window}}async function SK(t){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){console.error("getCanvasDataURL",t)}return t.toDataURL()}class wK{id=el();static useChart(t){t.forEach((t=>B$.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>B$.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>B$.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>B$.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>B$.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){B$.registerTransform(t,e)}static registerMap(t,e,i){hK(t,e,i)}static unregisterMap(t){!function(t){oK.has(t)?oK.delete(t):Yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,oK.get(e);var e}static hideTooltip(t=[]){_$.forEach((t=>t?.hideTooltip?.()),t)}static InstanceManager=_$;static ThemeManager=v$;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=L(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,poptip:a,...o}=this._option;i&&(this._container=f(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=v$.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new xK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,pluginList:!1!==a?["poptipForText"]:[],...o,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new sK(this,this._compiler),this._event=new eK(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!Zo(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(VX.initialized,{}),_$.registerInstance(this)):Xo("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=Jh(f(t)?JSON.parse(t):t))}_initData(){if(h(this._dataSet))return void Yo("dataSet is not initialized");const t=N(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Xo("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=gt(((...t)=>{const{width:e,height:i}=en(this._container,qj,Zj),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof jo?t:new jo,aK(this._dataSet,"dataview",Fo),aK(this._dataSet,"array",cn),rK(this._dataSet,"stackSplit",gK),rK(this._dataSet,"copyDataView",dK);for(const t in B$.transforms)rK(this._dataSet,t,B$.transforms[t]);for(const t in B$.dataParser)aK(this._dataSet,t,B$.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return c(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),oK.clear(),lK=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,_$.unregisterInstance(this)}async updateData(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):m(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(f(t)&&(t=JSON.parse(t)),e&&(t=L({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=Jh(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}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)}_updateCurrentTheme(){var t;f(this._spec?.theme)?(this._currentTheme=L({},v$.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=L({},v$.getTheme(this._currentThemeName),this._spec?.theme??{}),t=L({},this._currentTheme.component?.poptip),L(xG.poptip,bG,t)}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return v$.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===un.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(c(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await SK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!Zo(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await 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):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(c(this._container))return this._container;let t;return t=f(this._canvas)?document?.getElementById(this._canvas):this._canvas,c(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(M(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),Zh(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||h(t)||M(e))return null;if(!m(t)){const{axisId:n,axisIndex:s}=e;let r;if(c(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):c(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Yo("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?Zh(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!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"}(yK||(yK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(_K||(_K={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(vK||(vK={}));class AK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){h(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,L({},AK.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]}getMarksInType(t){const e=N(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]))))}}class kK{event;interaction;_option;_marks=new AK;_markReverse=new AK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){M(t.stateStyle[yK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),M(t.stateStyle[yK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Q$.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=m(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(yK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(yK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class MK{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class CK extends MK{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=a$.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Kh(qh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=h(t.minHeight)?null:$h(t.minHeight,e.height,e),this._maxHeight=h(t.maxHeight)?null:$h(t.maxHeight,e.height,e),this._minWidth=h(t.minWidth)?null:$h(t.minWidth,e.width,e),this._maxWidth=h(t.maxWidth)?null:$h(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:$h(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:$h(t.height,e.height,e)},{height:9}),h(t.offsetX)||(this.layoutOffsetX=$h(t.offsetX,e.width,e)),h(t.offsetY)||(this.layoutOffsetY=$h(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{h(this._spec[i])||(e[i]=$h(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};h(n)||(r.width-=n),h(s)||(r.width-=s),h(e)||(r.height-=e),h(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):(h(n)?h(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,h(e)?h(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){b(t)&&(this._layoutStartPoint.x=t),b(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){b(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),b(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}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={...t};return this._layoutRectLevelMap.width<9?(h(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),h(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(h(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),h(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class TK extends MK{grammarType;id=el();_product;getProduct(){if(c(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return c(e)&&c(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){c(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(c(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(c);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class EK extends TK{grammarType=mK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}c(this._value)&&this._product.value(this._value),c(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class PK extends MK{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new EK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class RK extends PK{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(L(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class BK extends RK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class IK extends CK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new AK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=el(),this._originalSpec=t,this._spec=Qh(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new eK(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new BK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Qh(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(h(t)||h(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=L({},e?.[N(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),m(t))return t.map((t=>d(t)&&!l(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];d(n)&&!l(n)&&(Fh(n)?e[i]=Oh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){c(t)&&c(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!c(t)||!c(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${Kj}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=B$.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const DK={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},LK={symbol:function(t,e){return"shape"===t?DK[e]??e:e}};const OK={};Object.values(yK).forEach((t=>{OK[t]=!0}));const FK={[yK.STATE_HOVER]:yK.STATE_HOVER_REVERSE,[yK.STATE_SELECTED]:yK.STATE_SELECTED_REVERSE,[yK.STATE_DIMENSION_HOVER]:yK.STATE_DIMENSION_HOVER_REVERSE};function zK(t){return FK[t]}class HK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!M(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=zK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=zK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=zK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=zK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class jK extends RK{id=el();stateKeyToSignalName=t=>`${Kj}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===fK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===fK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}}}}class NK extends IK{static type="region";modelType="region";type=NK.type;_series=[];layoutType="region";layoutZIndex=r$.Region;animate;interaction=new HK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler})),c(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:R$.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",qX.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",qX.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:R$.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:R$.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",qX.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(r$.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",qX.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",qX.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",qX.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):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=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||N(t.userId).includes(e.userId))&&(!c(t.specIndex)||!e.getSpecIndex||N(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||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(VX.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new kK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in _K)M(t.stateStyle[_K[e]])||this.interaction.registerMark(_K[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class VK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const WK=[R$.line,R$.area,"trail"];function GK(t){return WK.includes(t)}class UK extends RK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),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];c(n.domain)&&(s.domain=n.domain),c(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=o(GK)?n:!t.mark||GK(t.mark.markType);let s=!1,r=!1;if(c(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!OK[t])).map((t=>[t,10])),n=!t.mark||GK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(m(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Kj)));n=t.datums.some((t=>i&&m(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(d(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Kj)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(zl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class YK extends TK{grammarType=mK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();h(t)||(h(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class XK extends YK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return c(t)?t:`${Kj}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct(t)}}class $K extends TK{grammarType=mK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=r$.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){c(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){h(this._data)&&this.initMarkData({...this._option,mark:this}),c(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new UK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new eK(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new XK(t)}stateKeyToSignalName(t){return`${Kj}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(c(e)&&this.removeProduct());if(c(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),h(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(h(this._data))return;this._data.compile();const t=this._data.getProduct();c(this._product)&&c(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[yK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!l(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(hV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===fK.appear&&this.runAnimationByState(fK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),LK[a]?LK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class KK extends $K{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(c(t.id)&&(this._userId=t.id),o(t.interactive)&&(this._interactive=t.interactive),c(t.zIndex)&&this.setZIndex(t.zIndex),o(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(v(t))return Sl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Sl)),t}return"function"==typeof t?(e,i,n,s)=>Sl(t(e,i,n,s)):t}isUserLevel(t){return[qX.User_Mark,qX.User_Series,qX.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];h(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;c(r)&&r<=n&&L(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return f(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=Nh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;return s=this.stateStyle[i]?.[t]?this._computeStateAttribute(this.stateStyle[i][t],t,e,i,n):this._computeStateAttribute(this.stateStyle.normal[t],t,e,i,n),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,s):s}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):o$.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):Hl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",qX.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=l(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,qX.User_Mark,e)}else this.setStyle(i,t,qX.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let h=s,d=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(h=t),d||(d=e)}const u=Dh(Ih(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),p={},g={...l$[n],...a};return Object.keys(g).forEach((t=>{const n=g[t];"stops"===t?p.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??h?.scale(e[d]);return l(s)&&(a=s(e,this._attributeContext,i,o)),c(n)&&(a=Uo.SetOpacity(a,n)),{offset:l(r)?r(e,this._attributeContext,i,o):r,color:a||u[0]}})):l(n)?p[t]=n(e,this._attributeContext,i,o):p[t]=n})),p.gradient=n,p}_computeThresholdAttr(t){return(new Th).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class qK extends KK{static type=R$.group;type=qK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Yo("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?(Yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class ZK extends KK{static type=R$.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(tV.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}class JK extends KK{static type=R$.image;type=JK.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}wK.useMark([ZK,qK,JK]),B$.registerRegion("region",NK),B$.registerLayout("base",VK);var QK,tq,eq;We.getInstance(Ve.Error),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(QK||(QK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(tq||(tq={}));class iq{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Nh("colorOrdinal"):Nh(t.type)),e?(m(t.range)&&e.range(t.range),m(t.domain)&&(nl(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),nl(n.domain)?e.reRender=!0:z(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)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{nl(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{S$(e,[{key:t,operations:zl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&S$(e,[{key:i.field,operations:zl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!nl(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=zl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{zl(e.type)?(h(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),h(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;zl(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){if(!h(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(zl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(zl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));zl(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(h(t.field)||!h(t.changeDomain)&&"none"!==t.changeDomain&&!h(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class nq{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(VX.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][JX]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[JX],s>=0?(t[ZX]=e,e+=t[JX],t[JX]=e):(t[ZX]=i,i+=t[JX],t[JX]=i)})),t.values.forEach((t=>{s=t[JX];const r=s>=0?e:i;n=s>=0?1:-1,t[QX]=Math.min(1,t[ZX]/r)*n,t[t$]=Math.min(1,t[JX]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[JX]=function(t){if(b(t))return t;const e=+t;return b(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class sq extends MK{type="chart";id=el();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:qj,height:Zj};getLayoutRect(){return this._layoutRect}_viewRect={width:qj,height:Zj};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:qj,y2:Zj};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=qh(t.padding??this._theme?.padding),this._event=new eK(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new nq(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),E(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=B$.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=pK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),c(t.regionId)?i=this.getRegionsInUserId(t.regionId):c(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&N(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=B$.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(B$.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(VX.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(VX.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>N(t).some((t=>c(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof IK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof KK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof KK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(c(t)&&c(e))this._canvasRect={width:t,height:e};else{let i=qj,n=Zj;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=en(this._option.container,qj,Zj);i=t,n=e}else if(r&&Zo(this._option.mode)){let t;t=f(r)?document?.getElementById(r):r;const{width:e,height:s}=en(t,qj,Zj);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;if(m(t))e.range=t.map((t=>Oh(t,this._theme?.colorScheme)));else{const i=t;Object.prototype.hasOwnProperty.call(i,"type")&&(e.type=i.type),Object.prototype.hasOwnProperty.call(i,"domain")&&(e.domain=i.domain),Object.prototype.hasOwnProperty.call(i,"range")&&(e.range=i.range),Object.prototype.hasOwnProperty.call(i,"specified")&&(e.specified=i.specified)}}return e.range?.length||(e.range=Ih(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new iq(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Ih(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&N(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};m(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Kh(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}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(M(t[n]))continue;const s=t[n];let r={stateValue:n};r=l(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(yK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(yK.STATE_HOVER,!0,t,e,i)}initEvent(){[VX.dataZoomChange,VX.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(hV.AFTER_MARK_RENDER_END,e)};this._event.on(hV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||l(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===Q$.dimensionHover||s===Q$.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===un.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===un.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class rq extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}function aq(t){t.crosshair=N(t.crosshair||{}).map((e=>L({[t.direction===Gh.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(eq||(eq={}));const oq=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!h(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!h(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!h(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=c,(h(o)||o===UX)&&(t[UX]=c?l.total:+t[n]>=0?l.increase:l.decrease)})),f={...i,lastIndex:t},d.push(i)})),d},lq=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},hq=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:cq(t.map((t=>t.latestData)).flat(),e.fields,i)}};function cq(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>cq(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class dq{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new Vo(e instanceof jo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),rK(e,"dimensionTree",hq),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const uq=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},pq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class gq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new AK;_markReverse=new AK;constructor(t,e){this._spec=t,this._option=e,this.event=new eK(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(yK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(yK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(N(i).forEach((e=>{t.on(e,{level:GX.chart},this.onHover)})),n&&"none"!==n&&N(n).forEach((e=>{t.on(e,{level:GX.vchart,source:WX.chart},this.onUnHover)}))),s&&(N(r).forEach((e=>{t.on(e,{level:GX.mark},this.onSelect)})),a&&"none"!==a&&N(a).forEach((e=>{t.on(e,{level:GX.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=pq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;o(i)?this._hover.enable=i:d(i)&&(this._hover.enable=!0,this._hover=L(this._hover,i));const n=this._spec.select;o(n)?this._select.enable=n:d(n)&&(this._select.enable=!0,this._select=L(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,yK.STATE_HOVER)||this.interaction.getEventElement(yK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(yK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(yK.STATE_HOVER,t.item),this.interaction.reverseEventElement(yK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(yK.STATE_HOVER);this.interaction.clearEventElement(yK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(yK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,yK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(yK.STATE_SELECTED);this.interaction.clearEventElement(yK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(yK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(yK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(yK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(yK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(yK.STATE_SELECTED);const e=this.interaction.getEventElementData(yK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class fq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const mq=(t,e)=>c(e)?t.map((t=>e[t])):void 0,yq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),_q=t=>!h(t)&&(m(t)?t.length>0&&t.every(c):Object.keys(t).length>0);function vq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(c(s.regionId)?[s.regionId]:void 0,c(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=c(s)?t[s]:void 0,a=c(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=mq(i,t);let d=mq(n,t);const u=_q(d),p=!u&&c(s)&&h(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,c=i.map(((t,e)=>[t,e])).filter((([,t])=>h(l?.[t])));let g=[l??[]];c.length>0&&c.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];g.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),g=s})),g.forEach((l=>{if(p){const r=t.getViewData()?.latestData.filter(yq(i,l));a.forEach((a=>{const c=r.find((t=>t[s]===a));if(d=mq(n,c),!_q(d))return;const p=t.dataToPosition(c);h(p)||isNaN(p.x)||isNaN(p.y)||o.push({pos:p,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===tq.pie){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToCentralPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}else{const t=e;if(p){const c=t.getViewData()?.latestData.filter(yq(i,l)),p=c.find((t=>t[s]===r));a.forEach((r=>{if(d=mq(n,p),!_q(d))return;const a=t.dataToPosition(p);h(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),d=r.getLayoutStartPoint(),u=r.getLayoutRect(),p=n.globalInstance.getContainer(),g={x:0,y:0,...p?nn(p):{}},f=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>yq(e,i)(t)&&yq(n,s)(t)&&(h(r)||yq([r],[a])(t))));return o},m=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),u.width),y:Math.min(Math.max(t.y,0),u.height)}))(t),i=s.x??d.x+e.x,n=s.y??d.y+e.y;return{canvasX:i,canvasY:n,clientX:g.x+i,clientY:g.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>f(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:WX.chart,event:m({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...f(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:WX.chart,event:m(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),l}return"none"}const bq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return c(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function xq(t){return h(t.mark)&&h(t.model)&&h(t.datum)}class Sq extends fq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];c(i)&&(e[t]={...i,title:c(i.title)?l(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:c(i.content)?l(i.content)?i.content:N(i.content).map((t=>l(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=bq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:c(e)?N(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of N(e)){const e=this.series.getSeriesStyle(t)?.(i);if(c(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const wq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},Aq={min:t=>t===wq.min()?0:t,max:t=>t===wq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===wq.min()?0:t,"array-max":t=>t===wq.max()?0:t};const kq={min:function(t,e){return il(e)?Math.min(t,e):t},max:function(t,e){return il(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.max(t,...i)}},Mq=(t,e)=>{const i={};let n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;n=S$([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!h(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=wq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=kq[n](i[t.key][n],s)})),i[t.key][n]=Aq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},Cq=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>il(t[s])));else if("zero"===n)return t.forEach((t=>{il(t[s])||(t[s]=0)})),t;return t};class Tq extends YK{_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const Eq=`${Kj}_HIERARCHY_DEPTH`,Pq=`${Kj}_HIERARCHY_ROOT`,Rq=`${Kj}_HIERARCHY_ROOT_INDEX`,Bq=()=>({keyMap:new Map});function Iq(t,e,i){t&&(this._seriesField||(t[$X]=this.getSeriesKeys()[0]),t[YX]=e,t[XX]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function Dq(t,e,i,n=0,s,r){void 0===r&&(r=e),Iq.bind(this)(t,e,i),t[Eq]=n,t[Pq]=s||t[this.getCategoryField()],t[Rq]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>Dq.bind(this)(e,n,i,t[Eq]+1,t[Pq],r)))}class Lq extends IK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[QK.label]:{name:QK.label,type:R$.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(VX.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&c(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(VX.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(h(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),o(this._spec.stack)&&(this._stack=this._spec.stack),o(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),o(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),c(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=uK(this._rawData,this._dataSet,{name:`${Kj}_series_${this.id}_viewDataFilter`});const t=uK(this._viewDataFilter,this._dataSet,{name:`${Kj}_series_${this.id}_viewData`});this._data=new Tq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(rK(this._option.dataSet,"invalidTravel",Cq),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new dq(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${Kj}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){rK(this._dataSet,"dimensionStatistics",Mq);const n=new Vo(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=S$(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&S$(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${Kj}_series_${this.id}_viewStackData`;this._viewStackData=new Vo(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(h(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(f(t))return e[t];if(m(t)&&t.every((t=>f(t))))return t.map((t=>e[t])).join("-");if(l(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(VX.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(VX.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(VX.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(VX.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(VX.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||h(e)?[]:f(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:R$.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||h(t.dataId)&&h(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new gq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??$X;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:KX,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,KX)}))}afterInitMark(){this.event.emit(VX.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",qX.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new Sq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??$X,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??$X}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=L({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:l,dataProductId:d,parent:u,isSeriesMark:p,dataStatistics:g,depend:f,label:m,progressive:y,support3d:_=this._spec.support3d||!!this._spec.zField,morph:v=!1}=e,b=super._createMark(t,{key:i??this._getDataIdKey(),support3d:_,dataStatistics:g??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(c(b)){this._marks.addMark(b),p&&(this._seriesMark=b),h(u)?this._rootMark?.addMark(b):!1!==u&&u.addMark(b),h(l)?(b.setDataView(this.getViewData(),this.getViewDataProductId()),b.setSkipBeforeLayouted(!0)):!1!==l&&b.setDataView(l,d),o(s)&&b.setSkipBeforeLayouted(s),c(f)&&b.setDepend(...N(f)),c(m)&&b.setLabelSpec(m);const t=this.getSpec()||{};b.setMorph(v),b.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),b.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),h(y)||b.setProgressiveConfig(y),h(n)||b.setGroupKey(n),this.initMarkStyleWithSpec(b,L({},r,a||t[b.name]))}return b}_getDataIdKey(){return super._getDataIdKey()??XX}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==JX&&t!==t$&&t!==ZX&&t!==QX||(t=this.getStackValueField()),A$(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=B$.getSeries(this.type);return Object.values(t.mark??{})}return t}}class Oq extends Lq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=N(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=N(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&N(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=Gh.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((e=>{const i={key:e,operations:[]};zl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((e=>{const i={key:e,operations:[]};zl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};zl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===Gh.vertical?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction===Gh.vertical?(this.setFieldY(JX),this.setFieldY2(ZX)):(this.setFieldX(JX),this.setFieldX2(ZX))}setValueFieldToPercent(){this.direction===Gh.vertical?(this.setFieldY(t$),this.setFieldY2(QX)):(this.setFieldX(t$),this.setFieldX2(QX))}setValueFieldToStackOffsetSilhouette(){this.direction===Gh.vertical?(this.setFieldY(i$),this.setFieldY2(e$)):(this.setFieldX(i$),this.setFieldX2(e$))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Go(t.xField,i)&&Go(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),c(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(this._spec?.x2Field),this.setFieldY2(this._spec?.y2Field),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{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)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}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._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===Gh.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===Gh.vertical?N(this._spec.yField??this.fieldY):N(this._spec.xField??this.fieldX)}}const Fq=(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};const zq={type:"clipIn"},Hq={type:"fadeIn"};function jq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Hq;default:return zq}}function Nq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=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 Vq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:Nq(t,e)}),Wq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:Nq(t,e)}),Gq={type:"fadeIn"},Uq={type:"growCenterIn"};function Yq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Gq;case"scaleIn":return Uq;default:return Vq(t)}}const Xq={type:"clipIn"},$q={type:"fadeIn"};function Kq(t,e){switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return $q;default:return Xq}}function qq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Zq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:qq(t,!0,fK.appear)}),Jq={type:"fadeIn"},Qq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:qq(t,!0,fK.enter)}),tZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:qq(t,!0,fK.exit)}),eZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:qq(t,!0,fK.exit)});function iZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Jq;case"growRadius":return Zq({...t,growField:"radius"});default:return Zq({...t,growField:"angle"})}}const nZ={type:"fadeIn"};function sZ(t,e){return"fadeIn"===e?nZ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function rZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aZ=t=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:rZ(t)}),oZ={type:"fadeIn"};function lZ(t,e){return!1===e?{}:"fadeIn"===e?oZ:(t=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:rZ(t)}))(t)}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=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const uZ=(t,e)=>({custom:BC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class pZ extends lC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;l(r)&&l(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);b(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);b(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class gZ extends PC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Ht(d,u,p,g);return f.defined=e.defined,f}}const fZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},mZ={type:"fadeIn"},yZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),_Z=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),vZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function bZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mZ;case"growAngle":return fZ({...t,growField:"angle"});default:return fZ({...t,growField:"radius"})}}const xZ={type:"fadeIn"},SZ={type:"growCenterIn"};function wZ(t,e){switch(e){case"fadeIn":return xZ;case"scaleIn":return SZ;default:return Vq(t,!1)}}const AZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},kZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),MZ={type:"fadeIn"},CZ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function TZ(t,e){return"fadeIn"===e?MZ:kZ(t)}const EZ=t=>({custom:DC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),PZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},RZ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===QN.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},IZ=(t,e,i)=>{if(M(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},DZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),LZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},OZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),FZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},zZ={type:"fadeIn"};function HZ(t){return!1===t?{}:zZ}const jZ={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"}},NZ={bar:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),bar3d:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),line:(t,e)=>({appear:Kq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:PC,duration:jZ.update.duration,easing:jZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:jq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),pie3d:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),rose:(t,e)=>({appear:bZ(t,e),enter:yZ(t),exit:_Z(t),disappear:vZ(t)}),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:cZ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:gZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:dZ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:pZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarGroup:(t,e)=>({appear:uZ(t,"in"),disappear:uZ(t,"out")}),circularProgress:(t,e)=>({appear:sZ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:AZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:lZ(t,e),enter:{type:"grow"},disappear:aZ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:IC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:IC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:EZ(t)}),rangeColumn:(t,e)=>({appear:TZ(t,e),enter:kZ(t),exit:CZ(t),disappear:CZ(t)}),waterfall:(t,e)=>({appear:wZ(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:PZ(0,e),enter:DZ(t),exit:OZ(t),disappear:OZ(t)}),circlePacking:(t,e)=>({appear:FZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:HZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:wU},update:{custom:SU},exit:{custom:LC}})},VZ=["appear","enter","update","exit","disappear","normal"];function WZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=l(n)?n(t,s,r):b(n)?n:0;let h=l(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(o+h))},delete t.oneByOne,t}function YZ(t){return t?.[YX]}function XZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function $Z(t){return!function(t){return c(t.timeSlices)}(t)&&c(t.channel)}class KZ extends KK{static type=R$.rect;type=KZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class qZ extends KK{static type=R$.text;type=qZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}wK.useMark([KZ,qZ]);class ZZ extends Oq{static type=tq.bar;type=tq.bar;_barMarkName=QK.bar;_barMarkType=R$.rect;static mark={...Lq.mark,[QK.bar]:{name:QK.bar,type:R$.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...ZZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e)},"normal",qX.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.bar(t,e),GZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Fq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Fq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Fq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class JZ extends KK{static type=R$.rule;type=JZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}wK.useMark([JZ]);class QZ extends ZZ{static type=tq.waterfall;type=tq.waterfall;static mark={...ZZ.mark,[QK.leaderLine]:{name:QK.leaderLine,type:R$.rule},[QK.stackLabel]:{name:QK.stackLabel,type:R$.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],h(this._seriesField)&&(this._seriesField=UX)}getSeriesKeys(){return this._seriesField===UX?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),rK(this._dataSet,"waterfallFillTotal",lq),rK(this._dataSet,"waterfall",oq),(h(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=uK(this.getViewData(),this._dataSet,{name:`${Kj}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new Tq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:ZX,endAs:JX,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(WZ(NZ.waterfall(t,e),GZ(QK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:i}))}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(QZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(QZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===Gh.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):Vh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===Gh.vertical?Vh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===Gh.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",qX.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",qX.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===Gh.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const tJ=`${Kj}_BOX_PLOT_OUTLIER_VALUE`;var eJ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(eJ||(eJ={}));const iJ=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];m(e)||(e=[e]),i.push(...e.map((e=>{const i={[tJ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class nJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(eJ.OUTLIER),value:this.getContentValue(eJ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(eJ.MAX),value:this.getContentValue(eJ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q3),value:this.getContentValue(eJ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MEDIAN),value:this.getContentValue(eJ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q1),value:this.getContentValue(eJ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MIN),value:this.getContentValue(eJ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.SERIES_FIELD),value:this.getContentValue(eJ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return this.series.getOutliersField();if(t===eJ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case eJ.MIN:return this.series.getMinField();case eJ.MAX:return this.series.getMaxField();case eJ.MEDIAN:return this.series.getMedianField();case eJ.Q1:return this.series.getQ1Field();case eJ.Q3:return this.series.getQ3Field();case eJ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return e[tJ];if(t===eJ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case eJ.MIN:return e[this.series.getMinField()];case eJ.MAX:return e[this.series.getMaxField()];case eJ.MEDIAN:return e[this.series.getMedianField()];case eJ.Q1:return e[this.series.getQ1Field()];case eJ.Q3:return e[this.series.getQ3Field()];case eJ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>c(t[tJ])}class sJ extends KK{static type=R$.boxPlot;type=sJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?($N("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(iW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),qV("barBoxplotScaleIn",ZV(eW)),qV("barBoxplotScaleOut",JV(eW))):($N("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(tW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),qV("boxplotScaleIn",ZV(QV)),qV("boxplotScaleOut",JV(QV)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class rJ extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:z$.circle,fill:void 0,lineWidth:0}}}class aJ extends rJ{static type=R$.symbol;type=aJ.type}wK.useMark([sJ,aJ]);class oJ extends Oq{static type=tq.boxPlot;type=tq.boxPlot;static mark={...Lq.mark,[QK.boxPlot]:{name:QK.boxPlot,type:R$.boxPlot},[QK.outlier]:{name:QK.outlier,type:R$.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};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=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(oJ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(oJ.mark.outlier,{progressive:t,key:YX,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:v(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===Gh.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Vh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Vh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Vh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Vh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Vh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},yK.STATE_NORMAL,qX.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),y:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,yK.STATE_NORMAL,qX.Series)}}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"foldOutlierData",iJ),rK(this._dataSet,"addVChartProperty",uq);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===Gh.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._outlierDataView=new Tq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===Gh.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===Gh.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===Gh.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(NZ.boxPlot()),i=this._initAnimationSpec(GZ(QK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(WZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(WZ(NZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new nJ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class lJ{setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(hJ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",qX.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:F$},"normal",qX.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===O$?t===Gh.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",qX.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(hJ.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series))}}const hJ={[QK.point]:{name:QK.point,type:R$.symbol},[QK.line]:{name:QK.line,type:R$.line}};class cJ extends KK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((c=>{const d=t[c];if(h(d)||s.includes(c))return;a&&r.includes(c)&&(Hl(d?.type)||d?.scale||l(d))&&(o=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class dJ extends cJ{static type=R$.line;type=dJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===tq.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}wK.useMark([dJ,aJ,qZ]);class uJ extends Oq{static type=tq.line;type=tq.line;_invalidType="break";static mark={...Lq.mark,...hJ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}j(uJ,lJ);class pJ extends KK{static type=R$.rect3d;type=pJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}wK.useMark([pJ,qZ]);class gJ extends ZZ{static type=tq.bar3d;type=tq.bar3d;static mark={...Lq.mark,[QK.bar3d]:{name:QK.bar3d,type:R$.rect3d}};_barMarkName=QK.bar3d;_barMarkType=R$.rect3d}function fJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===Gh.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===Gh.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===Gh.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===Gh.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",qX.Series)}class mJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class yJ extends ZZ{static type=tq.rangeColumn;type=tq.rangeColumn;_barMarkType=R$.rect;_barName=tq.bar;static mark={...ZZ.mark,[QK.minLabel]:{name:QK.minLabel,type:R$.text},[QK.maxLabel]:{name:QK.maxLabel,type:R$.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(yJ.mark.bar,{morph:XZ(this._spec.animation,this._spec.morph,GZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===c$.bothEnd?void 0:L({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===c$.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(yJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(yJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});fJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});fJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===Gh.horizontal?(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.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===Gh.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.rangeColumn({direction:this.direction},e),GZ(QK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new mJ(this)}}wK.useMark([pJ]);class _J extends yJ{static type=tq.rangeColumn3d;type=tq.rangeColumn3d;_barMarkType=R$.rect3d;_barName=tq.bar3d}class vJ extends cJ{static type=R$.area;type=vJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}wK.useMark([dJ,vJ,qZ,aJ]);class bJ extends Oq{static type=tq.area;type=tq.area;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(bJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Vh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Vh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(WZ(NZ.area(t,e),GZ(QK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}}j(bJ,lJ);class xJ extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class SJ extends bJ{static type=tq.rangeArea;type=tq.rangeArea;static mark={...bJ.mark};initMark(){this._areaMark=this._createMark(SJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new xJ(this)}}Ar();const wJ={},AJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function kJ(t,e){t&&f(t)||al("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(wJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Ar().projection(n),n.copy=n.copy||function(){const t=i();return AJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),wJ[i]||null}const MJ={albers:Wr,albersusa:function(){var t,e,i,n,s,r,a=Wr(),o=Vr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Vr().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(MJ).forEach((t=>{kJ(t,MJ[t])}));const CJ="Feature",TJ="FeatureCollection";function EJ(t){const e=N(t);return 1===e.length?e[0]:{type:TJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===TJ?t.features:N(t).filter((t=>!h(t))).map((t=>t.type===CJ?t:{type:CJ,geometry:t}))}(e))),[])}}const PJ=AJ.concat(["pointRadius","fit","extent","size"]);function RJ(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{PJ.includes(n)&&(i=i.concat(LN(t[n],e)))})),i):i}const BJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(h(i))for(let i=0;i(l(t),t)))};class IJ extends Lq{type=tq.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;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){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(h(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(h(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return h(r)||isNaN(r.x)||isNaN(r.y)?null:r}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){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Kj}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const DJ=(t,e)=>(t.features&&t.features.forEach((t=>{e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class LJ extends Sq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class OJ extends KK{static type=R$.path;type=OJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var FJ,zJ,HJ;wK.useMark([OJ,qZ]),FJ="projection",zJ=class extends CW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return h(this.spec.pointRadius)||this.detach(LN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(LN(t,this.view)),this.commit(),this}size(t){return h(this.spec.size)||this.detach(LN(this.spec.size,this.view)),this.spec.size=t,this.attach(LN(t,this.view)),this.commit(),this}extent(t){return h(this.spec.extent)||this.detach(LN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(LN(t,this.view)),this.commit(),this}fit(t){return h(this.spec.fit)||this.detach(LN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(LN(t,this.view)),this.commit(),this}configure(t){return this.detach(RJ(this.spec,this.view)),h(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(RJ(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=kJ((t||"mercator").toLowerCase());return e||al("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),AJ.forEach((t=>{var i,n,s;h(this.spec[t])||(i=this.projection,n=t,s=FN(this.spec[t],e,kJ),l(i[n])&&i[n](s))})),h(this.spec.pointRadius)||this.projection.path.pointRadius(FN(this.spec.pointRadius,e,kJ)),!(h(this.spec.fit)||h(this.spec.extent)&&h(this.spec.size))){const t=EJ(FN(this.spec.fit,e,kJ));this.spec.extent?this.projection.fitExtent(FN(this.spec.extent,e,kJ),t):this.spec.size&&this.projection.fitSize(FN(this.spec.size,e,kJ),t)}return this.projection}output(){return this.projection}},HJ="projections",yX[FJ]={grammarClass:zJ,specKey:null!=HJ?HJ:FJ};class jJ extends IJ{static type=tq.map;type=tq.map;static mark={...Lq.mark,[QK.area]:{name:QK.area,type:R$.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(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.map)throw new Error(`map type '${this.map}' is not specified !`);if(!oK.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),rK(this._dataSet,"copyDataView",dK),rK(this._dataSet,"map",DJ),rK(this._dataSet,"lookup",BJ);const t=oK.get(this.map);if(!t)throw Error("no valid map data found!");const e=new Vo(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??$X,XX],as:[this.nameField,this.valueField,this._seriesField??$X,XX]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new Tq(this._option,e)}initMark(){this._pathMark=this._createMark(jJ.mark.area,{morph:XZ(this._spec.animation,this._spec.morph,GZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(jJ.mark.label,{skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>c(t[this._seriesField??$X])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??$X]):this._theme?.defaultFillColor,path:this.getPath.bind(this)},"normal",qX.Series),this.setMarkStyle(t,{smoothScale:!0},"normal",qX.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(WZ(NZ.path(),GZ(QK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initTooltip(){this._tooltipHelper=new LJ(this)}getPath(t){const e=this._areaCache.get(t?.properties?.[this._nameProperty]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t?.properties?.[this._nameProperty],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===R$.path?s.forEach((t=>{t.getGraphicItem().scale(e,e,i)})):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===R$.path?n.forEach((t=>{t.getGraphicItem().translate(e[0],e[1])})):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return b(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]??t.properties?.[this.nameField]??""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return t=>t?.properties?.[this._nameProperty]}}class NJ extends Lq{coordinate="polar";_outerRadius=kN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=c(t)?N(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=c(t)?N(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=N(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(h(t)||h(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(t)),n=this.radiusAxisHelper.dataToPosition(N(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};zl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};zl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),c(this._spec.radius)&&(this._outerRadius=this._spec.radius),c(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Go(t.angleField,i)&&Go(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const VJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=xl(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}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},WJ=(t,e)=>{const i=t[0].latestData;return new UJ(e.series,i).updateLabels()};class GJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class UJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=b$(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[eN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:c}=n;if("inside"!==t?.position){const t=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_HOVER),n.middleAngle),i=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_SELECTED),n.middleAngle),a=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_NORMAL),n.middleAngle);s[cN]=a.x,s[dN]=a.y,s[lN]=t.x,s[hN]=t.y,s[mN]=i.x,s[yN]=i.y,s[uN]=l.x,s[pN]=l.y,s[gN]=c.x,s[fN]=c.y,s[nN]=r.y-o.height/2}else s[nN]=r.y;return s[Qj]=this._computeAlign(n),s[Jj]=Math.max(a,0),s[eN]=n.labelVisible&&!h(n.labelText),s[iN]=r.x,s[tN]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=kl(e.x,e.y,f,t.middleAngle),t.labelLimit=p,at(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=Ml(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=Ml(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(ot(t.pointB.x,n+r)||at(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.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 r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?bl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=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}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?h(i)||"auto"===i?"edge"===n?Ml(t.quadrant)?"left":"right":Ml(t.quadrant)?"right":"left":i:h(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=h(n)||h(t[n])||h(t[s]);return l(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class YJ extends KK{type=XJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),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{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+Al({angle:e[_N],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class XJ extends YJ{static type=R$.arc;type=XJ.type}wK.useMark([OJ,qZ,XJ]);class $J extends NJ{_pieMarkName=QK.pie;_pieMarkType=R$.arc;static mark={...Lq.mark,[QK.pie]:{name:QK.pie,type:R$.arc},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=xN;_endAngle=SN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=c(t),r=c(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}}(c(this._spec?.startAngle)?Sl(this._spec.startAngle):this._startAngle,c(this._spec?.endAngle)?Sl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=c(this._spec?.padAngle)?Sl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;rK(this._dataSet,"pie",VJ),rK(this._dataSet,"arcLabel",WJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:rN,asEndAngle:aN,asRatio:sN,asMiddleAngle:_N,asRadian:bN,asQuadrant:vN,asK:oN}},!1);const e=new Vo(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${Kj}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new Tq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...$J.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark($J.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark($J.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Wh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Wh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this)},void 0,qX.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(VX.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){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}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${Kj}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${Kj}_ARC_LABEL_${e}_AY`])} L${Math.round(t[uN])},${Math.round(t[pN])} L${Math.round(t[gN])},${Math.round(t[fN])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(h(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=Al({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=Al({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===fK.appear)return this._startAngle;if(i===fK.disappear)return this._endAngle;const n=[fK.disappear,fK.exit],s=e.mark.elements,r=t,a=r?.[YX];if(void 0===s.find((t=>t.data[0]?.[YX]t.data[0]?.[YX]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[YX]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class KJ extends $J{static type=tq.pie;type=tq.pie}class qJ extends YJ{static type=R$.arc3d;type=qJ.type}wK.useMark([OJ,qZ,qJ]);class ZJ extends $J{static type=tq.pie3d;type=tq.pie3d;_pieMarkName=QK.pie3d;_pieMarkType=R$.arc3d;static mark={...Lq.mark,[QK.pie3d]:{name:QK.pie3d,type:R$.arc3d},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Ol(iN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Ol(nN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this),...n},void 0,qX.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const JJ=[10,20],QJ=Fl.Linear,tQ="circle",eQ=Fl.Ordinal,iQ=["circle","square","triangle","diamond","star"];wK.useMark([aJ,qZ]);class nQ extends Oq{static type=tq.scatter;type=tq.scatter;static mark={...Lq.mark,[QK.point]:{name:QK.point,type:R$.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if(l(e))return e;if(m(e)){if(h(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${Kj}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(d(e)){if(h(t))throw new Error(`${s}Field is required.`);const r={id:`${Kj}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return h(e)?10:v(e)?e:!f(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:QJ,defaultRange:JJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return h(e)?tQ:f(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:eQ,defaultRange:iQ},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(nQ.mark.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(WZ(NZ.scatter({},t),GZ(QK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:v(this._size)||l(this._size)?this._size:10,shape:f(this._shape)||l(this._shape)?this._shape:tQ},yK.STATE_NORMAL,qX.Series),(c(this._sizeField)||c(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},yK.STATE_NORMAL,qX.User_Mark),(c(this._shapeField)||c(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},yK.STATE_NORMAL,qX.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},yK.STATE_NORMAL,qX.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class sQ extends NJ{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(JX),this.setInnerRadiusField(ZX)}setValueFieldToPercent(){this.setRadiusField(t$),this.setInnerRadiusField(QX)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}wK.useMark([XJ,qZ]);class rQ extends sQ{static type=tq.rose;type=tq.rose;static mark={...ZZ.mark,[QK.rose]:{name:QK.rose,type:R$.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(rQ.mark.rose,{morph:XZ(this._spec.animation,this._spec.morph,GZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(rQ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Vh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(wl(e)??0)+90},void 0,qX.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(WZ(NZ.rose(e,t),GZ(QK.rose,this._spec)))}}}wK.useMark([vJ,dJ,aJ,qZ]);class aQ extends sQ{static type=tq.radar;type=tq.radar;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(aQ.mark.area,{progressive:t,isSeriesMark:e})}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._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:F$},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:Sl(this._spec.startAngle)??xN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.radarGroup(t,e),GZ(QK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(c(i)){const s=NZ[n];i.setAnimationConfig(WZ(s(t,e),GZ(i.name,this._spec)))}}))}}j(aQ,lJ);class oQ extends Sq{updateTooltipSpec(){super.updateTooltipSpec(),c(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>Wo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const lQ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},hQ={fill:"#bbb",fillOpacity:.2};wK.useMark([aJ,qZ,JZ,KZ]);class cQ extends Oq{static type=tq.dot;type=tq.dot;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.grid]:{name:QK.grid,type:R$.rule},[QK.gridBackground]:{name:QK.gridBackground,type:R$.rect},[QK.dot]:{name:QK.dot,type:R$.symbol},[QK.title]:{name:QK.title,type:R$.text},[QK.subTitle]:{name:QK.subTitle,type:R$.text},[QK.symbol]:{name:QK.symbol,type:R$.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){c(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){c(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){c(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){c(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){c(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),rK(this._option.dataSet,"objFlat",lQ),rK(this._option.dataSet,"copyDataView",dK),aK(this._option.dataSet,"dataview",Fo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){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(L(hQ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(cQ.mark.group),this._containerMark=this._createMark(cQ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cQ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cQ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cQ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cQ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cQ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cQ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",qX.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i));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",qX.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",qX.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(o))}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){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??$X}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new oQ(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class dQ extends Sq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>Wo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}wK.useMark([JZ,aJ]);class uQ extends Oq{static type=tq.link;type=tq.link;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.link]:{name:QK.link,type:R$.rule},[QK.arrow]:{name:QK.arrow,type:R$.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){c(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){c(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){c(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();rK(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(uQ.mark.group),this._containerMark=this._createMark(uQ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(uQ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(uQ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",qX.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?z$.triangleDown:z$.triangleUp},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new dQ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class pQ extends NJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=Sl(this._spec.startAngle)??Sl(t?.startAngle)??xN,this._endAngle=Sl(this._spec.endAngle)??Sl(t?.endAngle)??SN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||c(n?.startAngle)||c(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[ZX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[JX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class gQ extends YJ{static type=R$.arc;static constructorType=R$.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){c(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),c(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const h=c(t.innerPadding)&&c(a)||c(t.outerPadding)&&c(o),d=c(t.innerRadius)&&s||c(t.outerRadius)&&r;if(h||d){const e=Object.assign({},t);return s&&c(a)&&(l(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+(l(s)?s(t,e,i,n):s):l(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&c(o)&&(l(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-(l(r)?r(t,e,i,n):r):l(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}wK.useMark([XJ,gQ]);class fQ extends pQ{static type=tq.circularProgress;type=tq.circularProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.progressArc},[QK.progress]:{name:QK.progress,type:R$.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(fQ.mark.track),this._progressMark=this._createMark(fQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}}class mQ extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}wK.useMark([KZ]);class yQ extends Oq{static type=tq.linearProgress;type=tq.linearProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.rect},[QK.progress]:{name:QK.progress,type:R$.rect},[QK.group]:{name:QK.group,type:R$.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(yQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(yQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(yQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Vh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(hB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Vh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(hB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",qX.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.linearProgress(t,e),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}initTooltip(){this._tooltipHelper=new mQ(this)}}const _Q=[0],vQ=[20,40],bQ=[200,500],xQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},SQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],wQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:AQ,triangle:AQ,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 AQ(){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 kQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const MQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function CQ(t){return l(t)?t:function(){return t}}class TQ{constructor(t){var e,i;switch(this.options=Object.assign({},TQ.defaultOptions,t),l(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>wQ[t]?wQ[t]():wQ.circle())(this.options.shape),this.getText=null!==(e=CQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=CQ(this.options.fontWeight),this.getTextFontSize=CQ(this.options.fontSize),this.getTextFontStyle=CQ(this.options.fontStyle),this.getTextFontFamily=CQ(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=CQ(this.options.color)}if(h(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=l(this.options.rotate)?t=>{var e;return Gt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Gt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!h(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class PQ extends TQ{constructor(t){var e;super(Object.assign({},PQ.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.spiral=f(this.options.spiral)?null!==(e=EQ[this.options.spiral])&&void 0!==e?e:EQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=CQ(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:n}=kQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));for(this.data=r;s>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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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>=n)s&&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(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(IQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}DQ(p,this._size)&&(p=LQ(p,this._size))}else if(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||BQ(p,i))&&(!i||!RQ(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function RQ(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function BQ(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,DQ=(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 LQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),U(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:n}=kQ(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}FQ.defaultOptions={enlarge:!1};const HQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?NQ(t.fontFamily):"sans-serif",u=t.fontStyle?NQ(t.fontStyle):"normal",p=t.fontWeight?NQ(t.fontWeight):"normal",g=t.rotate?NQ(t.rotate):0,f=NQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?NQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",b=null!==(r=t.shrink)&&void 0!==r&&r,x=null!==(a=t.enlarge)&&void 0!==a&&a,S=null!==(o=t.clip)&&void 0!==o&&o,w=null!==(l=t.minFontSize)&&void 0!==l?l:0,A=t.randomVisible,k=t.as||HQ,M=t.depth_3d,C=t.postProjection;let T=t.fontSize?NQ(t.fontSize):14;const E=t.fontSizeRange;if(E&&!v(T)){const t=T;T=e=>VQ(t(e),WQ(t,h),E)}let P=PQ;"fast"===t.layoutType?P=FQ:"grid"===t.layoutType&&(P=OQ);const R=new P({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:T,shrink:b,clip:S,enlarge:x,minFontSize:w,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},NQ=t=>f(t)||v(t)||l(t)?t:e=>e[t.field],VQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],WQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function GQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),XQ=(t,e)=>{let i=0;for(const e of t)YQ(e)?i+=1:i+=.53;return i};function $Q(t){return x(t)?new Promise(((e,i)=>{const n=pB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{We.getInstance().error("image 加载失败!",t)}})):null}var KQ=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 qQ(t){return KQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield $Q(e);r&&(a=yield function(t,e,i){return KQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&JQ(s,n,a-1);)--a;for(;oo&&QQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield $Q(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||ZQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function ZQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function JQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||n0(e,t,r)))return i0(e,t,r),!0}return!1}function i0(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function n0(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function s0(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,m;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(d=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function r0(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?t0(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=r0(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return t0(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){s0(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!n0(i,y,_)&&(i0(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var l0=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())}))};const h0={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},c0=(t,e,i,n)=>l0(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||al("WordcloudShape shape must be specified."),t.text||al("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(UQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||h0;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=gj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield qQ(l),p=t.colorMode||"ordinal",g={getText:f0(t.text),getFontSize:f0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?f0(t.colorField):f0(t.text),getFillingColor:f0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:f0(t.colorHexField),getFontFamily:f0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:f0(t.padding||1),getFontStyle:f0(t.fontStyle||"normal"),getFontWeight:f0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?f0(t.fontOpacity):()=>1};u0(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:f0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:f0(t.fillingFontStyle||"normal"),getFillingFontWeight:f0(t.fillingFontWeight||"normal"),getFillingPadding:f0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=XQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,P=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),R=Math.max(...P.map((t=>t.fontSize)));P.forEach((t=>t.weight=t.fontSize/R)),P.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield o0(P,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(UQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),d0=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new Wl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Wl).domain(e).range(f).scale(t)}}else(new _h).domain(g0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new _h).domain(g0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},u0=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new Mh).domain(g0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&l(s)&&!n){const e=.5,[o,l]=(i.shapeArea,g0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=p0(h,i,!0);n=[~~(e*c),~~c];const d=(new Mh).domain(g0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=p0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},p0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=XQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},f0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:l(t)?t:e=>e[t.field]:null,m0=`${Kj}_WORD_CLOUD_ANGLE`,y0=`${Kj}_WORD_CLOUD_FILLING_ANGLE`,_0=`${Kj}_WORD_CLOUD_WEIGHT`,v0=`${Kj}_WORD_CLOUD_TEXT`;wK.useMark([qZ]),TN("wordcloud",{transform:jQ,markPhase:"beforeJoin"},!0),TN("wordcloudShape",{transform:c0,markPhase:"beforeJoin"},!0);class b0 extends Lq{static mark={...Lq.mark,[QK.word]:{name:QK.word,type:R$.text},[QK.fillingWord]:{name:QK.fillingWord,type:R$.text}};_nameField;_valueField;setValueField(t){c(t)&&(this._valueField=t,this.setFontSizeRange(vQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){c(t)&&c(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??bQ,this._rotateAngles=this._spec.rotateAngles??_Q,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:xQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:_Q,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!SQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(b0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?v0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud(),GZ(QK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??$X};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:XX,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?v0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:Zo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class x0 extends b0{static type=tq.wordCloud;type=tq.wordCloud}class S0 extends b0{static type=tq.wordCloud3d;type=tq.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(b0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.fillingWord,this._spec)))}}const w0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=b(y*f)?y/f:null,x=b(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:x),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},A0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},k0=`${Kj}_FUNNEL_TRANSFORM_RATIO`,M0=`${Kj}_FUNNEL_REACH_RATIO`,C0=`${Kj}_FUNNEL_HEIGHT_RATIO`,T0=`${Kj}_FUNNEL_VALUE_RATIO`,E0=`${Kj}_FUNNEL_LAST_VALUE_RATIO`,P0=`${Kj}_FUNNEL_NEXT_VALUE_RATIO`,R0=`${Kj}_FUNNEL_LAST_VALUE`,B0=`${Kj}_FUNNEL_CURRENT_VALUE`,I0=`${Kj}_FUNNEL_NEXT_VALUE`,D0=`${Kj}_FUNNEL_TRANSFORM_LEVEL`,L0=20;class O0 extends Sq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===QK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===QK.transform){const e=t?.[M0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===QK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])?t?.[n[0]]:t?.[s]}}class F0 extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class z0 extends F0{static type=R$.polygon;type=z0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}wK.useMark([z0,qZ,JZ]);class H0 extends Lq{static type=tq.funnel;type=tq.funnel;_funnelMarkName=QK.funnel;_funnelMarkType=R$.polygon;_transformMarkName=QK.transform;_transformMarkType=R$.polygon;static mark={...Lq.mark,[QK.funnel]:{name:QK.funnel,type:R$.polygon},[QK.transform]:{name:QK.transform,type:R$.polygon},[QK.transformLabel]:{name:QK.transformLabel,type:R$.text},[QK.outerLabel]:{name:QK.outerLabel,type:R$.text},[QK.outerLabelLine]:{name:QK.outerLabelLine,type:R$.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"funnel",w0),rK(this._dataSet,"funnelTransform",A0);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new Tq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:B0,asTransformRatio:k0,asReachRatio:M0,asHeightRatio:C0,asValueRatio:T0,asNextValueRatio:P0,asLastValueRatio:E0,asLastValue:R0,asNextValue:I0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:D0}})}initMark(){if(this._funnelMark=this._createMark({...H0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...H0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(H0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(H0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(H0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(H0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new O0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>c(t[this._valueField]),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Ol(M0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",qX.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",qX.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),GZ(QK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(WZ(NZ.funnel({},t),GZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(WZ(NZ.label(),GZ(QK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[E0])/2:this._getSecondaryAxisLength(t[T0])/2,s=this._getSecondaryAxisLength(t[T0])/2):(n=this._getSecondaryAxisLength(t[T0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[P0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[D0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return c(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!c(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(v(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-L0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series)}}function V0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=U0(t.children,u.children,i+1,o,u,r);u.value=h(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else u.isLeaf=!0,u.value=h(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:l,flattenIndex:o}},Y0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=Y0(t.children,e,t,s))})),n},X0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=X0(t.children,e,t,s)),s=e(t,n,i,s)})),s},$0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:V0,slice:W0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?W0:V0)(t,e,i,n,s)}};class K0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=m(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=m(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=m(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=m(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},K0.defaultOpionts,t);const i=this.options.nodeKey,n=l(i)?i:i?ll(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?G0(this.options.aspectRatio):null!==(e=$0[this.options.splitType])&&void 0!==e?e:$0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=U0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(v(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(v(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)}))}}K0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const q0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class Z0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];V0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),q0);const n=m(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],n)return this._layoutLabel(t,o(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},Z0.defaultOpionts,t):Object.assign({},Z0.defaultOpionts);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+ml(this.options.center[0],t.width),n=t.y0+ml(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=m(r),l=o?r.map((t=>ml(t,s))):ml(r,s),c=m(a),d=this.options.gapRadius,u=c?a.map((t=>ml(t,s))):ml(a,s),p=Y(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return h(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:ih(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(m(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=ml(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(m(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=U0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("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=$t({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}Z0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const J0=4294967296;function Q0(t,e){let i,n;if(i1(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function i1(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function a1(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function o1(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function l1(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function h1(t){return{_:t,next:null,prev:null}}function c1(t,e){const i=(t=N(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];a1(s,n,r);let a,o,l,h,c,d,u,p=h1(n),g=h1(s),f=h1(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:m(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="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 h=[],c=U0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%J0)/J0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=l(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:g1.defaultOpionts.nodeSort;Y0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)Y0([u],d1(this.options.setRadius)),X0([u],u1(this._getPadding,.5,d)),Y0([u],p1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);Y0([u],d1(g1.defaultOpionts.setRadius)),X0([u],u1(cl,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&X0([u],u1(this._getPadding,u.radius/t,d)),Y0([u],p1(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}g1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const f1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):f1(t.children,e,i)))})),e},m1=(t,e={})=>{if(!t)return[];const i=[];return f1(t,i,e),i},y1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new Z0(i).layout(t,{width:n,height:s})};class _1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var v1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(v1||(v1={}));const b1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(h(s))return t;if(i.type===v1.DrillDown){return N(k$(t,s,n,"children"))}if(i.type===v1.DrillUp){const e=M$(t,s,n,"children");if(e)return N(e)}return t};class x1{pointerId;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(){}parserDragEvent(){return!0}}class S1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const w1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1}};class A1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return w1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===un.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;rK(t,"drillFilter",b1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(h(t.datum)||h(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!m(t)||M(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:v1.DrillDown},e().reRunAllTransform(),i.emit(VX.drill,{value:{path:t,type:v1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!m(i)||M(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:v1.DrillUp},t().reRunAllTransform(),e.emit(VX.drill,{value:{path:i,type:v1.DrillUp},model:this}),i}}wK.useMark([XJ,qZ]);class k1 extends NJ{static type=tq.sunburst;type=tq.sunburst;static mark={...Lq.mark,[QK.sunburst]:{name:QK.sunburst,type:R$.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),this._startAngle=Gt(this._spec.startAngle),this._endAngle=Gt(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),rK(this._dataSet,"sunburstLayout",y1),rK(this._dataSet,"flatten",m1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[c(this._centerX)?this._centerX:this.getLayoutRect().width/2,c(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(k1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){h(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.y+(c(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(k1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return d(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(c(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},yK.STATE_NORMAL,qX.Series)}initTooltip(){this._tooltipHelper=new _1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((i=>{i.setAnimationConfig(WZ(NZ.sunburst(t,e),GZ(i.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(m(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}j(k1,A1);const M1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new g1(i).layout(t,{width:n,height:s})};class C1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}wK.useMark([XJ,qZ]);class T1 extends Oq{static type=tq.circlePacking;type=tq.circlePacking;static mark={...Lq.mark,[QK.circlePacking]:{name:QK.circlePacking,type:R$.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,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();h(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"circlePackingLayout",M1),rK(this._dataSet,"flatten",m1),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(T1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){h(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},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(T1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},yK.STATE_NORMAL,qX.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new C1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((e=>{e.setAnimationConfig(WZ(NZ.circlePacking({},t),GZ(e.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}j(T1,A1);const E1=t=>{let e=0;return t.forEach(((t,i)=>{var n;h(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=E1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function P1(t){return t.depth}function R1(t,e){return e-1-t.endDepth}const B1=(t,e)=>t.y0-e.y0,I1={left:P1,right:R1,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?W(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:P1,end:R1};class D1{constructor(t){this._ascendingSourceBreadth=(t,e)=>B1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D1.defaultOptions,t);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._alignFunc=l(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I1[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];E1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(h(s.source)||h(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(f(e)){const t=ct(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(v(e)){if(r=e,v(i))a=i;else if(h(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else l(e)&&v(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}h(this.options.nodeSortBy)&&s.sort(B1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},O1=(t,e)=>{if(!t||!e?.view||!m(t))return t;const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new D1(e),s=[];return s.push(n.layout(t,i)),s},F1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],z1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class H1 extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(v(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class j1 extends KK{static type=R$.linkPath;type=j1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){$N("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),qV("linkPathGrowIn",aW),qV("linkPathGrowOut",oW),qV("linkPathUpdate",lW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}wK.useMark([KZ,j1,qZ]),TN("sankey",{transform:L1,markPhase:"beforeJoin"},!0);class N1 extends Oq{static type=tq.sankey;type=tq.sankey;static mark={...ZZ.mark,[QK.node]:{name:QK.node,type:R$.rect},[QK.link]:{name:QK.link,type:R$.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=r$.Node;_labelLayoutZIndex=r$.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Vt;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){rK(this._dataSet,"sankey",O1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new jo;aK(t,"dataview",Fo),rK(t,"sankeyNodes",F1),rK(t,"addVChartProperty",uq);const e=new Vo(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._nodesSeriesData=new Tq(this._option,e);const i=new jo;aK(i,"dataview",Fo),rK(i,"sankeyLinks",z1),rK(i,"addVChartProperty",uq);const n=new Vo(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._linksSeriesData=new Tq(this._option,n)}}initMark(){const t=this._createMark(N1.mark.node,{isSeriesMark:!0,key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(N1.mark.link,{key:YX,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(N1.mark.label,{key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},yK.STATE_NORMAL,qX.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},yK.STATE_NORMAL,qX.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(WZ(NZ.sankeyNode(t,e),GZ(QK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(WZ(NZ.sankeyLinkPath(),GZ(QK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:GX.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:GX.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(N(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||N(s[r]).includes(e.source)&&N(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(N(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new H1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Ih(this._option.getTheme().colorScheme,this.type),n=new Hh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const V1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new K0(e).layout(t,i)},W1=(t,e)=>{let i={},n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=m1(s);return i=Mq([{latestData:r}],e),i};class G1 extends Sq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class U1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,w1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return w1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;h(s)||Yh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){w1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){w1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;h(s)&&h(r)||Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:GX.chart},(t=>{if(!t.event)return;const{event:n}=t;Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:GX.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){w1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:GX.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:GX.chart,source:WX.chart},l),this._eventObj.off(n,{level:GX.chart,source:WX.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:GX.chart,source:WX.chart},l),this._eventObj.on(n,{level:GX.chart,source:WX.chart},o)}}wK.useMark([KZ,qZ]);class Y1 extends Oq{static type=tq.treemap;type=tq.treemap;static mark={...Lq.mark,[QK.nonLeaf]:{name:QK.nonLeaf,type:R$.rect},[QK.leaf]:{name:QK.leaf,type:R$.rect},[QK.nonLeafLabel]:{name:QK.nonLeafLabel,type:R$.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Vt;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qt),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),b(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"treemap",V1),rK(this._dataSet,"flatten",m1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){rK(this._dataSet,"hierarchyDimensionStatistics",W1),rK(this._dataSet,"flatten",m1);const i=new Vo(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initMark(){const t=this._createMark(Y1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(Y1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(Y1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(Y1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},yK.STATE_NORMAL,qX.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()},yK.STATE_NORMAL,qX.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}initAnimation(){this.getMarksInType(R$.rect).forEach((t=>{t.setAnimationConfig(WZ(NZ.treemap(),GZ(t.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}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 G1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(hV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(hV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}j(Y1,U1),j(Y1,A1),wK.useMark([OJ,KZ]);class X1 extends pQ{static type=tq.gaugePointer;type=tq.gaugePointer;static mark={...Lq.mark,[QK.pin]:{name:QK.pin,type:R$.path},[QK.pinBackground]:{name:QK.pinBackground,type:R$.path},[QK.pointer]:{name:QK.pointer,type:[R$.path,R$.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?R$.rect:R$.path}initMark(){this._pinBackgroundMark=this._createMark(X1.mark.pinBackground),this._pointerMark=this._createMark({...X1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(X1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===R$.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return c(this.radiusAxisHelper)&&c(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.pointer,this._spec)))}}wK.useMark([gQ]);class $1 extends pQ{static type=tq.gauge;type=tq.gauge;static mark={...Lq.mark,[QK.segment]:{name:QK.segment,type:R$.progressArc},[QK.track]:{name:QK.track,type:R$.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=Sl(this._spec.padAngle??0)}initData(){super.initData();rK(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[s$]=t[this._angleField[0]],t[n$]=e>0?i[e-1][s$]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark($1.mark.track),this._segmentMark=this._createMark($1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(c(t[n$])?this.angleAxisHelper.dataToPosition([t[n$]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[s$]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.segment,this._spec)))}}class K1 extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return c(i)&&"dimension"===t&&(i.visible=!1),i}}class q1 extends rJ{static type=R$.cell;type=q1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}wK.useMark([q1,qZ]);class Z1 extends Oq{static type=tq.heatmap;type=tq.heatmap;static mark={...Lq.mark,[QK.cell]:{name:QK.cell,type:R$.cell},[QK.cellBackground]:{name:QK.cellBackground,type:R$.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=N(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(Z1.mark.cell,{morph:XZ(this._spec.animation,this._spec.morph,GZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(Z1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=Ge(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",qX.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(WZ(NZ.heatmap(t),GZ(QK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new K1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}wK.useSeries([bJ]);class J1 extends rq{static type=eq.area;static view="singleDefault";type=eq.area;seriesType=tq.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([ZZ]);class Q1 extends rq{static type=eq.bar;static view="singleDefault";type=eq.bar;seriesType=tq.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class t2 extends rq{static type=eq.bar3d;static view="singleDefault";type=eq.bar3d;seriesType=tq.bar3d}wK.useSeries([oJ]);class e2 extends rq{static type=eq.boxPlot;static view="singleDefault";type=eq.boxPlot;seriesType=tq.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??Gh.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===Gh.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),aq(t)}}wK.useSeries([T1]);class i2 extends sq{static type=eq.circlePacking;static view="singleDefault";type=eq.circlePacking;seriesType=tq.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=tq.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class n2 extends sq{static type=eq.common;static view="singleDefault";type=eq.common}class s2 extends sq{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([H0]);class r2 extends s2{static type=eq.funnel;static view="singleDefault";type=eq.funnel;seriesType=tq.funnel}wK.useSeries([N0]);class a2 extends s2{static type=eq.funnel3d;static view="singleDefault";type=eq.funnel3d;seriesType=tq.funnel3d}const o2={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function l2(t){let e=0;return C(t,"tick.visible")&&(e+=C(t,"tick.tickSize")),C(t,"label.visible")&&(e+=C(t,"label.space")),e}function h2(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function c2(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function d2(t){const e=t?.orient;return"angle"===e||"radius"===e}const u2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},j$(t)?r:a)},p2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class g2 extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=N(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return c(i)&&e.forEach((t=>{h(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));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],c(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class f2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),h(n.angle.type)&&(n.angle.type="linear"),h(n.radius.type)&&(n.radius.type="band");const s=h2(n.angle,{min:0,max:1});h(n.angle.min)&&(n.angle.min=s.min),h(n.angle.max)&&(n.angle.max=s.max)}}wK.useSeries([X1,$1]);class m2 extends f2{static type=eq.gauge;static view="singleDefault";type=eq.gauge;seriesType=tq.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:tq.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===tq.gauge||t.type===tq.circularProgress));h(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&h(e.radiusField)&&h(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===tq.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),h(e.angle.type)&&(e.angle.type="linear"),h(e.radius.type)&&(e.radius.type="linear")}}wK.useSeries([Z1]);class y2 extends rq{static type=eq.heatmap;static view="singleDefault";type=eq.heatmap;seriesType=tq.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class _2 extends rq{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}wK.useSeries([ZZ]);class v2 extends _2{static type=eq.histogram;static view="singleDefault";type=eq.histogram;seriesType=tq.bar;transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class b2 extends _2{static type=eq.histogram3d;static view="singleDefault";type=eq.histogram3d;seriesType=tq.bar3d}wK.useSeries([uJ]);class x2 extends rq{static type=eq.line;static view="singleDefault";type=eq.line;seriesType=tq.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([jJ]);class S2 extends sq{static type=eq.map;static view="singleDefault";type=eq.map;seriesType=tq.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area}}isValidSeries(t){return t===tq.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class w2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}wK.useSeries([KJ]);class A2 extends w2{static type=eq.pie;static view="singleDefault";type=eq.pie;seriesType=tq.pie}wK.useSeries([ZJ]);class k2 extends w2{static type=eq.pie3d;static view="singleDefault";type=eq.pie3d;seriesType=tq.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}wK.useSeries([fQ]);class M2 extends f2{static type=eq.circularProgress;static view="singleDefault";type=eq.circularProgress;seriesType=tq.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}wK.useSeries([yQ]);class C2 extends rq{static type=eq.linearProgress;static view="singleDefault";type=eq.linearProgress;seriesType=tq.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="band"),h(e.type)&&(e.type="linear");const n=h2(e,{min:0,max:1});h(e.min)&&(e.min=n.min),h(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="linear"),h(e.type)&&(e.type="band");const n=h2(i,{min:0,max:1});h(i.min)&&(i.min=n.min),h(i.max)&&(i.max=n.max)}}}class T2 extends g2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}wK.useSeries([aQ]);class E2 extends T2{static type=eq.radar;static view="singleDefault";type=eq.radar;seriesType=tq.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:L({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}wK.useSeries([SJ]);class P2 extends rq{static type=eq.rangeArea;static view="singleDefault";type=eq.rangeArea;seriesType=tq.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([yJ]);class R2 extends rq{static type=eq.rangeColumn;static view="singleDefault";type=eq.rangeColumn;seriesType=tq.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([_J]);class B2 extends rq{static type=eq.rangeColumn3d;static view="singleDefault";type=eq.rangeColumn3d;seriesType=tq.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}wK.useSeries([rQ]);class I2 extends T2{static type=eq.rose;static view="singleDefault";type=eq.rose;seriesType=tq.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??kN,outerRadius:t.outerRadius??kN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}wK.useSeries([N1]);class D2 extends sq{static type=eq.sankey;static view="singleDefault";type=eq.sankey;seriesType=tq.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([nQ]);class L2 extends rq{static type=eq.scatter;static view="singleDefault";type=eq.scatter;seriesType=tq.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}wK.useSeries([cQ,uQ]);class O2 extends sq{static type=eq.sequence;static view="singleDefault";type=eq.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==tq.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[tq.bar,tq.line,tq.area,tq.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===tq.dot?"band":"linear",visible:t.type!==tq.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===tq.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===tq.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=pK(t.data,this._dataSet,this._spec.data),t.type===tq.link&&(t.dataDot=pK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===tq.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===tq.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}wK.useSeries([k1]);class F2 extends sq{static type=eq.sunburst;static view="singleDefault";type=eq.sunburst;seriesType=tq.sunburst;getDefaultSeriesSpec(t){const e=c(t.startAngle)?t.startAngle:wN,i=c(t.endAngle)?t.endAngle:e+Ut(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=tq.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([Y1]);class z2 extends sq{static type=eq.treemap;static view="singleDefault";type=eq.treemap;seriesType=tq.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([QZ]);class H2 extends Q1{static type=eq.waterfall;static view="singleDefault";type=eq.waterfall;seriesType=tq.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&N(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),aq(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class j2 extends sq{type=eq.wordCloud;seriesType=tq.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([x0]);class N2 extends j2{static type=eq.wordCloud;static view="singleDefault";type=eq.wordCloud;seriesType=tq.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}wK.useSeries([S0]);class V2 extends j2{static type=eq.wordCloud3d;static view="singleDefault";type=eq.wordCloud3d;seriesType=tq.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class W2{plugins;id=el();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function G2(t){const e={...t};return M(t.style)||(e.textStyle=P$(t.style)),M(t.textStyle)||L(e.textStyle,P$(t.textStyle)),t.shape?.style&&P$(e.shape.style),t.background?.style&&P$(e.background.style),e}function U2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class Y2 extends IK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new W2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case un.cartesianBandAxis:return u2(W$(i),"band",e);case un.cartesianLinearAxis:return u2(W$(i),"linear",e);case un.cartesianAxis:case un.cartesianTimeAxis:return u2(W$(i),void 0,e);case un.polarBandAxis:return p2(i.orient,"band",e);case un.polarLinearAxis:return p2(i.orient,"linear",e);case un.polarAxis:return p2(i.orient,void 0,e);case un.cartesianCrosshair:case un.polarCrosshair:return e.component?.crosshair;case un.colorLegend:return e.component?.colorLegend[U2(i)];case un.sizeLegend:return e.component?.sizeLegend[U2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),m(this._originalSpec)?this._spec=this._originalSpec.map((t=>L({},this._theme,t))):this._spec=L({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:WX.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const X2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(h(a)||h(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},$2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{h(i[e])||t.latestData.forEach((t=>{N(i[e]).forEach((i=>{h(t[i])||(h(o[t[i]])&&(o[t[i]]=0),h(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class K2 extends Y2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=W$(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?Gh.horizontal:Gh.vertical)===Gh.horizontal,c(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(c(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):c(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),h(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(c(t)&&(c(t.userId)&&(this._seriesUserId=N(t.userId)),c(t.specIndex)&&(this._seriesIndex=N(t.specIndex))),c(this._spec.seriesId)){const t=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(c(this._spec.seriesIndex)){const t=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(c(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(c(this._spec.regionId)){const t=N(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(zl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};Ll(this._regions,(s=>{const r="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,a="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!r||!a)return;const o=r.getAxisId()===this._relatedAxisComponent.id?r:a.getAxisId()===this._relatedAxisComponent.id?a:this._isHorizontal?r:a,l=o===r?a:r,h=zl(l.getScale(0).type);t.push(s.getRawData());const c=s.getSpec(),d=N(c.xField),u=N(c.yField),p="cartesian"===s.coordinate?d[0]:c.angleField??c.categoryField,g="cartesian"===s.coordinate?u[0]:c.radiusField??c.valueField;if(n[s.id]="link"===s.type?"from_xField":o===r?p:g,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":l===r?p:g;i.push(h?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else h(this._spec.valueField),Ll(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;aK(n,"dataview",Fo),rK(n,"dataFilterComputeDomain",$2);const s=new Vo(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new YK(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&zl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&zl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new ah,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(rK(this._option.dataSet,"dataFilterWithNewDomain",X2),Ll(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>zl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ct(this._start-s,0,1),a=ct(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}j(K2,U1);class q2 extends K2{static type=un.scrollBar;type=un.scrollBar;name=un.scrollBar;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(h(i))return;if(!m(i))return new q2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new q2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new JW({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return h(i)||(n.padding=i),M(t?.style)||(n.railStyle=P$(t.style)),M(e?.style)||(n.sliderStyle=P$(e.style)),n}}class Z2 extends K2{static type=un.dataZoom;type=un.dataZoom;name=un.dataZoom;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;_startHandlerSize;_endHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(h(i))return;if(!m(i))return new Z2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new Z2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const t=this._spec.startHandler.style.visible??!0,e=this._spec.endHandler.style.visible??!0;this._startHandlerSize=t?this._spec.startHandler.style.size:0,this._endHandlerSize=e?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new _h;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e+i};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e+i};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new kU({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:P$(this._spec.background?.style),startHandlerStyle:P$(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:P$(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:P$(this._spec.middleHandler.background?.style)}},endHandlerStyle:P$(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:P$(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:P$(this._spec.endText?.style)},selectedBackgroundStyle:P$(this._spec.selectedBackground.style),dragMaskStyle:P$(this._spec.dragMask?.style),backgroundChartStyle:{line:L(P$(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:L(P$(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class J2 extends Y2{static type=un.customMark;type=un.customMark;layoutType="absolute";layoutZIndex=r$.CustomMark;layoutLevel=a$.CustomMark;static createComponent(t,e){return t.customMark?[new J2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`});if(s&&(h(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),c(t.dataId)||b(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class Q2 extends Y2{layoutType="absolute";static type=un.brush;type=un.brush;name=un.brush;layoutZIndex=r$.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!h(i)&&!1!==i.visible)return[new Q2(i,{...e,specKey:Q2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new SY({zIndex:this.layoutZIndex,brushStyle:P$(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=VX.brushChange;r="brushStart"===n||"brushDown"===n?VX.brushStart:"brushEnd"===n||"brushMaskUp"===n?VX.brushEnd:VX.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{...P$(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&Le(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&De(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){c(this._spec.regionId)&&c(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){c(this._spec.brushLinkSeriesId)&&c(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&N(t).includes(s.userId)||e&&N(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var t3;function e3(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function i3(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function n3(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:i3(t.rect),anchorCandidates:h3(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>e3(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;te3(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function s3(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=Be(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=o3(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=hn(r,n,i);if(!o3(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],r3(a3(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=r3(a3(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=l3(t.rect,a,0),t}));return n3(h)}function r3(t){return t>180?t-360:t}function a3(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function o3(t,e){for(let i=0;i{const{x:r,y:a}=l3({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(t3||(t3={}));class c3 extends Y2{static type=un.mapLabel;type=un.mapLabel;name=un.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=r$.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!c(i.series)?new c3(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new Vo(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new YK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new FU({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=qh(this._spec.background?.padding),d=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const u={},p=this.dataToPosition(t),g=aB({});if(g.name=`${this.name}_marker_itemContainer_${e}`,u.container=g,this._spec.background?.visible){const t=hB(P$({...this._spec.background.style}));t.setAttributes(p),u.labelBackground=t,g.appendChild(t)}if(this._spec.icon?.visible){const t=uB(P$({...this._spec.icon.style}));t.setAttributes(p),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;u.icon=t,g.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=dB(P$({...this._spec.nameLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.nameLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&c(t[this.valueField])){const e=dB(P$({...this._spec.valueLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.valueLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}const f=Object.values(u).find((t=>!!t&&"group"!==t.type)),m={x:f?.getComputedAttribute("x"),y:f?.getComputedAttribute("y")},y={x:m.x,y:m.y,width:0,height:0};y.width=n+r+(i-1)*d,y.height=s+a;const _={rect:y,point:m,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));_.rect=l3(y,o,l),_.anchors=t,_.offset=l}else _.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:_,contentMarks:u}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:P$({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):n3(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class d3{id;name;service;static Name;constructor(t=d3.Name){this.id=el(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function u3(t,e){const i=e.getSpec?.();M(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=j$(e.layoutOrient),r=t[0],a=V(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);u3(n?n.getChildren():[],t.component),u3(s?s.getChildren():[],t.component)}}function g3(t){return 2===t.length&&b(t[0])&&b(t[1])&&t[1]>=t[0]}function f3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!b(a.min),extendable_max:!b(a.max)}}function m3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function y3(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 _3(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 v3(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 b3=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),x3=(t,e,i=0)=>{const n=new Wt(t).expand(i/2),s=new Wt(e).expand(i/2);return n.intersects(s)},S3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function A3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=Sl(-90));const u=b$(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Wt).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},M3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return b3(p,r.options)};class C3 extends d3{Name="AxisSyncPlugin";constructor(){super(C3.Name)}_checkEnableSync(t){if(!zl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(VX.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!zl(i.type)||!zl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!g3(s)||!g3(r))return;const a=f3(t,s),o=f3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!y3(a,o))return}else if(0===p&&0===g){if(!y3(o,a))return}else if(u||y)if(u&&!y){if(!m3(a,o))return}else if(y&&!u){if(!m3(o,a))return}else{if(h===g)return;if(h>g){if(!_3(a,o))return}else if(!_3(o,a))return}else{if(0===h&&0===p){if(!v3(a,o))return}else if(0===g&&0===l&&!v3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){rK(e.getOption().dataSet,"tickAlign",M3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var T3={AxisLabelOverlapPlugin:p3,AxisSyncPlugin:C3};const E3=t=>t,P3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!w3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},R3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?S3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return b3(t.domain());let h;if(c(s))h=t.stepTicks(s);else if(c(n))h=t.forceTicks(n);else if(c(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=l2(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=l2(r),c=b$(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Bl(u),{x:m,y:y}=$t({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Wt).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=I3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}else h=t.domain();return b3(h)},I3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&x3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},D3=(t,e)=>{if(zl(t.type))return((t,e)=>{if(!zl(t.type))return b3(t.domain());const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=c(s)?t.stepTicks(s):c(n)?t.forceTicks(n):t.ticks(i??5),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=k3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&A3(s,i);)s=P3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),V(a)!==V(r)&&a.push(V(r))),r=a}return b3(r)})(t,e);if(jl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(c(s))l=t.stepTicks(s);else if(c(n))l=t.forceTicks(n);else if(c(i))l=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=k3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=R3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}else l=t.domain();return b3(l)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return B3(t,e)}return b3(t.domain())};class L3 extends Y2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),c(this._spec.id)&&t.setUserId(this._spec.id),o(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==C(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=WZ(NZ.axis(),{appear:this._spec.animationAppear??C(this._option.getChart().getSpec(),"animationAppear.axis")??C(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??C(this._option.getChart().getSpec(),"animationDisappear.axis")??C(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??C(this._option.getChart().getSpec(),"animationEnter.axis")??C(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??C(this._option.getChart().getSpec(),"animationExit.axis")??C(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??C(this._option.getChart().getSpec(),"animationUpdate.axis")??C(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return Ll(this._regions,(e=>{m(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;c(t)&&(this._seriesUserId=N(t)),c(i)&&(this._regionUserId=N(i)),c(e)&&(this._seriesIndex=N(e)),c(n)&&(this._regionIndex=N(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(Ll(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!zl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=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));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(Ll(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===rU.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&h(t.title.angle)&&(i="left"===t.orient?-90:90,e=o2[t.orient]),{orient:this.orient,select:t.select,hover:t.hover,line:(n=t.domainLine,(n=C$(n)).startSymbol=C$(n.startSymbol),n.endSymbol=C$(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:l(t.label.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.label.style(e.rawValue,i,e,n,s));return P$(this._preprocessSpec(L({},this._theme.label?.style,r)))}:P$(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:E$(t.label.state),autoRotate:!!t.label.autoRotate,autoHide:!!t.label.autoHide,autoLimit:!!t.label.autoLimit,autoRotateAngle:t.label.autoRotateAngle,autoHideMethod:t.label.autoHideMethod,autoHideSeparation:t.label.autoHideSeparation,limitEllipsis:t.label.limitEllipsis,layoutFunc:t.label.layoutFunc},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:l(t.tick.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.tick.style(e,i,n,s));return P$(this._preprocessSpec(L({},this._theme.tick?.style,r)))}:P$(t.tick.style),state:T$(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:l(t.subTick.style)?(e,i,n,s)=>{const r=t.subTick.style(e,i,n,s);return P$(L({},this._theme.subTick?.style,r))}:P$(t.subTick.style),state:T$(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:l(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return P$(this._preprocessSpec(L({},this._theme.grid?.style,n)))}:P$(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:P$(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Gt(i):null,textStyle:L({},e,P$(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:P$(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:P$(t.title.background?.style)},state:{text:T$(t.title.state),shape:T$(t.title.shape?.state),background:T$(t.title.background?.state)}},panel:{visible:t.background?.visible,style:P$(t.background?.style),state:T$(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const O3=[T3.AxisLabelOverlapPlugin,T3.AxisSyncPlugin];class F3 extends L3{static type=un.cartesianAxis;type=un.cartesianAxis;name=un.cartesianAxis;layoutType="region-relative";layoutZIndex=r$.Axis;layoutLevel=a$.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;_verticalLimitSize;constructor(t,e){super(t,{...e}),this._orient=W$(t,["z"]),V$(this._orient)&&(this.layoutType="absolute"),c(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?j$(t)?"linear":"band":j$(t)?"band":"linear"}(t.orient,i),s=`${F3.type}-${n}`,r=B$.getComponentInKey(s);if(r){let n=t.inverse;return i&&!j$(t.orient)&&(n=!c(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(F3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[F3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===Gh.horizontal;if(!m(i))return c2(i)?F3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>N$(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{c2(t)&&a.push(F3.createAxis(t,{...e,specIndex:i,specKey:F3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):N$(this.orient)?t.setYAxisHelper(this.axisHelper()):V$(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];j$(this.orient)?b(e)&&(s=n?[e,0]:[0,e]):V$(this.orient)?b(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):b(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(O3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();j$(this.orient)?h(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):h(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=j$(this.orient)?t.fieldX:V$(this.orient)?t.fieldZ:t.fieldY,zl(this._scale.type)?e:[e[0]]}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(hV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(j$(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(VX.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Ll(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:j$(this.orient)?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:V$(this.orient)?i.fieldZ:i.fieldY,n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{j$(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):N$(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):V$(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;b(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),b(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=j$(this.orient)?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=j$(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(L({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=L({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&h(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{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=j$(this.orient),s=t=>(n?!j$(t.orient):j$(t.orient))&&zl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(c(t))a=r.find((e=>e.id===t));else if(c(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const z3=Math.sqrt(50),H3=Math.sqrt(10),j3=Math.sqrt(2);class N3{_extend={};setExtraAttrFromSpec(){c(this._spec.nice)&&(this._nice=this._spec.nice),c(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=h2(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];c(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),c(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(W(t)-function(t){if(t&&m(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=z3?10:s>=H3?5:s>=j3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(VX.scaleUpdate,{model:this})}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{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._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}j(G3,W3);class U3 extends V3{static type=un.cartesianTimeAxis;type=un.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=L({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new YK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=Wo.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return m(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&m(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class Y3 extends L3{static type=un.polarAxis;type=un.polarAxis;name=un.polarAxis;layoutType="absolute";layoutZIndex=r$.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=xN;get startAngle(){return this._startAngle}_endAngle=SN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${Y3.type}-${i}`,s=B$.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(Y3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!m(i))return d2(i)?(i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),Y3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!d2(i))return;i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),i.outerRadius=i.radius??t.outerRadius??t.radius??kN;const o=Y3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Sl(this._spec.startAngle??wN),this._endAngle=Sl(this._spec.endAngle??(c(this._spec.startAngle)?this._spec.startAngle+360:AN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(VX.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._spec.tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return zl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=Al({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=jt.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=kN,e=0;const i=this.getChart().getSpec();return Ll(this.getRegions(),(n=>{const s=n;if(function(t){return[tq.rose,tq.radar,tq.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;b(n)&&(t=n),b(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(L({},this._axisStyle,t))}}class X3 extends Y3{static type=un.polarLinearAxis;type=un.polarLinearAxis;_zero=!0;_nice=!0;_scale=new _h;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}j(X3,N3);class $3 extends Y3{static type=un.polarBandAxis;type=un.polarBandAxis;_scale=new ah;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function K3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:p,regionId:g,regionIndex:f,seriesIndex:m,seriesId:y,padding:_,...v}=L({},t),b=v;return i.visible&&(b.title=G2(i)),M(n.focusIconStyle)||P$(n.focusIconStyle),n.shape=C$(n.shape),n.label=C$(n.label),n.value=C$(n.value),n.background=C$(n.background),Xh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),Xh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),Xh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),b.item=n,M(s.textStyle)||P$(s.textStyle),C$(s.handler),b.pager=s,r.visible&&!M(r.style)&&(L(b,r.style),c(r.padding)&&(b.padding=r.padding)),b}j($3,W3);const q3=(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},Z3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return c(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class J3 extends Y2{layoutType="normal";layoutZIndex=r$.Legend;layoutLevel=a$.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Uh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;c(i)&&(this._seriesUserId=N(i)),c(t)&&(this._regionUserId=N(t)),c(n)&&(this._seriesIndex=N(n)),c(e)&&(this._regionUserIndex=N(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new YK(this._option,t),this._initSelectedData(),Ll(this._regions,(t=>{t.event.on(VX.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;h(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(VX.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;b(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(L({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(L({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),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,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class Q3 extends J3{static type=un.discreteLegend;type=un.discreteLegend;name=un.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return i.type&&"discrete"!==i.type?void 0:new Q3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new Q3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){rK(this._option.dataSet,"discreteLegendFilter",Z3),rK(this._option.dataSet,"discreteLegendDataMake",q3);const t=new Vo(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!nl(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=A$(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...K3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return KU}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(GU.legendItemClick,(e=>{const i=C(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(VX.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(GU.legendItemHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(GU.legendItemUnHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:b(r)?r:1,strokeOpacity:b(a)?a:1,opacity:b(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return l(this._spec.data)?this._spec.data(t):t}}const t5=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;b(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},e5=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!M(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function i5(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:d,id:u,visible:p,orient:g,position:f,data:m,defaultSelected:y,field:_,filter:v,regionId:b,regionIndex:x,seriesIndex:S,seriesId:w,padding:A,...k}=L({},t),C=k;return e.visible&&(C.title=G2(e)),C.showHandler=!1!==i.visible,M(i.style)||(C.handlerStyle=P$(i.style)),c(n.width)&&(C.railWidth=n.width),c(n.height)&&(C.railHeight=n.height),M(n.style)||(C.railStyle=P$(n.style)),M(s.style)||(C.trackStyle=P$(s.style)),C.startText=C$(r),C.endText=C$(a),C.handlerText=C$(o),M(l)||(C.sizeBackground=P$(l)),h.visible&&!M(h.style)&&(L(C,h.style),c(h.padding)&&(C.padding=h.padding)),C}function n5(t){return"color"===t||"size"===t}const s5={color:tY,size:iY},r5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],a5=[2,10];class o5 extends J3{static type=un.continuousLegend;type=un.colorLegend;name=un.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return n5(i.type)?new o5(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{n5(t.type)&&n.push(new o5(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?un.colorLegend:un.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){rK(this._option.dataSet,"continuousLegendFilter",e5),rK(this._option.dataSet,"continuousLegendDataMake",t5);const t=new Vo(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=A$(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!nl(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=A$(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),M(n)&&(n="color"===this._legendType?r5:a5);const r={...i5(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return s5[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",gt((e=>{const i=C(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(VX.legendFilter,{model:this,value:i,event:e})}),30))}}}const l5=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),N(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class h5 extends Y2{static type=un.indicator;type=un.indicator;name=un.indicator;layoutType="absolute";layoutZIndex=r$.Indicator;layoutLevel=a$.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==h5.type)return null;const i=N(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map((t=>new h5(t,e)));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){rK(this._option.dataSet,"indicatorFilter",l5);const t=new Vo(this._option.dataSet);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 YK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return N(this._spec.content).forEach((t=>{const e=L({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{...P$(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!c(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{...P$(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rY(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":l(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return Ll(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){super.clear(),this._indicatorComponent=null,this._cacheAttrs=null}}class c5 extends Y2{static type=un.title;type=un.title;layoutType="normal";layoutZIndex=r$.Title;layoutLevel=a$.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Uh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!m(i))return new c5(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new c5(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;b(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),b(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:b(t.width())?t.width():0,height:this._spec.height?this._spec.height:b(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new nY(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class d5{projection;constructor(t){if(this.projection=kJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function u5(t,e){return`${Kj}_${e}_${t}`}class p5 extends Y2{static type=un.geoCoordinate;type=un.geoCoordinate;name=un.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:u5(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(h(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new p5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=L(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(VX.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new d5(this._projectionSpec)}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===tq.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===tq.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(tq.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==tq.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}j(p5,U1);const g5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},f5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class m5 extends Y2{layoutType="absolute";gridZIndex=r$.CrossHair_Grid;labelZIndex=r$.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach(((t,i)=>this._registerEvent(t,m(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:WX.chart},this._handleEvent),this.event.on(e,{level:GX.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ft((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(g5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(m(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(g5[e][t]),s=s.concat(g5[e][i(t)])})),{in:n,out:s}}return{in:g5[e][t],out:g5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=C(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{f5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),m(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function _5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var v5,b5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(v5||(v5={}));class x5 extends m5{static type=un.cartesianCrosshair;type=un.cartesianCrosshair;name=un.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.xField||i.yField?new x5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new x5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,v5.VERTICAL,!0),this.layoutByValue(v5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,v5.HORIZONTAL,!1),this.layoutByValue(v5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return zl(t.getScale().type)&&b(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){j$(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(v5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=v5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,d;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(jl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(zl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=_5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=l2(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(jl(s.type)){const t=s._step;d=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(zl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=_5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(d=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):d=1,a=r}}if(this.yHair.label?.visible){const e=l2(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(v5.HORIZONTAL&&this._layoutHorizontal(n,d??0),v5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EG({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new PG({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new yG(e)),n.add(t)),y5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(b5||(b5={}));class S5 extends m5{static type=un.polarCrosshair;type=un.polarCrosshair;name=un.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.categoryField||i.valueField?new S5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new S5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});zl(s.getScale().type)&&b(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:jt.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(b5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",L(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=l2(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=l2(t.getSpec())),n.angle=i.angle,n.axis=t,L(n,s)}))),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(b5.HORIZONTAL&&this._layoutHorizontal(n),b5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:$t(l,n,i),end:$t(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new EG({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new BG({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Bl(i),e={...$t(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Kt(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=$t(t,s,p),m=$t(t,s,g),y=ve([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=ct(jt.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new IG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new RG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=xl(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}}(i),n={...$t(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new yG(e),n.add(t),i(t)),y5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const w5=t=>P$({...t}),A5=t=>({...t,style:{...P$(t.style)}}),k5=t=>{const e=w5(t?.slider?.trackStyle??{}),i=w5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},P$({...s}));var s;const r=A5(t?.controller?.start??{}),a=A5(t?.controller?.pause??{}),o=A5(t?.controller?.backward??{}),l=A5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},M5=(t,e)=>({...k5(t),data:e,type:"continuous"}),C5=(t,e)=>({...k5(t),data:e,type:"discrete"}),T5=t=>"left"===t||"right"===t,E5=t=>"top"===t||"bottom"===t;class P5 extends Y2{layoutZIndex=r$.Player;layoutLevel=a$.Player;static type=un.player;type=un.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return h(i)||!1===i.visible?null:new P5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),b(t.x)){const e=T5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(b(t.y)){const e=E5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{...C5(this._spec,this._specs),...e}:{...M5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new _Y(t):this._playerComponent=new bY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 v(this._spec.width)?Math.min(t.width,Number(this._spec.width)):T5(this._orient)?this._maxSize():t.width}_computeHeight(t){return v(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):E5(this._orient)?this._maxSize():t.height}_computeDx(t){return T5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return E5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size),(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(VX.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnEnd,(()=>{this.event.emit(VX.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];N(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(VX.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const R5=(t,e)=>Tl(t[0].latestData,e.field),B5=(t,e)=>El(t[0].latestData,e.field);function I5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function D5(t,e){return Pl(t[0].latestData,e.field)}function L5(t,e){return Rl(t[0].latestData,e.field)}function O5(t,e){return function(t,e){return Math.sqrt(Rl(t,e))}(t[0].latestData,e.field)}function F5(t,e){return function(t,e){return Z(t.map((t=>t[e])))}(t[0].latestData,e.field)}function z5(t,e){const i={min:R5,max:B5,sum:I5,average:D5,variance:L5,standardDeviation:O5,median:F5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(c(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(c(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function H5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.x)){v(t.x)&&V5(u,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function j5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.y)){v(t.y)&&V5(u,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function N5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();v(t.x)&&V5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),v(t.y)&&V5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function V5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const W5=["sum","average","min","max","variance","standardDeviation","median"];class G5 extends Y2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||W5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??N(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(N(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Tl(t,e),r=El(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Y5 extends G5{static type=un.markLine;type=un.markLine;name=un.markLine;layoutZIndex=r$.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new Y5(i,{...e,specKey:Y5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new Y5(t,{...e,specIndex:i,specKey:Y5.speckey}))})),n}_createMarkerComponent(){const t=new LU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:P$(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:P$(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:P$(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)||c(t.coordinates)&&c(t.process)&&c(t.process.x),a=c(t.y)||c(t.coordinates)&&c(t.process)&&c(t.process.y),o=c(t.coordinates)&&(!c(t.process)||"process"in t&&"xy"in t.process),l=c(t.positions),h=t?.autoRange??!1;let d=[];r?d=H5(e,i,n,s,h)[0]:a?d=j5(e,i,n,s,h)[0]:o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new Vo(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new Vo(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class X5 extends G5{static type=un.markArea;type=un.markArea;name=un.markArea;layoutZIndex=r$.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new X5(i,{...e,specKey:X5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new X5(t,{...e,specIndex:i,specKey:X5.speckey}))})),n}_createMarkerComponent(){const t=new OU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:P$(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)&&c(t.x1),a=c(t.y)&&c(t.y1),o=c(t.coordinates),l=c(t.positions),h=t?.autoRange??!1;let d=[],u=[];r?(u=H5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):a?(u=j5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=c(t.x)&&c(t.x1),n=c(t.y)&&c(t.y1),s=c(t.coordinates);if(!i&&!n&&!s)return null;let r;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new Vo(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class $5 extends G5{static type=un.markPoint;type=un.markPoint;name=un.markPoint;layoutZIndex=r$.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new $5(i,{...e,specKey:$5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new $5(t,{...e,specIndex:i,specKey:$5.speckey}))})),n}_createMarkerComponent(){const t=new FU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:P$(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:P$(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{...P$(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{...P$(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:P$(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=N5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!c(t.coordinate))return;rK(this._option.dataSet,"markerAggregation",z5);const i=this._processSpecCoo(t),n=new Vo(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const K5=(t,e,i)=>h(t)?t:l(t)?t(e,i):t,q5=(t,e,i)=>{if(h(t))return t;if(m(t)){const n=[];return t.forEach((t=>{if(l(t)){const s=t(e,i);c(s)&&n.push(s)}else n.push(t)})),n}return l(t)?t(e,i):t};const Z5=(t,e)=>(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight),J5="vchart-tooltip-container",Q5=20,t4={key:"其他",value:"..."},e4={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class i4{static dom=`${Kj}_TOOLTIP_HANDLER_DOM`;static canvas=`${Kj}_TOOLTIP_HANDLER_CANVAS`}const n4=(t,e,i)=>{const n=K5(e.key,t,i),s=K5(e.value,t,i),r=!1!==K5(e.visible,t,i)&&(c(n)||c(s)),a=K5(e.isKeyAdaptive,t,i),o=K5(e.shapeType,t,i),l=K5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},s4=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,r4=(t,e)=>{let i;if(c(t))if(v(t))i=t;else if(l(t)){const n=t(e);v(n)&&(i=n)}return i},a4=(t,e)=>{const i=b$(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function o4(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Ej,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var l4;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(l4||(l4={}));class h4{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),l4.success):(this._updateTooltip(!1,e),l4.success)}if(h(n)||h(s))return l4.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(c(t.visible)||c(t.activeType)?s.visible=bq(t).includes("mark"):c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=s4(i,"mark")??{},a=L({},R(e.mark),R(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(c))),[]);if(t.every((t=>!bq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=s4(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{l(t)?o.push(t):o.push(...N(t))})),r={...i[0],content:o};let d={};const u=t.filter((t=>{const e=t.tooltipHelper?.spec;return c(e?.dimension)&&bq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(u.length){let t=[];u.every((({content:t})=>h(t)))?t=void 0:u.forEach((({content:e})=>{h(e)||(l(e)?t?.push(e):t?.push(...N(e)))})),d={...u[0],content:t}}a=L({},R(e.dimension),d)}const o=r.title,d={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(c(a.title))if(l(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...d,...n}}}else a.title={...r.title,...d,...a.title};else a.title={...r.title,...d};const u=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),p=N(r.content);if(c(a.content))if(l(a.content)){const t=a.content;a.content=(e,i)=>{const n=N(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...u(p[0]),...t}})),n}}else{const t=N(a.content);t.forEach(((e,i)=>{t[i]={...u(p[0]),...e}}))}else a.content=p.map((t=>({...t,...u(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return l4.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??l4.success;const a=r[n];if(!a)return l4.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),h(o.title?.key)&&h(o.title?.value)&&!o.content?.length?l4.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??l4.success;const o=i[n];if(!o)return l4.failed;const l=this._getActualTooltipPosition(e,q5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),l4.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=v(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...e4,offsetX:t?.x??e4.offsetX,offsetY:t?.y??e4.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=q5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=q5(t.title,e,i),s=N(q5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=Q5}=t,o=!1!==K5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,c(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=K5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=n4(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...t4});break}if(!(r.content.lengthh(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=n4(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...t4});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(h(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),h(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!c(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,u=this._component.getSpec(),p="canvas"===u.renderMode,g=i?.chart?.getCanvasRect(),f=g?.width??qj,m=g?.height??Zj;let y,_,v,x,S,w,A=!1;if(d(e)){const{left:t,right:i,top:n,bottom:s}=e;y=r4(t,r),_=r4(n,r),v=r4(i,r),x=r4(s,r)}else if(c(e)&&"mark"===t.activeType){A=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case H$.left:y=t-a-l,_=(i+c)/2-o/2;break;case H$.right:y=n+l,_=(i+c)/2-o/2;break;case H$.top:y=(t+n)/2-a/2,_=i-o-h;break;case H$.bottom:y=(t+n)/2-a/2,_=c+h;break;case H$.inside:y=(t+n)/2-a/2,_=(i+c)/2-o/2}}}const k={width:0,height:0},M=(t=0)=>({x:t,y:t});let C=M(),T=M(),E=1,P=1;if(Zo(this._env)&&!u.confine){if(k.width=window.innerWidth,k.height=window.innerHeight,!p){T=n.getBoundingClientRect();const t=this._compiler.getCanvas()??this._chartContainer,e=t.getBoundingClientRect();C={x:e.x-T.x,y:e.y-T.y},E=Z5(t,e),P=Z5(n,T)}}else k.width=f,k.height=m;const{canvasX:R,canvasY:B}=r;S=b(y)?y:b(v)?f-a-v:R+l,w=b(_)?_:b(x)?m-o-x:B+h,S*=E,w*=E,Zo(this._env)&&(S+=C.x,w+=C.y),S/=P,w/=P;const{width:I,height:D}=k;return(S+a)*P+T.x>I&&(A?S=(I-T.x)/P-a:S-=2*l+a),(w+o)*P+T.y>D&&(A?w=(D-T.y)/P-o:w-=2*h+o),S*P+T.x<0&&(S=0-T.x/P),w*P+T.y<0&&(w=0-T.y/P),{x:S,y:w}};_getTooltipBoxSize(t,e){return e&&!h(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:m="",hasShape:y,shapeType:_="",shapeHollow:v,shapeColor:b}=h;if(l.title.visible=f,f){const{text:t,width:e,height:i}=a4(m,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},u=e,g=i,y&&WP[_]){const t={symbolType:_};v?t.stroke=b:t.fill=b,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],h=[],d=[];l.content=t.map(((l,u)=>{const g={height:0,spaceRow:i};let f=0;const{hasShape:m,key:y,shapeColor:_,shapeHollow:v,shapeType:b="",value:x,isKeyAdaptive:S}=l;if(c(y)){const{width:t,height:e,text:i}=a4(y,a);g.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},S?h.push(t):n.push(t),f=Math.max(f,e)}if(c(x)){const{width:t,height:e,text:i}=a4(x,o);g.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},d.push(t),f=Math.max(f,e)}if(m&&WP[b]){e=!0;const t={visible:!0,symbolType:b};v?t.stroke=_:t.fill=_,f=Math.max(r.size,f),g.shape=t}else g.shape={visible:!1};return g.height=f,p+=f,uc(t)?m(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function d4(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=L({},e,t),d={};return d.fontFamily=i,d.fontSize=c4(n),d.color=s,d.textAlign=r,d.lineHeight=c4(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=c4(c),d}function u4(t,e){if(!t)return;const{size:i}=L({},e,t),n={};return n.width=c4(i),n}class p4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===p4.type}type=p4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return p4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=qo?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(p4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const g4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},f4={boxSizing:"border-box"},m4={display:"flex",whiteSpace:"nowrap"},y4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},_4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},v4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},b4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},x4={lineHeight:"normal"};class S4 extends p4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!WP[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=WP[e].pathStr;let o="currentColor";if(!n||f(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(d(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class w4 extends p4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class A4 extends p4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=$(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=$(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},y4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=L({},a?v4:_4,{height:c4(i[n].height),...t.keyColumn.item});f(r)&&""!==r?.trim?.()||v(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=L({},b4,{height:c4(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=L({},x4,{height:c4(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class k4 extends p4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new A4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new A4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new A4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(L({},m4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class M4 extends p4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new S4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new w4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(L({},g4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class C4 extends p4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&c(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new M4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new k4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},f4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class T4 extends h4{type=i4.dom;_tooltipContainer=qo?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(qo&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:d,lineWidth:u=0},padding:p,key:g,value:f,title:m,shape:y,enterable:_,spaceRow:v,transitionDuration:b}=t,x=i,S={panel:{width:c4((e?.panel?.width??0)+2*u),height:c4((e?.panel?.height??0)+2*u),paddingBottom:c4(p.bottom),paddingLeft:c4(p.left),paddingRight:c4(p.right),paddingTop:c4(p.top),borderColor:d,borderWidth:c4(u),borderRadius:c4(h),backgroundColor:x?`${x}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:_?"auto":"none",transitionDuration:b?`${b}ms`:"initial",transitionProperty:b?"transform":"initial",transitionTimingFunction:b?"ease-out":"initial"},title:d4(m),content:{},shapeColumn:{item:u4(y),width:c4(y.size),marginRight:c4(y.spacing??8)},keyColumn:{item:d4(g),width:c4(e?.keyWidth),marginRight:c4(g.spacing??26)},valueColumn:{item:d4(f),width:c4(e?.valueWidth),marginRight:c4(f.spacing??0)},spaceRow:c4(v)};if(c(v)){const t=v/2;[S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((e=>{e.marginTop=c4(t),e.marginBottom=e.marginTop})),S.content.marginTop=c4(-t),S.content.marginBottom=S.content.marginTop}else[S.content,S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return S}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class E4 extends h4{type=i4.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new CY({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?c(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class P4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&c(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??l4.success:l4.failed}class R4 extends P4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!xq(t)&&!h(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...X$(r,a)??[],...Z$(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(c(i))break}return c(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class B4 extends P4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const I4=t=>c(t)&&!m(t),D4=t=>c(t)&&m(t);class L4 extends Y2{static type=un.tooltip;type=un.tooltip;name=un.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!m(i))return new L4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new L4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?E4:T4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new B4(this),dimension:new R4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:GX.chart},this._handleMouseMove),(Jo(e)||Qo(e))&&(this._mountEvent("pointerdown",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;Zo(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||xq(t)||(n&&I4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&D4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):c(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!h(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),r};_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};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=L({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!c(t.visible)||t.visible,activeType:bq(t),renderMode:"html",trigger:c(t.trigger)?t.trigger:"hover",className:c(t.className)?t.className:"vchart-tooltip-element",enterable:!!c(t.enterable)&&t.enterable,transitionDuration:c(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=c(t.triggerOff)?t.triggerOff:this._spec.trigger,c(t.renderMode)?this._spec.renderMode=t.renderMode:Qo(this._option.mode)&&(this._spec.renderMode="canvas"),c(t.mark)&&(this._spec.mark={...R(t.mark),activeType:"mark"}),c(t.dimension)&&(this._spec.dimension={...R(t.dimension),activeType:"dimension"}),c(t.parentElement)?f(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Zo(this._option.mode)&&(this._spec.parentElement=qo?.body),c(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=vq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:WX.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(h(this._cacheInfo)||h(t))return!1;if(D4(t)){if(I4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>D$(t,e[i])))}if(D4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(c(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(c(n)&&c(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function O4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function F4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const z4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??O4(e)};let o=!1;return f(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??F4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class H4 extends Y2{static type=un.label;type=un.label;name=un.label;layoutType="absolute";layoutZIndex=r$.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new H4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(VX.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(hV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(hV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Ll(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:R$.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:R$.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{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}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=z4[s.type]??z4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return L({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class j4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(b(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:l(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&c(t.modelId)){if(c(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&c(t.modelKey)&&"modelIndex"in t&&c(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>N4(t))),a=s.filter((t=>!N4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>N4(t))),h=o.filter((t=>!N4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);b(o.width)||(o.width=a.width),b(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function N4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class V4 extends VK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&j$(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&N$(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var W4;W4={},L(xG.poptip,W4),Wk.load(CG),wK.useChart([J1,x2,Q1,t2,L2,S2,A2,k2,I2,E2,n2,O2,v2,b2,M2,N2,V2,r2,a2,C2,R2,B2,F2,i2,z2,H2,e2,D2,m2,P2,y2]),wK.useComponent([V3,G3,U3,$3,X3,Q3,o5,L4,x5,S5,Z2,q2,h5,p5,Y5,c5,X5,P5,H4,$5,Q2,J2,c3]),B$.registerLayout("grid",j4),B$.registerLayout("layout3d",V4),t.Arc3dMark=qJ,t.ArcMark=XJ,t.AreaChart=J1,t.AreaMark=vJ,t.AreaSeries=bJ,t.Bar3dChart=t2,t.Bar3dSeries=gJ,t.BarChart=Q1,t.BarSeries=ZZ,t.BaseChart=sq,t.BaseMark=KK,t.BaseSeries=Lq,t.BoxPlotChart=e2,t.BoxPlotMark=sJ,t.BoxPlotSeries=oJ,t.Brush=Q2,t.CartesianAxis=F3,t.CartesianBandAxis=G3,t.CartesianChart=rq,t.CartesianCrossHair=x5,t.CartesianLinearAxis=V3,t.CartesianSeries=Oq,t.CartesianTimeAxis=U3,t.CellMark=q1,t.CirclePackingChart=i2,t.CirclePackingSeries=T1,t.CircularProgressChart=M2,t.CircularProgressSeries=fQ,t.CommonChart=n2,t.ComponentMark=ZK,t.ContinuousLegend=o5,t.CustomMark=J2,t.DataZoom=Z2,t.DiscreteLegend=Q3,t.DotSeries=cQ,t.Factory=B$,t.Funnel3dChart=a2,t.Funnel3dSeries=N0,t.FunnelChart=r2,t.FunnelSeries=H0,t.GaugeChart=m2,t.GaugePointerSeries=X1,t.GaugeSeries=$1,t.GeoCoordinate=p5,t.GridLayout=j4,t.GroupMark=qK,t.HeatmapChart=y2,t.HeatmapSeries=Z1,t.Histogram3dChart=b2,t.HistogramChart=v2,t.Indicator=h5,t.Label=H4,t.Layout=VK,t.Layout3d=V4,t.LineChart=x2,t.LineMark=dJ,t.LineSeries=uJ,t.LinearProgressChart=C2,t.LinearProgressSeries=yQ,t.LinkPathMark=j1,t.LinkSeries=uQ,t.MapChart=S2,t.MapLabelComponent=c3,t.MapSeries=jJ,t.MarkArea=X5,t.MarkLine=Y5,t.MarkPoint=$5,t.PathMark=OJ,t.Pie3dChart=k2,t.Pie3dSeries=ZJ,t.PieChart=A2,t.PieSeries=KJ,t.Player=P5,t.PolarAxis=Y3,t.PolarBandAxis=$3,t.PolarChart=g2,t.PolarCrossHair=S5,t.PolarLinearAxis=X3,t.PolarSeries=NJ,t.PolygonMark=z0,t.ProgressArcMark=gQ,t.ProgressLikeChart=f2,t.ProgressLikeSeries=pQ,t.Pyramid3dMark=j0,t.RadarChart=E2,t.RadarSeries=aQ,t.RangeAreaChart=P2,t.RangeAreaSeries=SJ,t.RangeColumn3dChart=B2,t.RangeColumn3dSeries=_J,t.RangeColumnChart=R2,t.RangeColumnSeries=yJ,t.Rect3dMark=pJ,t.RectMark=KZ,t.RoseChart=I2,t.RoseLikeChart=T2,t.RoseLikeSeries=sQ,t.RoseSeries=rQ,t.RuleMark=JZ,t.SankeyChart=D2,t.SankeySeries=N1,t.ScatterChart=L2,t.ScatterSeries=nQ,t.ScrollBar=q2,t.SequenceChart=O2,t.SunburstChart=F2,t.SunburstSeries=k1,t.SymbolMark=aJ,t.TextMark=qZ,t.ThemeManager=v$,t.Title=c5,t.Tooltip=L4,t.TreeMapChart=z2,t.TreeMapSeries=Y1,t.VChart=wK,t.WaterfallChart=H2,t.WaterfallSeries=QZ,t.WordCloud3dChart=V2,t.WordCloud3dSeries=S0,t.WordCloudChart=N2,t.WordCloudSeries=x0,t.default=wK,t.version="1.1.0",Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).VChart={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var i=function t(){if(this instanceof t){var i=[null];return i.push.apply(i,arguments),new(Function.bind.apply(e,i))}return e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),i}var s={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}]`,o=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||a(t,"Boolean")},l=t=>"function"==typeof t,h=t=>null==t,c=t=>null!=t,d=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e},u=t=>"object"==typeof t&&null!==t,p=function(t){if(!u(t)||!a(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},g=t=>void 0===t,f=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||a(t,"String")},m=t=>Array.isArray?Array.isArray(t):a(t,"Array"),y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)},_=t=>a(t,"Date"),v=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||a(t,"Number")},b=t=>v(t)&&Number.isFinite(t),x=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t),S=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,"")),w=Object.prototype,A=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||w)},k=Object.prototype.hasOwnProperty;function M(t){if(h(t))return!0;if(y(t))return!t.length;const e=S(t);if("Map"===e||"Set"===e)return!t.size;if(A(t))return!Object.keys(t).length;for(const e in t)if(k.call(t,e))return!1;return!0}const C=(t,e,i)=>{const n=f(e)?e.split("."):e;for(let e=0;enull!=t&&T.call(t,e);function P(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,o){if(null===i)return null;if(0===o)return i;let l;if("object"!=typeof i)return i;if(m(i)?l=[]:a(i,"RegExp")?(l=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(l.lastIndex=i.lastIndex)):l=_(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(l)}for(const e in i)l[e]=t(i[e],o-1);return l}(t,i)}function R(t){let e;if(!c(t)||"object"!=typeof t)return t;const i=m(t),n=t.length;e=i?new Array(n):"object"==typeof t?{}:o(t)||v(t)||f(t)?t:_(t)?new Date(+t):void 0;const s=i?void 0:Object.keys(Object(t));let r=-1;if(e)for(;++r<(s||t).length;){const i=s?s[r]:r,n=t[i];e[i]=R(n)}return e}function B(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){if(t===e)return;if(c(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];c(n[r])&&"object"==typeof n[r]?I(t,e,r,i):D(t,r,n[r])}}}}function I(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t[i],r=e[i];let a=e[i],o=!0;if(m(r)){if(n)a=[];else if(m(s))a=s;else if(y(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t=0;i--)if(!z(t[i],e[i]))return!1;return!0}if(!p(t))return!1;const i=F(t),n=F(e);if(i.length!==n.length)return!1;i.sort(),n.sort();for(let t=i.length-1;t>=0;t--)if(i[t]!=n[t])return!1;for(let n=i.length-1;n>=0;n--){const s=i[n];if(!z(t[s],e[s]))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;s2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const n=Object.getOwnPropertyNames(e);for(let s=0;sMath.min(t,e)),1/0)}function G(t,e){if(!m(t)||!m(e))return!1;if(t.length!==e.length)return!1;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Math.random,s=t.length;for(;s;)e=Math.floor(n()*s),i=t[--s],t[s]=t[e],t[e]=i;return t}function Y(t,e,i){c(e)||(e=t,t=0),c(i)||(i=1);let n=-1;const s=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(s);for(;++ne?1:t>=e?0:NaN}function $(t){return Number(t)}function K(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$;const n=t.length;if(!n)return;if(e<=0||n<2)return i(t[0],0,t);if(e>=1)return i(t[n-1],n-1,t);const s=(n-1)*e,r=Math.floor(s),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(s-r)}function q(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;for(h(n)&&(n=t.length);i>>1;X(t[s],e)>0?n=s:i=s+1}return i}const Z=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(X)),K(i,.5)},J=Math.sqrt(50),Q=Math.sqrt(10),et=Math.sqrt(2);function it(t,e,i){const n=Math.abs(e-t)/Math.max(0,i);let s=Math.pow(10,Math.floor(Math.log(n)/Math.LN10));const r=n/s;return r>=J?s*=10:r>=Q?s*=5:r>=et&&(s*=2),e3&&void 0!==arguments[3]?arguments[3]:nt,n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:st)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,n)}function at(t,e,i,n){return t>e&&!rt(t,e,i,n)}function ot(t,e,i,n){return t1&&void 0!==arguments[1]?arguments[1]:0)-1;for(;i>=0;)e=`${e}${t}`,i-=1;return e},ht=function(t,e){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"right";const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:" ",s=t+"",r=e-s.length;return r<=0?s:"left"===i?lt(n,r)+s:"center"===i?lt(n,Math.floor(r/2))+s+lt(n,Math.ceil(r/2)):s+lt(n,r)},ct=function(t,e,i){return ti?i:t},dt=(t,e,i)=>{let[n,s]=t;s=i-e?[e,i]:(n=Math.min(Math.max(n,e),i-r),[n,n+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let n,s,r,a,o,l,h=0,c=!1,u=!1,p=!0;const g=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=n,r=s;return n=s=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function y(t){const i=t-l;return void 0===l||i>=e||i<0||u&&t-h>=r}function _(){const t=Date.now();if(y(t))return v(t);o=m(_,function(t){const i=t-h,n=e-(t-l);return u?Math.min(n,r-i):n}(t))}function v(t){return o=void 0,p&&n?f(t):(n=s=void 0,a)}function x(){const t=Date.now(),i=y(t);for(var r=arguments.length,d=new Array(r),p=0;pt*(1-i)+e*i}function yt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const _t=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vt=new RegExp(_t.source,"g");const bt=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;function xt(t){if(t instanceof Date)return t;if(f(t)){const e=bt.exec(t);if(!e)return new Date(NaN);if(!e[8])return new Date(+e[1],+(e[2]||1)-1,+e[3]||1,+e[4]||0,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0);let i=+e[4]||0;return"Z"!==e[8].toUpperCase()&&(i-=+e[8].slice(0,3)),new Date(Date.UTC(+e[1],+(e[2]||1)-1,+e[3]||1,i,+(e[5]||0),+e[6]||0,e[7]?+e[7].substring(0,3):0))}return h(t)?new Date(NaN):new Date(Math.round(t))}const St=1e-12,wt=Math.PI,At=wt/2,kt=2*wt,Mt=2*Math.PI,Ct=Math.abs,Tt=Math.atan2,Et=Math.cos,Pt=Math.max,Rt=Math.min,Bt=Math.sin,It=Math.sqrt,Dt=Math.pow;function Lt(t){return t>1?0:t<-1?wt:Math.acos(t)}function Ot(t){return t>=1?At:t<=-1?-At:Math.asin(t)}function Ft(t,e,i,n,s){let r,a;return"number"==typeof t&&"number"==typeof i&&(r=(1-s)*t+s*i),"number"==typeof e&&"number"==typeof n&&(a=(1-s)*e+s*n),{x:r,y:a}}function zt(t,e){return t[0]*e[1]-t[1]*e[0]}class Ht{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=n}clone(){return new Ht(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 v(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return v(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 jt{static distancePP(t,e){return It(Dt(t.x-e.x,2)+Dt(t.y-e.y,2))}static distanceNN(t,e,i,n){return It(Dt(t-i,2)+Dt(e-n,2))}static distancePN(t,e,i){return It(Dt(e-t.x,2)+Dt(i-t.y,2))}static pointAtPP(t,e,i){return new Ht((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Nt(t,e,i){const{x1:n,y1:s,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*n+i.c*s+i.e,i.b*n+i.d*s+i.f),t.add(i.a*r+i.c*s+i.e,i.b*r+i.d*s+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*n+i.c*a+i.e,i.b*n+i.d*a+i.f),e)}class Vt{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Vt(this)}clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this}empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=n,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return m(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.rotatedPoints(t,e,i);return this.clear().add(n[0],n[1]).add(n[2],n[3]).add(n[4],n[5]).add(n[6],n[7])}scale(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const s=this.scalePoints(t,e,i,n);return this.clear().add(s[0],s[1]).add(s[2],s[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Nt(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 Wt extends Vt{}function Gt(t){return t*(Math.PI/180)}function Ut(t){return 180*t/Math.PI}const Yt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-kt;)t+=kt;else if(t>0)for(;t>kt;)t-=kt;return t},Xt=Yt;function $t(t,e,i){return{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}}function Kt(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}class qt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,n,s,r){return!(this.e!==s||this.f!==r||this.a!==t||this.d!==n||this.b!==e||this.c!==i)}setValue(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.e=s,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,n=this.d,s=this.e,r=this.f,a=new qt,o=t*n-e*i;return a.a=n/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-n*s)/o,a.f=-(t*r-e*s)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a*e+this.c*i,s=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=n,this.b=s,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const n=Math.cos(t),s=Math.sin(t),r=(1-n)*e+s*i,a=(1-n)*i-s*e,o=n*this.a-s*this.b,l=s*this.a+n*this.b,h=n*this.c-s*this.d,c=s*this.c+n*this.d,d=n*this.e-s*this.f+r,u=s*this.e+n*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,n,s,r){return this.multiply(t,e,i,n,s,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:n,e:s,f:r}=this;return this.a=e,this.b=t,this.c=n,this.d=i,this.e=r,this.f=s,this}multiply(t,e,i,n,s,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*n,p=o*i+h*n,g=a*s+l*r+this.e,f=o*s+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new qt;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:n,c:s,d:r,e:a,f:o}=this,l=i*r-n*s,h=r/l,c=-n/l,d=-s/l,u=i/l,p=(s*o-r*a)/l,g=-(i*o-n*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new qt(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=Ut(r.rotateDeg),r}}function Zt(t,e,i){e/=100,i/=100;const n=(1-Math.abs(2*i-1))*e,s=n*(1-Math.abs(t/60%2-1)),r=i-n/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=n,o=s,l=0):60<=t&&t<120?(a=s,o=n,l=0):120<=t&&t<180?(a=0,o=n,l=s):180<=t&&t<240?(a=0,o=s,l=n):240<=t&&t<300?(a=s,o=0,l=n):300<=t&&t<360&&(a=n,o=0,l=s),a=Math.round(255*(a+r)),o=Math.round(255*(o+r)),l=Math.round(255*(l+r)),{r:a,g:o,b:l}}function Jt(t,e,i){t/=255,e/=255,i/=255;const n=Math.min(t,e,i),s=Math.max(t,e,i),r=s-n;let a=0,o=0,l=0;return a=0===r?0:s===t?(e-i)/r%6:s===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(s+n)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Qt=/^#([0-9a-f]{3,8})$/,te={transparent:4294967040},ee={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ie(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ne(t){return v(t)?new re(t>>16,t>>8&255,255&t,1):m(t)?new re(t[0],t[1],t[2]):new re(255,255,255)}let se=class t{static Brighter(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).brighter(i).toRGBA()}static SetOpacity(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===i?e:new t(e).setOpacity(i).toRGBA()}static getColorBrightness(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const n=e instanceof t?e:new t(e);switch(i){case"hsv":default:return n.getHSVBrightness();case"hsl":return n.getHSLBrightness();case"lum":return n.getLuminance();case"lum2":return n.getLuminance2();case"lum3":return n.getLuminance3()}}static parseColorString(t){if(c(te[t]))return function(t){return v(t)?new re(t>>>24,t>>>16&255,t>>>8&255,255&t):m(t)?new re(t[0],t[1],t[2],t[3]):new re(255,255,255,1)}(te[t]);if(c(ee[t]))return ne(ee[t]);const e=`${t}`.trim().toLowerCase(),i=Qt.exec(e);if(i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new re((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ne(t):8===e?new re(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):void 0}if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new re(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=Zt(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new re(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(e){const i=t.parseColorString(e);i?this.color=i:(console.warn(`Warn: 传入${e}无法解析为Color`),this.color=new re(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,this}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}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return.5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const n=this.color.opacity,s=Jt(this.color.r,this.color.g,this.color.b),r=Zt(h(t)?s.h:ct(t,0,360),h(e)?s.s:e>=0&&e<=1?100*e:e,h(i)?s.l:i<=1&&i>=0?100*i:i);return this.color=new re(r.r,r.g,r.b,n),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}};class re{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)),c(n)?this.opacity=isNaN(+n)?1:Math.max(0,Math.min(1,+n)):this.opacity=1}formatHex(){return`#${ie(this.r)+ie(this.g)+ie(this.b)+(1===this.opacity?"":ie(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:n}=Jt(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${n}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ae(t){let e="",i="",n="";const s="#"===t[0]?1:0;for(let r=s;r{const e=Math.round(i*(1-t)+n*t),c=Math.round(s*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new re(e,c,d,l*(1-t)+h*t)}},rgbToHex:oe,rgbToHsl:Jt});function he(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}let ce,de,ue,pe,ge,fe,me,ye;function _e(t,e,i,n){let s,r=t[0],a=e[0],o=i[0],l=n[0];return a=0&&o<=1&&[t[0]+s[0]*o,t[1]+s[1]*o]}function be(t,e,i){return null===t?e:null===e?t:(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,i&&(ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>=fe||de<=ge||ue>=ye||pe<=me?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(ce,ge),y1:Math.max(ue,me),x2:Math.min(de,fe),y2:Math.min(pe,ye)})}var xe;function Se(t,e,i){return!(t&&e&&(i?(ce=t.x1,de=t.x2,ue=t.y1,pe=t.y2,ge=e.x1,fe=e.x2,me=e.y1,ye=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me]),ce>fe||deye||pee.x2||t.x2e.y2||t.y22&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-s.x)*Math.cos(e)+(n-s.y)*Math.sin(e)+s.x,y:(i-s.x)*Math.sin(e)+(s.y-n)*Math.cos(e)+s.y}}function ke(t){return t/180*Math.PI}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?t.angle:ke(t.angle),n=Me(t);return[Ae({x:t.x1,y:t.y1},i,n),Ae({x:t.x2,y:t.y1},i,n),Ae({x:t.x2,y:t.y2},i,n),Ae({x:t.x1,y:t.y2},i,n)]}let Te,Ee,Pe,Re;function Be(t){return Te=1/0,Ee=1/0,Pe=-1/0,Re=-1/0,t.forEach((t=>{Te>t.x&&(Te=t.x),Pet.y&&(Ee=t.y),Ree&&r>n||rs?o:0}function Fe(t,e){return Math.abs(t-e){let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,n=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,n=e<<10|i,n+=65536),12288===n||65281<=n&&n<=65376||65504<=n&&n<=65510?"F":8361===n||65377<=n&&n<=65470||65474<=n&&n<=65479||65482<=n&&n<=65487||65490<=n&&n<=65495||65498<=n&&n<=65500||65512<=n&&n<=65518?"H":4352<=n&&n<=4447||4515<=n&&n<=4519||4602<=n&&n<=4607||9001<=n&&n<=9002||11904<=n&&n<=11929||11931<=n&&n<=12019||12032<=n&&n<=12245||12272<=n&&n<=12283||12289<=n&&n<=12350||12353<=n&&n<=12438||12441<=n&&n<=12543||12549<=n&&n<=12589||12593<=n&&n<=12686||12688<=n&&n<=12730||12736<=n&&n<=12771||12784<=n&&n<=12830||12832<=n&&n<=12871||12880<=n&&n<=13054||13056<=n&&n<=19903||19968<=n&&n<=42124||42128<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||55216<=n&&n<=55238||55243<=n&&n<=55291||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65106||65108<=n&&n<=65126||65128<=n&&n<=65131||110592<=n&&n<=110593||127488<=n&&n<=127490||127504<=n&&n<=127546||127552<=n&&n<=127560||127568<=n&&n<=127569||131072<=n&&n<=194367||177984<=n&&n<=196605||196608<=n&&n<=262141?"W":32<=n&&n<=126||162<=n&&n<=163||165<=n&&n<=166||172===n||175===n||10214<=n&&n<=10221||10629<=n&&n<=10630?"Na":161===n||164===n||167<=n&&n<=168||170===n||173<=n&&n<=174||176<=n&&n<=180||182<=n&&n<=186||188<=n&&n<=191||198===n||208===n||215<=n&&n<=216||222<=n&&n<=225||230===n||232<=n&&n<=234||236<=n&&n<=237||240===n||242<=n&&n<=243||247<=n&&n<=250||252===n||254===n||257===n||273===n||275===n||283===n||294<=n&&n<=295||299===n||305<=n&&n<=307||312===n||319<=n&&n<=322||324===n||328<=n&&n<=331||333===n||338<=n&&n<=339||358<=n&&n<=359||363===n||462===n||464===n||466===n||468===n||470===n||472===n||474===n||476===n||593===n||609===n||708===n||711===n||713<=n&&n<=715||717===n||720===n||728<=n&&n<=731||733===n||735===n||768<=n&&n<=879||913<=n&&n<=929||931<=n&&n<=937||945<=n&&n<=961||963<=n&&n<=969||1025===n||1040<=n&&n<=1103||1105===n||8208===n||8211<=n&&n<=8214||8216<=n&&n<=8217||8220<=n&&n<=8221||8224<=n&&n<=8226||8228<=n&&n<=8231||8240===n||8242<=n&&n<=8243||8245===n||8251===n||8254===n||8308===n||8319===n||8321<=n&&n<=8324||8364===n||8451===n||8453===n||8457===n||8467===n||8470===n||8481<=n&&n<=8482||8486===n||8491===n||8531<=n&&n<=8532||8539<=n&&n<=8542||8544<=n&&n<=8555||8560<=n&&n<=8569||8585===n||8592<=n&&n<=8601||8632<=n&&n<=8633||8658===n||8660===n||8679===n||8704===n||8706<=n&&n<=8707||8711<=n&&n<=8712||8715===n||8719===n||8721===n||8725===n||8730===n||8733<=n&&n<=8736||8739===n||8741===n||8743<=n&&n<=8748||8750===n||8756<=n&&n<=8759||8764<=n&&n<=8765||8776===n||8780===n||8786===n||8800<=n&&n<=8801||8804<=n&&n<=8807||8810<=n&&n<=8811||8814<=n&&n<=8815||8834<=n&&n<=8835||8838<=n&&n<=8839||8853===n||8857===n||8869===n||8895===n||8978===n||9312<=n&&n<=9449||9451<=n&&n<=9547||9552<=n&&n<=9587||9600<=n&&n<=9615||9618<=n&&n<=9621||9632<=n&&n<=9633||9635<=n&&n<=9641||9650<=n&&n<=9651||9654<=n&&n<=9655||9660<=n&&n<=9661||9664<=n&&n<=9665||9670<=n&&n<=9672||9675===n||9678<=n&&n<=9681||9698<=n&&n<=9701||9711===n||9733<=n&&n<=9734||9737===n||9742<=n&&n<=9743||9748<=n&&n<=9749||9756===n||9758===n||9792===n||9794===n||9824<=n&&n<=9825||9827<=n&&n<=9829||9831<=n&&n<=9834||9836<=n&&n<=9837||9839===n||9886<=n&&n<=9887||9918<=n&&n<=9919||9924<=n&&n<=9933||9935<=n&&n<=9953||9955===n||9960<=n&&n<=9983||10045===n||10071===n||10102<=n&&n<=10111||11093<=n&&n<=11097||12872<=n&&n<=12879||57344<=n&&n<=63743||65024<=n&&n<=65039||65533===n||127232<=n&&n<=127242||127248<=n&&n<=127277||127280<=n&&n<=127337||127344<=n&&n<=127386||917760<=n&&n<=917999||983040<=n&&n<=1048573||1048576<=n&&n<=1114109?"A":"N"};class He{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(),c(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=c(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(h(this._canvas)&&(c(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),h(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&c(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),h(this._context)&&c(this._canvas)){const t=this._canvas.getContext("2d");c(t)&&(t.save(),t.font=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{fontStyle:i=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:s=e.fontWeight,fontSize:r=e.fontSize,fontFamily:a=e.fontFamily}=t;return(i?i+" ":"")+(n?n+" ":"")+(s?s+" ":"")+r+"px "+(a||"sans-serif")}(this.textSpec),this._contextSaved=!0,this._context=t)}return!h(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:n={}}=this._option,{fontStyle:s=n.fontStyle,fontVariant:r=n.fontVariant,fontWeight:a=(null!==(t=n.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=n.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=n.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g,lineHeight:f=o}=this._userSpec;return{fontStyle:s,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(h(t))return{width:0,height:0};if(h(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 c;try{const h=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:n,textAlign:s,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});c={width:h.width(),height:h.height()}}catch(e){this._notSupportVRender=!0,c=this.measureWithNaiveCanvas(t)}return c}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const e=this._context.measureText(t),{fontSize:i,lineHeight:n}=this.textSpec;return{width:e.width,height:null!=n?n:i}}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===r.length?s:1===r.length?e(r[0]):{width:r.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:r.length*((null!=n?n:i)+1)+1}}return e(t.toString())}_measureNumberChar(){if(h(this._numberCharSize)){const t=this._standardMethod(He.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/He.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return h(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(He.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(h(this._letterCharSize)){const t=this._standardMethod(He.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/He.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return c(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){c(this._canvas)&&(this._canvas=null),c(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}He.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",He.NUMBERS_CHAR_SET="0123456789",He.FULL_SIZE_CHAR="字";const je="undefined"!=typeof console;function Ne(t,e,i){const n=[e].concat([].slice.call(i));je&&console[t].apply(console,n)}var Ve;!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"}(Ve||(Ve={}));class We{static getInstance(t,e){return We._instance&&v(t)?We._instance.level(t):We._instance||(We._instance=new We(t,e)),We._instance}static setInstance(t){return We._instance=t}static setInstanceLevel(t){We._instance?We._instance.level(t):We._instance=new We(t)}static clearInstance(){We._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=Ve.Info}canLogDebug(){return this._level>=Ve.Debug}canLogError(){return this._level>=Ve.Error}canLogWarn(){return this._level>=Ve.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),n=0;n=Ve.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):Ne(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Warn&&Ne(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Info&&Ne(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=Ve.Debug&&Ne(this._method||"log","DEBUG",e),this}}function Ge(t){if(b(t))return[t,t,t,t];if(m(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(d(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 Ue(t){return t?"getUTCFullYear":"getFullYear"}function Ye(t){return t?"getUTCMonth":"getMonth"}function Xe(t){return t?"getUTCDate":"getDate"}function $e(t){return t?"getUTCHours":"getHours"}function Ke(t){return t?"getUTCMinutes":"getMinutes"}function qe(t){return t?"getUTCSeconds":"getSeconds"}function Ze(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Je(t){return t?"setUTCFullYear":"setFullYear"}We._instance=null;const Qe=1e3,ti=6e4,ei=36e5,ii=24*ei,ni=31*ii,si=365*ii,ri=t=>(t.setMonth(0,1),t.setHours(0,0,0,0),t),ai=(t,e)=>(t.setFullYear(t.getFullYear()+e),t),oi=(t,e)=>e.getFullYear()-t.getFullYear(),li=t=>t.getFullYear(),hi=t=>(t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0),t),ci=(t,e)=>(t.setUTCFullYear(t.getUTCFullYear()+e),t),di=(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),ui=t=>t.getUTCFullYear(),pi=t=>(t.setDate(1),t.setHours(0,0,0,0),t),gi=(t,e)=>(t.setMonth(t.getMonth()+e),t),fi=(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),mi=t=>t.getMonth(),yi=t=>(t.setUTCDate(1),t.setUTCHours(0,0,0,0),t),_i=(t,e)=>(t.setUTCMonth(t.getUTCMonth()+e),t),vi=(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),bi=t=>t.getUTCMonth(),xi=t=>(t.setHours(0,0,0,0),t),Si=(t,e)=>(t.setDate(t.getDate()+e),t),wi=(t,e)=>(+e-+t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ii,Ai=t=>t.getDate()-1,ki=t=>(t.setUTCHours(0,0,0,0),t),Mi=(t,e)=>(t.setUTCDate(t.getUTCDate()+e),t),Ci=(t,e)=>(+e-+t)/ii,Ti=t=>t.getUTCDate()-1,Ei=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes()),t),Pi=(t,e)=>(t.setHours(t.getHours()+e),t),Ri=(t,e)=>(+e-+t)/ei,Bi=t=>t.getHours(),Ii=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()-6e4*t.getUTCMinutes()),t),Di=(t,e)=>(t.setUTCHours(t.getUTCHours()+e),t),Li=t=>t.getUTCHours(),Oi=t=>(t.setTime(+t-t.getMilliseconds()-1e3*t.getSeconds()),t),Fi=(t,e)=>(t.setMinutes(t.getMinutes()+e),t),zi=(t,e)=>(+e-+t)/6e4,Hi=t=>t.getMinutes(),ji=t=>(t.setTime(+t-t.getUTCMilliseconds()-1e3*t.getUTCSeconds()),t),Ni=(t,e)=>(t.setUTCMinutes(t.getUTCMinutes()+e),t),Vi=t=>t.getUTCMinutes(),Wi=t=>(t.setTime(+t-t.getMilliseconds()),t),Gi=(t,e)=>(t.setSeconds(t.getSeconds()+e),t),Ui=(t,e)=>(+e-+t)/1e3,Yi=t=>t.getSeconds(),Xi=t=>(t.setTime(+t-t.getUTCMilliseconds()),t),$i=(t,e)=>(t.setUTCSeconds(t.getUTCSeconds()+e),t),Ki=t=>t.getUTCSeconds(),qi=t=>t,Zi=(t,e)=>(t.setTime(+t+e),t),Ji=(t,e)=>+e-+t,Qi=(t,e)=>i=>{const n=new Date(+i-1);return e(n,1),t(n),n},tn=(t,e)=>{let{floor:i,offset:n,field:s,count:r}=e;const a=Math.floor(t);if(!Number.isFinite(a)||a<=0)return null;if(a<=1)return{floor:i,offset:n,ceil:Qi(i,n)};const o=((t,e)=>(i,n)=>{const s=new Date,r=new Date;return s.setTime(+i),r.setTime(+n),t(s),t(r),Math.floor(e(s,r))})(i,r),l=s?t=>s(t)%a==0:t=>o(0,t)%a==0,h=t=>{if(!Number.isNaN(+t))for(i(t);!l(t);)t.setTime(+t-1),i(t);return t},c=(t,e)=>{if(!Number.isNaN(+t))if(a<0)for(;++e<=0;)for(n(t,-1);!l(t);)n(t,-1);else for(;--e>=0;)for(n(t,1);!l(t);)n(t,1);return t};return{floor:h,offset:c,ceil:Qi(h,c)}};function en(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:n};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const s=e(t),r=parseFloat(s.width)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)||t.clientWidth-1,a=parseFloat(s.height)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)||t.clientHeight-1;return{width:r<=0?i:r,height:a<=0?n:a}}function nn(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}var sn=6371008.8,rn={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*sn,kilometers:6371.0088,kilometres:6371.0088,meters:sn,metres:sn,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:sn/1852,radians:1,yards:6967335.223679999};function an(t,e,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=e||{},n.geometry=t,n}function on(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ln(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,n=i.type,s=e.bbox;var r;let a=i.coordinates;if(s&&!0===function(t,e,i){return!e||(i?(ce=e.x1,de=e.x2,ue=e.y1,pe=e.y2,ce>de&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),t.x>=ce&&t.x<=de&&t.y>=ue&&t.y<=pe):t.x>=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2)}(t,{x1:s[0],x2:s[1],y1:s[1],y2:s[3]},!0))return!1;"Polygon"===n&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function hn(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=Gt(t[0]),r=Gt(t[1]),a=Gt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=rn[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,n.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Ut(s+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Ut(l)}}const cn=t=>t;var dn,un;t.RenderModeEnum=void 0,(dn=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",dn["mobile-browser"]="mobile-browser",dn.node="node",dn.worker="worker",dn.miniApp="miniApp",dn["desktop-miniApp"]="desktop-miniApp",dn.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(un||(un={}));for(let t=0;t<256;t++)t.toString(16);const pn=(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t};function gn(){return new fn}function fn(){this.reset()}fn.prototype={constructor:fn,reset:function(){this.s=this.t=0},add:function(t){yn(mn,t,this.t),yn(this,mn.s,this.s),this.s?this.t+=mn.t:this.s=mn.t},valueOf:function(){return this.s}};var mn=new fn;function yn(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var _n=1e-6,vn=Math.PI,bn=vn/2,xn=vn/4,Sn=2*vn,wn=180/vn,An=vn/180,kn=Math.abs,Mn=Math.atan,Cn=Math.atan2,Tn=Math.cos,En=Math.exp,Pn=Math.log,Rn=Math.pow,Bn=Math.sin,In=Math.sign||function(t){return t>0?1:t<0?-1:0},Dn=Math.sqrt,Ln=Math.tan;function On(t){return t>1?0:t<-1?vn:Math.acos(t)}function Fn(t){return t>1?bn:t<-1?-bn:Math.asin(t)}function zn(){}function Hn(t,e){t&&Nn.hasOwnProperty(t.type)&&Nn[t.type](t,e)}var jn={Feature:function(t,e){Hn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nvn?t+Math.round(-t/Sn)*Sn:t,e]}function ts(t,e,i){return(t%=Sn)?e||i?Jn(is(t),ns(e,i)):is(t):e||i?ns(e,i):Qn}function es(t){return function(e,i){return[(e+=t)>vn?e-Sn:e<-vn?e+Sn:e,i]}}function is(t){var e=es(t);return e.invert=es(-t),e}function ns(t,e){var i=Tn(t),n=Bn(t),s=Tn(e),r=Bn(e);function a(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*i+o*n;return[Cn(l*s-c*r,o*i-h*n),Fn(c*s+l*r)]}return a.invert=function(t,e){var a=Tn(e),o=Tn(t)*a,l=Bn(t)*a,h=Bn(e),c=h*s-l*r;return[Cn(l*s+h*r,o*i+c*n),Fn(c*i-o*n)]},a}function ss(t,e){(e=Yn(e))[0]-=t,Zn(e);var i=On(-e[1]);return((-e[2]<0?-i:i)+Sn-_n)%Sn}function rs(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:zn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function as(t,e){return kn(t[0]-e[0])<_n&&kn(t[1]-e[1])<_n}function os(t,e,i,n){this.x=t,this.z=e,this.o=i,this.e=n,this.v=!1,this.n=this.p=null}function ls(t,e,i,n,s){var r,a,o=[],l=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,i,n=t[0],a=t[e];if(as(n,a)){if(!n[2]&&!a[2]){for(s.lineStart(),r=0;r=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function hs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function ps(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function gs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=rs(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=y,u.lineStart=_,u.lineEnd=v,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=ps(a);var t=function(t,e){var i=ds(e),n=e[1],s=Bn(n),r=[Bn(i),-Tn(i),0],a=0,o=0;cs.reset(),1===s?n=bn+_n:-1===s&&(n=-bn-_n);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>vn,C=f*x;if(cs.add(Cn(C*A*Bn(k),m*S+C*Tn(k))),a+=M?w+A*Sn:w,M^p>=i^v>=i){var T=$n(Yn(u),Yn(_));Zn(T);var E=$n(r,T);Zn(E);var P=(M^w>=0?-1:1)*Fn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-_n||a<_n&&cs<-_n)^1&o}(r,n);a.length?(d||(s.polygonStart(),d=!0),ls(a,ms,t,i,s)):t&&(d||(s.polygonStart(),d=!0),s.lineStart(),i(null,null,1,s),s.lineEnd()),d&&(s.polygonEnd(),d=!1),a=r=null},sphere:function(){s.polygonStart(),s.lineStart(),i(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function p(e,i){t(e,i)&&s.point(e,i)}function g(t,e){l.point(t,e)}function f(){u.point=g,l.lineStart()}function m(){u.point=p,l.lineEnd()}function y(t,e){o.push([t,e]),c.point(t,e)}function _(){c.lineStart(),o=[]}function v(){y(o[0][0],o[0][1]),c.lineEnd();var t,e,i,n,l=c.clean(),u=h.result(),p=u.length;if(o.pop(),r.push(o),o=null,p)if(1&l){if((e=(i=u[0]).length-1)>0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(fs))}return u}}function fs(t){return t.length>1}function ms(t,e){return((t=t.x)[0]<0?t[1]-bn-_n:bn-t[1])-((e=e.x)[0]<0?e[1]-bn-_n:bn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return us(e(t),i)})}(us);var ys=gs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?vn:-vn,l=kn(r-i);kn(l-vn)<_n?(t.point(i,n=(n+a)/2>0?bn:-bn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=vn&&(kn(i-s)<_n&&(i-=s*_n),kn(r-o)<_n&&(r-=o*_n),n=function(t,e,i,n){var s,r,a=Bn(t-i);return kn(a)>_n?Mn((Bn(e)*(r=Tn(n))*Bn(i)-Bn(n)*(s=Tn(e))*Bn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*bn,n.point(-vn,s),n.point(0,s),n.point(vn,s),n.point(vn,0),n.point(vn,-s),n.point(0,-s),n.point(-vn,-s),n.point(-vn,0),n.point(-vn,s);else if(kn(t[0]-e[0])>_n){var r=t[0]0,s=kn(e)>_n;function r(t,i){return Tn(t)*Tn(i)>e}function a(t,i,n){var s=[1,0,0],r=$n(Yn(t),Yn(i)),a=Xn(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=$n(s,r),u=qn(s,h);Kn(u,qn(r,c));var p=d,g=Xn(u,p),f=Xn(p,p),m=g*g-f*(Xn(u,u)-1);if(!(m<0)){var y=Dn(m),_=qn(p,(-g-y)/f);if(Kn(_,u),_=Un(_),!n)return _;var v,b=t[0],x=i[0],S=t[1],w=i[1];x0^_[1]<(kn(_[0]-b)<_n?S:w):S<=_[1]&&_[1]<=w:A>vn^(b<=_[0]&&_[0]<=x)){var M=qn(p,(-g+y)/f);return Kn(M,u),[_,Un(M)]}}}function o(e,i){var s=n?t:vn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return gs(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=n?f?0:o(d,u):f?o(d+(d<0?vn:-vn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||as(e,p)||as(g,p))&&(g[2]=1),f!==l)c=0,f?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(s&&e&&n^f){var y;m&i||!(y=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!f||e&&as(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Tn(e),o=Bn(e),l=n*i;null==s?(s=e+n*Sn,r=e-l/2):(s=ss(a,s),r=ss(a,r),(n>0?sr)&&(s+=n*Sn));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return kn(n[0]-t)<_n?s>0?0:3:kn(n[0]-i)<_n?s>0?2:1:kn(n[1]-e)<_n?s>0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,y,_,v=a,b=rs(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);y=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&v.lineEnd()},polygonStart:function(){v=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,s=(l=ps(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&ls(l,o,e,r,a),a.polygonEnd());v=a,l=h=c=null}};function S(t,e){s(t,e)&&v.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),y)d=r,u=a,p=o,y=!1,o&&(v.lineStart(),v.point(r,a));else if(o&&m)v.point(r,a);else{var l=[g=Math.max(bs,Math.min(vs,g)),f=Math.max(bs,Math.min(vs,f))],b=[r=Math.max(bs,Math.min(vs,r)),a=Math.max(bs,Math.min(vs,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(v.lineStart(),v.point(r,a),_=!1):(m||(v.lineStart(),v.point(l[0],l[1])),v.point(b[0],b[1]),o||v.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ss(t){return t}var ws,As,ks,Ms,Cs=gn(),Ts=gn(),Es={point:zn,lineStart:zn,lineEnd:zn,polygonStart:function(){Es.lineStart=Ps,Es.lineEnd=Is},polygonEnd:function(){Es.lineStart=Es.lineEnd=Es.point=zn,Cs.add(kn(Ts)),Ts.reset()},result:function(){var t=Cs/2;return Cs.reset(),t}};function Ps(){Es.point=Rs}function Rs(t,e){Es.point=Bs,ws=ks=t,As=Ms=e}function Bs(t,e){Ts.add(Ms*t-ks*e),ks=t,Ms=e}function Is(){Bs(ws,As)}var Ds=Es,Ls=1/0,Os=Ls,Fs=-Ls,zs=Fs,Hs={point:function(t,e){tFs&&(Fs=t);ezs&&(zs=e)},lineStart:zn,lineEnd:zn,polygonStart:zn,polygonEnd:zn,result:function(){var t=[[Ls,Os],[Fs,zs]];return Fs=zs=-(Os=Ls=1/0),t}};var js,Ns,Vs,Ws,Gs=Hs,Us=0,Ys=0,Xs=0,$s=0,Ks=0,qs=0,Zs=0,Js=0,Qs=0,tr={point:er,lineStart:ir,lineEnd:rr,polygonStart:function(){tr.lineStart=ar,tr.lineEnd=or},polygonEnd:function(){tr.point=er,tr.lineStart=ir,tr.lineEnd=rr},result:function(){var t=Qs?[Zs/Qs,Js/Qs]:qs?[$s/qs,Ks/qs]:Xs?[Us/Xs,Ys/Xs]:[NaN,NaN];return Us=Ys=Xs=$s=Ks=qs=Zs=Js=Qs=0,t}};function er(t,e){Us+=t,Ys+=e,++Xs}function ir(){tr.point=nr}function nr(t,e){tr.point=sr,er(Vs=t,Ws=e)}function sr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,er(Vs=t,Ws=e)}function rr(){tr.point=er}function ar(){tr.point=lr}function or(){hr(js,Ns)}function lr(t,e){tr.point=hr,er(js=Vs=t,Ns=Ws=e)}function hr(t,e){var i=t-Vs,n=e-Ws,s=Dn(i*i+n*n);$s+=s*(Vs+t)/2,Ks+=s*(Ws+e)/2,qs+=s,Zs+=(s=Ws*t-Vs*e)*(Vs+t),Js+=s*(Ws+e),Qs+=3*s,er(Vs=t,Ws=e)}var cr=tr;function dr(t){this._context=t}dr.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,Sn)}},result:zn};var ur,pr,gr,fr,mr,yr=gn(),_r={point:zn,lineStart:function(){_r.point=vr},lineEnd:function(){ur&&br(pr,gr),_r.point=zn},polygonStart:function(){ur=!0},polygonEnd:function(){ur=null},result:function(){var t=+yr;return yr.reset(),t}};function vr(t,e){_r.point=br,pr=fr=t,gr=mr=e}function br(t,e){fr-=t,mr-=e,yr.add(Dn(fr*fr+mr*mr)),fr=t,mr=e}var xr=_r;function Sr(){this._string=[]}function wr(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ar(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Gn(t,i(n))),n.result()}return r.area=function(t){return Gn(t,i(Ds)),Ds.result()},r.measure=function(t){return Gn(t,i(xr)),xr.result()},r.bounds=function(t){return Gn(t,i(Gs)),Gs.result()},r.centroid=function(t){return Gn(t,i(cr)),cr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ss):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Sr):new dr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function kr(t){return function(e){var i=new Mr;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Mr(){}function Cr(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Gn(i,t.stream(Gs)),e(Gs.result()),null!=n&&t.clipExtent(n),t}function Tr(t,e,i){return Cr(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Er(t,e,i){return Tr(t,[[0,0],e],i)}function Pr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Rr(t,e,i){return Cr(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Sr.prototype={_radius:4.5,_circle:wr(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=wr(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}},Mr.prototype={constructor:Mr,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 Br=16,Ir=Tn(30*An);function Dr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,m){var y=h-n,_=c-s,v=y*y+_*_;if(v>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Dn(b*b+x*x+S*S),A=Fn(S/=w),k=kn(kn(S)-1)<_n||kn(r-d)<_n?(r+d)/2:Cn(x,b),M=t(k,A),C=M[0],T=M[1],E=C-n,P=T-s,R=_*E-y*P;(R*R/v>e||kn((y*E+_*P)/v-.5)>.3||a*u+o*p+l*g2?t[2]%360*An:0,E()):[m*wn,y*wn,_*wn]},C.angle=function(t){return arguments.length?(v=t%360*An,E()):v*wn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Dr(o,M=t*t),P()):Dn(M)},C.fitExtent=function(t,e){return Tr(C,t,e)},C.fitSize=function(t,e){return Er(C,t,e)},C.fitWidth=function(t,e){return Pr(C,t,e)},C.fitHeight=function(t,e){return Rr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function jr(t){var e=0,i=vn/3,n=Hr(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*An,i=t[1]*An):[e*wn,i*wn]},s}function Nr(t,e){var i=Bn(t),n=(i+Bn(e))/2;if(kn(n)<_n)return function(t){var e=Tn(t);function i(t,i){return[t*e,Bn(i)/e]}return i.invert=function(t,i){return[t/e,Fn(i*e)]},i}(t);var s=1+i*(2*n-i),r=Dn(s)/n;function a(t,e){var i=Dn(s-2*n*Bn(e))/n;return[i*Bn(t*=n),r-i*Tn(t)]}return a.invert=function(t,e){var i=r-e,a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,Fn((s-(t*t+i*i)*n*n)/(2*n))]},a}function Vr(){return jr(Nr).scale(155.424).center([0,33.6442])}function Wr(){return Vr().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Gr(t){return function(e,i){var n=Tn(e),s=Tn(i),r=t(n*s);return[r*s*Bn(e),r*Bn(i)]}}function Ur(t){return function(e,i){var n=Dn(e*e+i*i),s=t(n),r=Bn(s),a=Tn(s);return[Cn(e*r,n*a),Fn(n&&i*r/n)]}}var Yr=Gr((function(t){return Dn(2/(1+t))}));Yr.invert=Ur((function(t){return 2*Fn(t/2)}));var Xr=Gr((function(t){return(t=On(t))&&t/Bn(t)}));function $r(t,e){return[t,Pn(Ln((bn+e)/2))]}function Kr(){return qr($r).scale(961/Sn)}function qr(t){var e,i,n,s=zr(t),r=s.center,a=s.scale,o=s.translate,l=s.clipExtent,h=null;function c(){var r=vn*a(),o=s(function(t){function e(e){return(e=t(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e}return t=ts(t[0]*An,t[1]*An,t.length>2?t[2]*An:0),e.invert=function(e){return(e=t.invert(e[0]*An,e[1]*An))[0]*=wn,e[1]*=wn,e},e}(s.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),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function Zr(t){return Ln((bn+t)/2)}function Jr(t,e){var i=Tn(t),n=t===e?Bn(t):Pn(i/Tn(e))/Pn(Zr(e)/Zr(t)),s=i*Rn(Zr(t),n)/n;if(!n)return $r;function r(t,e){s>0?e<-bn+_n&&(e=-bn+_n):e>bn-_n&&(e=bn-_n);var i=s/Rn(Zr(e),n);return[i*Bn(n*t),s-i*Tn(n*t)]}return r.invert=function(t,e){var i=s-e,r=In(n)*Dn(t*t+i*i),a=Cn(t,kn(i))*In(i);return i*n<0&&(a-=vn*In(t)*In(i)),[a/n,2*Mn(Rn(s/r,1/n))-bn]},r}function Qr(t,e){return[t,e]}function ta(t,e){var i=Tn(t),n=t===e?Bn(t):(i-Tn(e))/(e-t),s=i/n+t;if(kn(n)<_n)return Qr;function r(t,e){var i=s-e,r=n*t;return[i*Bn(r),s-i*Tn(r)]}return r.invert=function(t,e){var i=s-e,r=Cn(t,kn(i))*In(i);return i*n<0&&(r-=vn*In(t)*In(i)),[r/n,s-In(n)*Dn(t*t+i*i)]},r}Xr.invert=Ur((function(t){return t})),$r.invert=function(t,e){return[t,2*Mn(En(e))-bn]},Qr.invert=Qr;var ea=1.340264,ia=-.081106,na=893e-6,sa=.003796,ra=Dn(3)/2;function aa(t,e){var i=Fn(ra*Bn(e)),n=i*i,s=n*n*n;return[t*Tn(i)/(ra*(ea+3*ia*n+s*(7*na+9*sa*n))),i*(ea+ia*n+s*(na+sa*n))]}function oa(t,e){var i=Tn(e),n=Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function la(t,e){var i=e*e,n=i*i;return[t*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791)),e*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))]}function ha(t,e){return[Tn(e)*Bn(t),Bn(e)]}function ca(t,e){var i=Tn(e),n=1+Tn(t)*i;return[i*Bn(t)/n,Bn(e)/n]}function da(t,e){return[Pn(Ln((bn+e)/2)),-t]}aa.invert=function(t,e){for(var i,n=e,s=n*n,r=s*s*s,a=0;a<12&&(r=(s=(n-=i=(n*(ea+ia*s+r*(na+sa*s))-e)/(ea+3*ia*s+r*(7*na+9*sa*s)))*n)*s*s,!(kn(i)<1e-12));++a);return[ra*t*(ea+3*ia*s+r*(7*na+9*sa*s))/Tn(n),Fn(Bn(n)/ra)]},oa.invert=Ur(Mn),la.invert=function(t,e){var i,n=e,s=25;do{var r=n*n,a=r*r;n-=i=(n*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))-e)/(1.007226+r*(.045255+a*(.259866*r-.311325-.005916*11*a)))}while(kn(i)>_n&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ha.invert=Ur(Fn),ca.invert=Ur((function(t){return 2*Mn(t)})),da.invert=function(t,e){return[-e,2*Mn(En(t))-bn]},Kr().translate([0,0]).center([0,0]).scale(63781);var ua=Object.prototype.hasOwnProperty;function pa(t,e,i,n,s,r){3===arguments.length&&(n=r=Array,s=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},maybeSet:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)throw new Error("full hashmap");c=a[h=h+1&l]}return a[h]=n,o[h]=r,r},get:function(n,r){for(var h=e(n)&l,c=a[h],d=0;c!=s;){if(i(c,n))return o[h];if(++d>=t)break;c=a[h=h+1&l]}return r},keys:function(){for(var t=[],e=0,i=a.length;e>7^ya[2]^ya[3])}function va(t){var e,i,n,s,r=t.coordinates,a=t.lines,o=t.rings,l=function(){for(var t=pa(1.4*r.length,x,S,Int32Array,-1,Int32Array),e=new Int32Array(r.length),i=0,n=r.length;i=0){var r=d[i];s===e&&r===n||s===n&&r===e||(++p,u[i]=1)}else c[i]=e,d[i]=n}}function x(t){return _a(r[t])}function S(t,e){return ga(r[t],r[e])}h=c=d=null;var w,A=function(t,e,i,n,s){3===arguments.length&&(n=Array,s=null);for(var r=new n(t=1<=t)throw new Error("full hashset");l=r[o=o+1&a]}return r[o]=n,!0},has:function(n){for(var o=e(n)&a,l=r[o],h=0;l!=s;){if(i(l,n))return!0;if(++h>=t)break;l=r[o=o+1&a]}return!1},values:function(){for(var t=[],e=0,i=r.length;e>1);en&&(n=r),as&&(s=a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}for(var c in t)r(t[c]);return n>=e&&s>=i?[e,i,n,s]:void 0}(t=Sa(t)),n=e>0&&i&&function(t,e,i){var n=e[0],s=e[1],r=e[2],a=e[3],o=r-n?(i-1)/(r-n):1,l=a-s?(i-1)/(a-s):1;function h(t){return[Math.round((t[0]-n)*o),Math.round((t[1]-s)*l)]}function c(t,e){for(var i,r,a,h,c,d=-1,u=0,p=t.length,g=new Array(p);++dr&&(r=t[0]),t[1]a&&(a=t[1])}function l(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(l);break;case"Point":o(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(o)}}for(e in t.arcs.forEach((function(t){for(var e,o=-1,l=t.length;++or&&(r=e[0]),e[1]a&&(a=e[1])})),t.objects)l(t.objects[e]);return[n,s,r,a]}function Ia(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Da(t,e)}))}:Da(t,e)}function Da(t,e){var i=e.id,n=e.bbox,s=null==e.properties?{}:e.properties,r=La(t,e);return null==i&&null==n?{type:"Feature",properties:s,geometry:r}:null==n?{type:"Feature",id:i,properties:s,geometry:r}:{type:"Feature",id:i,bbox:n,properties:s,geometry:r}}function La(t,e){var i=Ra(t.transform),n=t.arcs;function s(t,e){e.length&&e.pop();for(var s=n[t<0?~t:t],r=0,a=s.length;r1)n=function(t,e,i){var n,s=[],r=[];function a(t){var e=t<0?~t:t;(r[e]||(r[e]=[])).push({i:t,g:n})}function o(t){t.forEach(a)}function l(t){t.forEach(o)}function h(t){t.forEach(l)}function c(t){switch(n=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":o(t.arcs);break;case"MultiLineString":case"Polygon":l(t.arcs);break;case"MultiPolygon":h(t.arcs)}}return c(e),r.forEach(null==i?function(t){s.push(t[0].i)}:function(t){i(t[0].g,t[t.length-1].g)&&s.push(t[0].i)}),s}(0,e,i);else for(s=0,n=new Array(r=t.arcs.length);s1)for(var r,o,l=1,h=a(s[0]);lh&&(o=s[0],s[0]=s[l],s[l]=o,h=r);return s})).filter((function(t){return t.length>0}))}}function Ha(t,e){for(var i=0,n=t.length;i>>1;t[s]=2))throw new Error("n must be ≥2");var i,n=(o=t.bbox||Ba(t))[0],s=o[1],r=o[2],a=o[3];e={scale:[r-n?(r-n)/(i-1):1,a-s?(a-s)/(i-1):1],translate:[n,s]}}var o,l,h=ja(e),c=t.objects,d={};function u(t){return h(t)}function p(t){var e;switch(t.type){case"GeometryCollection":e={type:"GeometryCollection",geometries:t.geometries.map(p)};break;case"Point":e={type:"Point",coordinates:u(t.coordinates)};break;case"MultiPoint":e={type:"MultiPoint",coordinates:t.coordinates.map(u)};break;default:return t}return null!=t.id&&(e.id=t.id),null!=t.bbox&&(e.bbox=t.bbox),null!=t.properties&&(e.properties=t.properties),e}for(l in c)d[l]=p(c[l]);return{type:"Topology",bbox:o,transform:e,objects:d,arcs:t.arcs.map((function(t){var e,i=0,n=1,s=t.length,r=new Array(s);for(r[0]=h(t[0],0);++ii&&(n=s,i=r)}if(i>e)var a=Ya(t.slice(0,n),e),o=Ya(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Xa=Ya;!function(t){var e=Xa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=Ka(Ja,e),{tolerance:n}=i;return $a(t,n)};var to;!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"}(to||(to={}));const eo=(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a},io=(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.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?"+"+oo(e,6):oo(e,4))+"-"+oo(t.getUTCMonth()+1,2)+"-"+oo(t.getUTCDate(),2)+(r?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"."+oo(r,3)+"Z":s?"T"+oo(i,2)+":"+oo(n,2)+":"+oo(s,2)+"Z":n||i?"T"+oo(i,2)+":"+oo(n,2)+"Z":"")}function ho(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 so;if(h)return h=!1,no;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.DSV;const i=Ka(po,e),{delimiter:n}=i;if(!f(n))throw new TypeError("Invalid delimiter: must be a string!");return ho(n).parse(t)},fo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,co(t)},mo=function(t){return(arguments.length>2?arguments[2]:void 0).type=to.DSV,uo(t)};function yo(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return _o(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 _o(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return bo(t);default:throw new Error("unknown GeoJSON type")}}function _o(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=vo(t.properties),e.geometry=bo(t.geometry),e}function vo(t){var e={};return t?(Object.keys(t).forEach((function(i){var n=t[i];"object"==typeof n?null===n?e[i]=null:Array.isArray(n)?e[i]=n.map((function(t){return t})):e[i]=vo(n):e[i]=n})),e):e}function bo(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return bo(t)})),e):(e.coordinates=xo(t.coordinates),e)}function xo(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return xo(t)}))}function So(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 wo(t){for(var e,i,n=So(t),s=0,r=1;r0}function Ao(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=yo(t));var r=[];switch(t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,n)})),t;case"FeatureCollection":return Ao(t,(function(t){Ao(Co(t,n),(function(t){r.push(t)}))})),on(r)}return Co(t,n)}function Co(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ko(t,(function(t){Co(t,e)})),t;case"LineString":return To(So(t),e),t;case"Polygon":return Eo(So(t),e),t;case"MultiLineString":return So(t).forEach((function(t){To(t,e)})),t;case"MultiPolygon":return So(t).forEach((function(t){Eo(t,e)})),t;case"Point":case"MultiPoint":return t}}function To(t,e){wo(t)===e&&t.reverse()}function Eo(t,e){wo(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=Po(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Do=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=to.GEO;const i=Ka(Bo,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Io(t))})):e.push(Io(t))})),e})(t);let o=t.features;return a&&(o=Mo(t,{reverse:!d(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=Ro.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=Ro.bounds(t);t.bbox=e}})),t.features=o,t},Lo={},Oo=(t,e,i)=>{i.type=to.GEO;const n=Ka(Bo,Lo,e),{object:s}=n;if(!f(s))throw new TypeError("Invalid object: must be a string!");const r=Ia(t,t.objects[s]);return Do(r,n,i)},Fo=(t,e,i)=>{const n=!o(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!m(t))throw new TypeError("Invalid data: must be DataView array!");return m(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 zo=0;function Ho(){return zo>1e8&&(zo=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+zo++}class jo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new r,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:Ho("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){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){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const No="_data-view-diff-rank";class Vo{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new r,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:Ho("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),(null==e?void 0:e.fields)&&(this.dataSet.registerTransform("fields",io),this.transform({type:"fields",options:{fields:e.fields}},!1))}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.isRunning=!0,i&&this.target.emit("beforeParse",[]);const n=this.cloneParseData(t,e);if(e){this.parseOption=e,e=R(e);const t=this.dataSet.getParser(e.type||"bytejson")(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&this.transformsArr.splice(e,1)}if(this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[No]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[No]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[No][t.toLowerCase(),e])))}locale_months=["January","February","March","April","May","June","July","August","September","October","November","December"];formatShortWeekday=t=>this.locale_shortWeekdays[t.getDay()];formatWeekday=t=>this.locale_weekdays[t.getDay()];formatShortMonth=t=>this.locale_shortMonths[t.getMonth()];formatMonth=t=>this.locale_months[t.getMonth()];pad(t,e,i){const n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(rthis.pad(t.getDate(),e,2);formatHour24=(t,e)=>this.pad(t.getHours(),e,2);formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2);formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3);formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2);formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2);formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)];formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2);formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4);formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()];formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()];formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()];formatUTCMonth=t=>this.locale_months[t.getUTCMonth()];formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2);formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2);formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2);formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3);formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2);formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2);formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)];formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2);formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,4);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};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};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};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};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};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};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};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};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};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};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};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};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};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};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};parseSpecifier(t,e,i,n){let s=0;const r=e.length,a=i.length;let o,l;for(;s=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));++rthis.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e)));timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e)));timeParse=(t,e)=>this.newParse(t,!1)(e+"")}function Go(t,e){const i=new Set(N(t)),n=new Set(N(e));if(i.size!==n.size)return!1;for(const t of i.values())if(!n.has(t))return!1;return!0}const{Color:Uo}=le,Yo=(t,e)=>(l($o.warnHandler)&&$o.warnHandler.call(null,t,e),e?We.getInstance().warn(`[VChart warn]: ${t}`,e):We.getInstance().warn(`[VChart warn]: ${t}`)),Xo=(t,e,i)=>{const n=new Error(t);return We.getInstance().error(`[VChart error]: ${n}`,e)},$o={silent:!1,warnHandler:!1,errorHandler:!1},Ko="undefined"!=typeof window&&void 0!==window.document,qo=Ko&&globalThis.document;function Zo(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ko}function Jo(t){return"miniApp"===t||"mobile-browser"===t}function Qo(t){return t.includes("miniApp")||"lynx"===t}let tl=0;function el(){return tl>=9999999&&(tl=0),tl++}function il(t){return!h(t)&&(!!v(t)||+t==+t)}function nl(t){return!(!t||0===t.length)&&(!h(t[0])&&!h(t[0].dataId)&&m(t[0].fields))}const sl=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const rl=t=>e=>C(e,t),al=t=>{We.getInstance().error(t)},ol=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||al("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&al("Access path missing closing bracket: "+t),a&&al("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return sl((i&&i.get||rl)(n),[s],e||s)},ll=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(m(t)){const n=t.map((t=>ol(t,e,i)));return t=>n.map((e=>e(t)))}return ol(t,e,i)};ll("id");const hl=sl((function(t){return t}),[],"identity"),cl=sl((function(){return 0}),[],"zero");sl((function(){return 1}),[],"one"),sl((function(){return!0}),[],"true"),sl((function(){return!1}),[],"false"),sl((function(){return{}}),[],"emptyObject");const dl=(t,e)=>{if((te||h(e))&&!h(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},ul=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>dl(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=N(e)||[],s=[],r=[],a={},o=i.comparator||ul;return N(t).forEach(((t,e)=>{if(h(t))return;s.push("desc"===n[e]?-1:1);const o=l(t)?t:ll(t,null,i);var c;r.push(o),(c=o,(h(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:sl(o(r,s),Object.keys(a))},gl=(t,e)=>{const i=l(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(h(e)||h(i))return h(e)&&h(i);if(!u(e)&&!u(i))return e===i;const s=m(e)?e:e[t],r=m(i)?i:i[t];return s===r||!1!==n&&(m(r)?!(!m(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!d(r)&&!(!d(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>fl(t,r,s)))))},ml=(t,e)=>h(t)?e:Math.min(f(t)?e*parseFloat(t)/100:t,e);function yl(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!h(s)&&(s=+s)>=s&&!h(r)&&(r=+r)>=r&&n(s,r,++a)}))}function _l(t,e,i,n,s){let r=0,a=0;return yl(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function vl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;yl(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:_l(t,e,i,s,h)}}const bl=rt;function xl(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Sl=t=>b(t)?Gt(t):null,wl=t=>b(t)?Ut(t):null;function Al(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function kl(t,e,i,n){const s=Al({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function Ml(t){return 3===t||4===t}function Cl(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)}function Tl(t,e){const i=e?+t[0][e]:+t[0];if(!b(i))throw new Error("invalid data");return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&n{const n=e?+i[e]:+i;return b(n)&&n>t&&(t=n),t}),i)}function Pl(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;b(s)&&(i+=s,n++)}));return i/n}function Rl(t,e){const i=Pl(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function Bl(t){let e="center",i="middle";return e=(t=xl(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}}function Il(t,e){const i=Dl(t),n=Dl(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 Dl(t,e={x:0,y:0}){return jt.distancePP(t,e)}function Ll(t,e,i){let n=!1;if(e&&l(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 Ol(t){return function(e){let i;return i=m(t)?t.reduce(((t,e)=>t?.[e]),e):e?.[t],i}}var Fl;function zl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:return!0;default:return!1}}function Hl(t){switch(t){case Fl.Linear:case Fl.Log:case Fl.Pow:case Fl.Sqrt:case Fl.Symlog:case Fl.Time:case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}function jl(t){switch(t){case Fl.Ordinal:case Fl.Point:case Fl.Band:return!0;default:return!1}}!function(t){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"}(Fl||(Fl={}));class Nl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}calculateVisibleDomain(t){return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this.domain()}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const Vl=Symbol("implicit");class Wl extends Nl{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=Fl.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Vl}clone(){return(new Wl).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}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!==Vl)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),Yl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),Xl=t=>t<0?-t*t:t*t,$l=t=>-Math.log(-t),Kl=t=>-Math.exp(-t),ql=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,Zl=t=>10===t?ql:t===Math.E?Math.exp:e=>Math.pow(t,e),Jl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Ql=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),th=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function eh(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 ih(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function nh(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return ai&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class ah extends Wl{constructor(t){super(),this.type=Fl.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=Y(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this.domain();if(this._rangeFactor&&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=[$(t[0]),$(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[$(t[0]),$(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:rh(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rh(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}bandwidth(){return this._bandwidth}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()}clone(){return new ah(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:oh}=le;function lh(t,e){const i=typeof e;let n;if(h(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(n=se.parseColorString(e)){const e=oh(se.parseColorString(t),n);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof re?oh(t,e):e instanceof se?oh(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):mt(Number(t),Number(e))}class hh extends Nl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Gl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Gl,this._piecewise=ih,this._interpolate=lh}scale(t){return t=Number(t),Number.isNaN(t)?this._unknown:(this._output||(this._output=this._piecewise(this._domain.map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){return this._input||(this._input=this._piecewise(this._calculateRange(this._range),this._domain.map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){if(!t)return this._domain.slice();const i=Array.from(t,$);return this._domain=i,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){if(t)return this;const e=this._domain.length,i=this._range.length;let n=Math.min(e,i);if(e&&e=2?(s-this._domain[e-2])/t:0;for(let i=1;i<=t;i++)this._domain[e-2+i]=s-r*(t-i);n=i}return void 0===this._clamp&&(this._clamp=ut(this._domain[0],this._domain[n-1])),this._piecewise=n>2?nh:ih,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:Gl),this.rescale(i)):this._clamp!==Gl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const ch=Math.sqrt(50),dh=Math.sqrt(10),uh=Math.sqrt(2);function ph(t,e,i){let n,s,r,a,o=-1;if(i=+i,(t=+t)==(e=+e))return[];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/a),n=Math.round(e/a);for(i*ae&&--n,r=new Array(s=n-i+1);++oe&&--n,r=new Array(s=n-i+1);++o=ch?a=10:r>=dh?a=5:r>=uh&&(a=2),s>=0?a*10**s:-(10**-s)/a}function fh(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=gh(a,o,n),i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}class _h extends hh{constructor(){super(...arguments),this.type=Fl.Linear}clone(){return(new _h).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}function vh(t){return e=>-t(-e)}class bh extends hh{constructor(){super(Jl(10),Zl(10)),this.type=Fl.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new bh).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){if(t)return this;super.rescale();const e=Jl(this._base),i=Zl(this._base);return this._domain[0]<0?(this._logs=vh(e),this._pows=vh(i),this.transformer=$l,this.untransformer=Kl):(this._logs=e,this._pows=i,this.transformer=e,this.untransformer=i),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return Gl}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.length0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return mh(e[0],e[e.length-1],t)}nice(){return this.domain(sh(this.domain(),{floor:t=>this._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))}))}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=R(this._domain);return this._domain&&(e[e.length-1]=t,this.domain(e)),this}niceMax(){const t=this._domain[0];this.nice();const e=R(this._domain);return this._domain&&(e[0]=t,this.domain(e)),this}}class xh extends ah{constructor(t){super(!1),this.type=Fl.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class Sh extends _h{constructor(){super(),this.type=Fl.Pow,this._exponent=1}clone(){return(new Sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=Gl,this.untransformer=Gl):.5===this._exponent?(this.transformer=Yl,this.untransformer=Xl):(this.transformer=Ul(this._exponent),this.untransformer=Ul(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}function wh(t,e){return t.length===e.length&&t.every(((t,i)=>t===e[i]))}class Ah{constructor(){this.type=Fl.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return wh(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new kh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return ph(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return fh(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return mh(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=yh(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=yh(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=yh(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class Mh extends _h{constructor(){super(Yl,Xl),this.type=Fl.Sqrt}clone(){return(new Mh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class Ch extends _h{constructor(){super(Ql(1),th(1)),this.type=Fl.Symlog,this._const=1}clone(){return(new Ch).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=Ql(t),this.untransformer=th(t),this.rescale(e)):this._const}}class Th{constructor(){this.type=Fl.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!h(t)&&b(+t)?this._range[q(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 Th).domain(this._domain).range(this._range).unknown(this._unknown)}}const Eh=[["second",1,Qe],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,ti],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,ei],["hour",3,3*ei],["hour",6,6*ei],["hour",12,12*ei],["day",1,ii],["day",2,2*ii],["day",7,7*ii],["month",1,ni],["month",3,3*ni],["month",6,6*ni],["year",1,365*ii]];function Ph(t){return+xt(t)}function Rh(t,e,i,n){const s=(+e-+t)/i,r=q(Eh.map((t=>t[2])),s);if(r===Eh.length){const s=Math.max(it(+t/si,+e/si,i),1),r=t=>(t[Je(n)](Math.floor(t[Ue(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[Je(n)](t[Ue(n)]()+e*s),t);return{floor:r,offset:a,ceil:Qi(r,a)}}if(0===r){const n=Math.max(it(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:Qi(s,r)}}const[a,o]=Eh[s/Eh[r-1][2]"year"===t&&e?{floor:hi,offset:ci,count:di,field:ui}:"month"===t&&e?{floor:yi,offset:_i,count:vi,field:bi}:"day"===t&&e?{floor:ki,offset:Mi,count:Ci,field:Ti}:"hour"===t&&e?{floor:Ii,offset:Di,count:Ri,field:Li}:"minute"===t&&e?{floor:ji,offset:Ni,count:zi,field:Vi}:"second"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"year"===t?{floor:ri,offset:ai,count:oi,field:li}:"month"===t?{floor:pi,offset:gi,count:fi,field:mi}:"day"===t?{floor:xi,offset:Si,count:wi,field:Ai}:"hour"===t?{floor:Ei,offset:Pi,count:Ri,field:Bi}:"minute"===t?{floor:Oi,offset:Fi,count:zi,field:Hi}:"second"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:{floor:qi,offset:Zi,count:Ji})(a,n);return tn(o,l)}class Bh extends hh{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=Fl.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(xt);const i=Array.from(t,Ph);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=xt(t),s=e[Ue(n)](),r=e[Ye(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[Xe(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[$e(n)](),c=(h-1)%12+1,d=e[Ke(n)](),u=e[qe(n)](),p=e[Ze(n)]();return(i||"").replace(/YYYY/g,ht(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,ht(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,ht(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,ht(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,ht(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,ht(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,ht(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,ht(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new Bh(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(v(t)||h(t))&&(i=Rh(e[0],e[e.length-1],h(t)?10:t,this._isUtc)),i&&this.domain(sh(e,i)),this}utc(){return this._isUtc}}function Ih(t,e){const i=c(e)?t?.[e]??t?.default:t?.default;if(!i||m(i))return i;if(d(i)){const{dataScheme:n}=i;return n?zh(n)?n.map((i=>({...i,scheme:i.scheme.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c)}))):n.map((i=>Fh(i)?Lh(t,i,e):i)).filter(c):[]}return[]}function Dh(t,e){return zh(t)?t.find((t=>c(t.isAvailable)?l(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!c(t.maxDomainLength)||e?.length<=t.maxDomainLength))?.scheme??t[t.length-1].scheme:t}function Lh(t,e,i){const n=c(i)?t[i]??t.default:t.default;if(!n)return;const s=n.palette?.[e.key];if(!s)return;if(!c(e.a)&&!c(e.l)||!f(s))return s;let r=new Uo(s);if(c(e.l)){const{r:t,g:i,b:n}=r.color,{h:s,s:a}=Jt(t,i,n),o=Zt(s,a,e.l),l=new Uo(`rgb(${o.r}, ${o.g}, ${o.b})`);l.setOpacity(r.color.opacity),r=l}return c(e.a)&&r.setOpacity(e.a),r.toRGBA()}const Oh=(t,e,i)=>{if(Fh(t)&&e){const n=Lh(e,t,i);if(n)return n}return t};function Fh(t){return d(t)&&"palette"===t.type&&!!t.key}function zh(t){return!!m(t)&&t.every((t=>c(t.scheme)))}class Hh extends Wl{_range;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(!zh(this._range))return void super.range(this._range);const t=Dh(this._range,this._domain);super.range(t)}}const jh={linear:_h,band:ah,point:xh,ordinal:Wl,threshold:Th,colorOrdinal:Hh};function Nh(t){const e=jh[t];return e?new e:null}function Vh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function Wh(t){return c(t?.field)&&c(t?.scale)}var Gh;function Uh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Yh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Xh(t){return!!f(t)&&(!!t.endsWith("%")&&il(t.substring(0,t.length-1)))}function $h(t,e,i){return v(t)?t:Xh(t)?Number(t.substring(0,t.length-1))*e/100:l(t)?t(i):0}function Kh(t,e,i){const n={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>v(t))))return n.top=t.top??0,n.right=t.right??0,n.bottom=t.bottom??0,n.left=t.left??0,n;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{n[s]=$h(t[s],e.size,i)}))})),n}function qh(t){let e={};return m(t)?(h(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),h(t[1])||(e.left=e.right=t[1]),h(t[2])||(e.bottom=t[2]),h(t[3])||(e.left=t[3]),e):v(t)||Xh(t)||l(t)?(e.top=e.left=e.bottom=e.right=t,e):(d(t)&&(e={...t}),e)}function Zh(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}function Jh(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]=Jh(t[n],e)}return i}return m(t)?t.map((t=>Jh(t,e))):t}function Qh(t){const e=t;let i;if(!c(e)||"object"!=typeof e)return e;if(function(t){const e=["dataSet","latestData","rawData","parserData","isDataView","history"],i=Object.keys(t);return t instanceof Vo||e.every((t=>i.includes(t)))}(e))return e;const n=m(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:o(e)||v(e)||f(e)?e:_(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let a=-1;if(i)for(;++a<(r||e).length;){const t=r?r[a]:a,n=e[t];i[t]=Qh(n)}return i}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(Gh||(Gh={}));var tc=function(t){return t&&t.Math==Math&&t},ec=tc("object"==typeof globalThis&&globalThis)||tc("object"==typeof window&&window)||tc("object"==typeof self&&self)||tc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),ic={},nc=function(t){try{return!!t()}catch(t){return!0}},sc=!nc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),rc=!nc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),ac=rc,oc=Function.prototype.call,lc=ac?oc.bind(oc):function(){return oc.apply(oc,arguments)},hc={},cc={}.propertyIsEnumerable,dc=Object.getOwnPropertyDescriptor,uc=dc&&!cc.call({1:2},1);hc.f=uc?function(t){var e=dc(this,t);return!!e&&e.enumerable}:cc;var pc,gc,fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},mc=rc,yc=Function.prototype,_c=yc.call,vc=mc&&yc.bind.bind(_c,_c),bc=mc?vc:function(t){return function(){return _c.apply(t,arguments)}},xc=bc,Sc=xc({}.toString),wc=xc("".slice),Ac=function(t){return wc(Sc(t),8,-1)},kc=nc,Mc=Ac,Cc=Object,Tc=bc("".split),Ec=kc((function(){return!Cc("z").propertyIsEnumerable(0)}))?function(t){return"String"==Mc(t)?Tc(t,""):Cc(t)}:Cc,Pc=function(t){return null==t},Rc=Pc,Bc=TypeError,Ic=function(t){if(Rc(t))throw Bc("Can't call method on "+t);return t},Dc=Ec,Lc=Ic,Oc=function(t){return Dc(Lc(t))},Fc="object"==typeof document&&document.all,zc={all:Fc,IS_HTMLDDA:void 0===Fc&&void 0!==Fc},Hc=zc.all,jc=zc.IS_HTMLDDA?function(t){return"function"==typeof t||t===Hc}:function(t){return"function"==typeof t},Nc=jc,Vc=zc.all,Wc=zc.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:Nc(t)||t===Vc}:function(t){return"object"==typeof t?null!==t:Nc(t)},Gc=ec,Uc=jc,Yc=function(t,e){return arguments.length<2?(i=Gc[t],Uc(i)?i:void 0):Gc[t]&&Gc[t][e];var i},Xc=bc({}.isPrototypeOf),$c=ec,Kc="undefined"!=typeof navigator&&String(navigator.userAgent)||"",qc=$c.process,Zc=$c.Deno,Jc=qc&&qc.versions||Zc&&Zc.version,Qc=Jc&&Jc.v8;Qc&&(gc=(pc=Qc.split("."))[0]>0&&pc[0]<4?1:+(pc[0]+pc[1])),!gc&&Kc&&(!(pc=Kc.match(/Edge\/(\d+)/))||pc[1]>=74)&&(pc=Kc.match(/Chrome\/(\d+)/))&&(gc=+pc[1]);var td=gc,ed=nc,id=ec.String,nd=!!Object.getOwnPropertySymbols&&!ed((function(){var t=Symbol();return!id(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&td&&td<41})),sd=nd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,rd=Yc,ad=jc,od=Xc,ld=Object,hd=sd?function(t){return"symbol"==typeof t}:function(t){var e=rd("Symbol");return ad(e)&&od(e.prototype,ld(t))},cd=String,dd=function(t){try{return cd(t)}catch(t){return"Object"}},ud=jc,pd=dd,gd=TypeError,fd=function(t){if(ud(t))return t;throw gd(pd(t)+" is not a function")},md=fd,yd=Pc,_d=function(t,e){var i=t[e];return yd(i)?void 0:md(i)},vd=lc,bd=jc,xd=Wc,Sd=TypeError,wd={exports:{}},Ad=ec,kd=Object.defineProperty,Md=function(t,e){try{kd(Ad,t,{value:e,configurable:!0,writable:!0})}catch(i){Ad[t]=e}return e},Cd=Md,Td="__core-js_shared__",Ed=ec[Td]||Cd(Td,{}),Pd=Ed;(wd.exports=function(t,e){return Pd[t]||(Pd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Rd=wd.exports,Bd=Ic,Id=Object,Dd=function(t){return Id(Bd(t))},Ld=Dd,Od=bc({}.hasOwnProperty),Fd=Object.hasOwn||function(t,e){return Od(Ld(t),e)},zd=bc,Hd=0,jd=Math.random(),Nd=zd(1..toString),Vd=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Nd(++Hd+jd,36)},Wd=Rd,Gd=Fd,Ud=Vd,Yd=nd,Xd=sd,$d=ec.Symbol,Kd=Wd("wks"),qd=Xd?$d.for||$d:$d&&$d.withoutSetter||Ud,Zd=function(t){return Gd(Kd,t)||(Kd[t]=Yd&&Gd($d,t)?$d[t]:qd("Symbol."+t)),Kd[t]},Jd=lc,Qd=Wc,tu=hd,eu=_d,iu=function(t,e){var i,n;if("string"===e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;if(bd(i=t.valueOf)&&!xd(n=vd(i,t)))return n;if("string"!==e&&bd(i=t.toString)&&!xd(n=vd(i,t)))return n;throw Sd("Can't convert object to primitive value")},nu=TypeError,su=Zd("toPrimitive"),ru=function(t,e){if(!Qd(t)||tu(t))return t;var i,n=eu(t,su);if(n){if(void 0===e&&(e="default"),i=Jd(n,t,e),!Qd(i)||tu(i))return i;throw nu("Can't convert object to primitive value")}return void 0===e&&(e="number"),iu(t,e)},au=hd,ou=function(t){var e=ru(t,"string");return au(e)?e:e+""},lu=Wc,hu=ec.document,cu=lu(hu)&&lu(hu.createElement),du=function(t){return cu?hu.createElement(t):{}},uu=du,pu=!sc&&!nc((function(){return 7!=Object.defineProperty(uu("div"),"a",{get:function(){return 7}}).a})),gu=sc,fu=lc,mu=hc,yu=fc,_u=Oc,vu=ou,bu=Fd,xu=pu,Su=Object.getOwnPropertyDescriptor;ic.f=gu?Su:function(t,e){if(t=_u(t),e=vu(e),xu)try{return Su(t,e)}catch(t){}if(bu(t,e))return yu(!fu(mu.f,t,e),t[e])};var wu={},Au=sc&&nc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ku=Wc,Mu=String,Cu=TypeError,Tu=function(t){if(ku(t))return t;throw Cu(Mu(t)+" is not an object")},Eu=sc,Pu=pu,Ru=Au,Bu=Tu,Iu=ou,Du=TypeError,Lu=Object.defineProperty,Ou=Object.getOwnPropertyDescriptor,Fu="enumerable",zu="configurable",Hu="writable";wu.f=Eu?Ru?function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),"function"==typeof t&&"prototype"===e&&"value"in i&&Hu in i&&!i[Hu]){var n=Ou(t,e);n&&n[Hu]&&(t[e]=i.value,i={configurable:zu in i?i[zu]:n[zu],enumerable:Fu in i?i[Fu]:n[Fu],writable:!1})}return Lu(t,e,i)}:Lu:function(t,e,i){if(Bu(t),e=Iu(e),Bu(i),Pu)try{return Lu(t,e,i)}catch(t){}if("get"in i||"set"in i)throw Du("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var ju=wu,Nu=fc,Vu=sc?function(t,e,i){return ju.f(t,e,Nu(1,i))}:function(t,e,i){return t[e]=i,t},Wu={exports:{}},Gu=sc,Uu=Fd,Yu=Function.prototype,Xu=Gu&&Object.getOwnPropertyDescriptor,$u=Uu(Yu,"name"),Ku={EXISTS:$u,PROPER:$u&&"something"===function(){}.name,CONFIGURABLE:$u&&(!Gu||Gu&&Xu(Yu,"name").configurable)},qu=jc,Zu=Ed,Ju=bc(Function.toString);qu(Zu.inspectSource)||(Zu.inspectSource=function(t){return Ju(t)});var Qu,tp,ep,ip=Zu.inspectSource,np=jc,sp=ec.WeakMap,rp=np(sp)&&/native code/.test(String(sp)),ap=Vd,op=Rd("keys"),lp=function(t){return op[t]||(op[t]=ap(t))},hp={},cp=rp,dp=ec,up=Wc,pp=Vu,gp=Fd,fp=Ed,mp=lp,yp=hp,_p="Object already initialized",vp=dp.TypeError,bp=dp.WeakMap;if(cp||fp.state){var xp=fp.state||(fp.state=new bp);xp.get=xp.get,xp.has=xp.has,xp.set=xp.set,Qu=function(t,e){if(xp.has(t))throw vp(_p);return e.facade=t,xp.set(t,e),e},tp=function(t){return xp.get(t)||{}},ep=function(t){return xp.has(t)}}else{var Sp=mp("state");yp[Sp]=!0,Qu=function(t,e){if(gp(t,Sp))throw vp(_p);return e.facade=t,pp(t,Sp,e),e},tp=function(t){return gp(t,Sp)?t[Sp]:{}},ep=function(t){return gp(t,Sp)}}var wp={set:Qu,get:tp,has:ep,enforce:function(t){return ep(t)?tp(t):Qu(t,{})},getterFor:function(t){return function(e){var i;if(!up(e)||(i=tp(e)).type!==t)throw vp("Incompatible receiver, "+t+" required");return i}}},Ap=bc,kp=nc,Mp=jc,Cp=Fd,Tp=sc,Ep=Ku.CONFIGURABLE,Pp=ip,Rp=wp.enforce,Bp=wp.get,Ip=String,Dp=Object.defineProperty,Lp=Ap("".slice),Op=Ap("".replace),Fp=Ap([].join),zp=Tp&&!kp((function(){return 8!==Dp((function(){}),"length",{value:8}).length})),Hp=String(String).split("String"),jp=Wu.exports=function(t,e,i){"Symbol("===Lp(Ip(e),0,7)&&(e="["+Op(Ip(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Cp(t,"name")||Ep&&t.name!==e)&&(Tp?Dp(t,"name",{value:e,configurable:!0}):t.name=e),zp&&i&&Cp(i,"arity")&&t.length!==i.arity&&Dp(t,"length",{value:i.arity});try{i&&Cp(i,"constructor")&&i.constructor?Tp&&Dp(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Rp(t);return Cp(n,"source")||(n.source=Fp(Hp,"string"==typeof e?e:"")),t};Function.prototype.toString=jp((function(){return Mp(this)&&Bp(this).source||Pp(this)}),"toString");var Np=Wu.exports,Vp=jc,Wp=wu,Gp=Np,Up=Md,Yp=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(Vp(i)&&Gp(i,r,n),n.global)s?t[e]=i:Up(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:Wp.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},Xp={},$p=Math.ceil,Kp=Math.floor,qp=Math.trunc||function(t){var e=+t;return(e>0?Kp:$p)(e)},Zp=function(t){var e=+t;return e!=e||0===e?0:qp(e)},Jp=Zp,Qp=Math.max,tg=Math.min,eg=function(t,e){var i=Jp(t);return i<0?Qp(i+e,0):tg(i,e)},ig=Zp,ng=Math.min,sg=function(t){return t>0?ng(ig(t),9007199254740991):0},rg=function(t){return sg(t.length)},ag=Oc,og=eg,lg=rg,hg=function(t){return function(e,i,n){var s,r=ag(e),a=lg(r),o=og(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},cg={includes:hg(!0),indexOf:hg(!1)},dg=Fd,ug=Oc,pg=cg.indexOf,gg=hp,fg=bc([].push),mg=function(t,e){var i,n=ug(t),s=0,r=[];for(i in n)!dg(gg,i)&&dg(n,i)&&fg(r,i);for(;e.length>s;)dg(n,i=e[s++])&&(~pg(r,i)||fg(r,i));return r},yg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_g=mg,vg=yg.concat("length","prototype");Xp.f=Object.getOwnPropertyNames||function(t){return _g(t,vg)};var bg={};bg.f=Object.getOwnPropertySymbols;var xg=Yc,Sg=Xp,wg=bg,Ag=Tu,kg=bc([].concat),Mg=xg("Reflect","ownKeys")||function(t){var e=Sg.f(Ag(t)),i=wg.f;return i?kg(e,i(t)):e},Cg=Fd,Tg=Mg,Eg=ic,Pg=wu,Rg=nc,Bg=jc,Ig=/#|\.prototype\./,Dg=function(t,e){var i=Og[Lg(t)];return i==zg||i!=Fg&&(Bg(e)?Rg(e):!!e)},Lg=Dg.normalize=function(t){return String(t).replace(Ig,".").toLowerCase()},Og=Dg.data={},Fg=Dg.NATIVE="N",zg=Dg.POLYFILL="P",Hg=Dg,jg=ec,Ng=ic.f,Vg=Vu,Wg=Yp,Gg=Md,Ug=function(t,e,i){for(var n=Tg(e),s=Pg.f,r=Eg.f,a=0;ar;r++)if((o=y(t[r]))&&bm(Mm,o))return o;return new km(!1)}n=xm(t,s)}for(l=u?t.next:n.next;!(h=fm(l,n)).done;){try{o=y(h.value)}catch(t){wm(n,"throw",t)}if("object"==typeof o&&o&&bm(Mm,o))return o}return new km(!1)},Tm=Xc,Em=TypeError,Pm=function(t,e){if(Tm(e,t))return t;throw Em("Incorrect invocation")},Rm=Zd("iterator"),Bm=!1;try{var Im=0,Dm={next:function(){return{done:!!Im++}},return:function(){Bm=!0}};Dm[Rm]=function(){return this},Array.from(Dm,(function(){throw 2}))}catch(al){}var Lm=wu.f,Om=Fd,Fm=Zd("toStringTag"),zm=function(t,e,i){t&&!i&&(t=t.prototype),t&&!Om(t,Fm)&&Lm(t,Fm,{configurable:!0,value:e})},Hm=bc,jm=fd,Nm=jc,Vm=String,Wm=TypeError,Gm=function(t,e,i){try{return Hm(jm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},Um=Tu,Ym=function(t){if("object"==typeof t||Nm(t))return t;throw Wm("Can't set "+Vm(t)+" as a prototype")},Xm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=Gm(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return Um(i),Ym(n),e?t(i,n):i.__proto__=n,i}}():void 0),$m=jc,Km=Wc,qm=Xm,Zm=Xg,Jm=ec,Qm=bc,ty=Hg,ey=Yp,iy=If,ny=Cm,sy=Pm,ry=jc,ay=Pc,oy=Wc,ly=nc,hy=function(t,e){if(!e&&!Bm)return!1;var i=!1;try{var n={};n[Rm]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},cy=zm,dy=function(t,e,i){var n,s;return qm&&$m(n=e.constructor)&&n!==i&&Km(s=n.prototype)&&s!==i.prototype&&qm(t,s),t},uy=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=Jm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=Qm(o[t]);ey(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!oy(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!oy(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(ty(t,!ry(a)||!(s||o.forEach&&!ly((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),iy.enable();else if(ty(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=ly((function(){d.has(1)})),g=hy((function(t){new a(t)})),f=!s&&ly((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){sy(t,o);var i=dy(new a,t,l);return ay(e)||ny(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,Zm({global:!0,constructor:!0,forced:l!=a},h),cy(l,t),s||i.setStrong(l,t,n),l},py={},gy=mg,fy=yg,my=Object.keys||function(t){return gy(t,fy)},yy=sc,_y=Au,vy=wu,by=Tu,xy=Oc,Sy=my;py.f=yy&&!_y?Object.defineProperties:function(t,e){by(t);for(var i,n=xy(e),s=Sy(e),r=s.length,a=0;r>a;)vy.f(t,i=s[a++],n[i]);return t};var wy,Ay=Yc("document","documentElement"),ky=Tu,My=py,Cy=yg,Ty=hp,Ey=Ay,Py=du,Ry="prototype",By="script",Iy=lp("IE_PROTO"),Dy=function(){},Ly=function(t){return"<"+By+">"+t+""},Oy=function(t){t.write(Ly("")),t.close();var e=t.parentWindow.Object;return t=null,e},Fy=function(){try{wy=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;Fy="undefined"!=typeof document?document.domain&&wy?Oy(wy):(e=Py("iframe"),i="java"+By+":",e.style.display="none",Ey.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(Ly("document.F=Object")),t.close(),t.F):Oy(wy);for(var n=Cy.length;n--;)delete Fy[Ry][Cy[n]];return Fy()};Ty[Iy]=!0;var zy,Hy,jy,Ny=Object.create||function(t,e){var i;return null!==t?(Dy[Ry]=ky(t),i=new Dy,Dy[Ry]=null,i[Iy]=t):i=Fy(),void 0===e?i:My.f(i,e)},Vy=Np,Wy=wu,Gy=function(t,e,i){return i.get&&Vy(i.get,e,{getter:!0}),i.set&&Vy(i.set,e,{setter:!0}),Wy.f(t,e,i)},Uy=Yp,Yy=function(t,e,i){for(var n in e)Uy(t,n,e[n],i);return t},Xy=!nc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),$y=Fd,Ky=jc,qy=Dd,Zy=Xy,Jy=lp("IE_PROTO"),Qy=Object,t_=Qy.prototype,e_=Zy?Qy.getPrototypeOf:function(t){var e=qy(t);if($y(e,Jy))return e[Jy];var i=e.constructor;return Ky(i)&&e instanceof i?i.prototype:e instanceof Qy?t_:null},i_=nc,n_=jc,s_=Wc,r_=e_,a_=Yp,o_=Zd("iterator"),l_=!1;[].keys&&("next"in(jy=[].keys())?(Hy=r_(r_(jy)))!==Object.prototype&&(zy=Hy):l_=!0);var h_=!s_(zy)||i_((function(){var t={};return zy[o_].call(t)!==t}));h_&&(zy={}),n_(zy[o_])||a_(zy,o_,(function(){return this}));var c_={IteratorPrototype:zy,BUGGY_SAFARI_ITERATORS:l_},d_=c_.IteratorPrototype,u_=Ny,p_=fc,g_=zm,f_=Nf,m_=function(){return this},y_=Xg,__=lc,v_=jc,b_=function(t,e,i,n){var s=e+" Iterator";return t.prototype=u_(d_,{next:p_(+!n,i)}),g_(t,s,!1),f_[s]=m_,t},x_=e_,S_=Xm,w_=zm,A_=Vu,k_=Yp,M_=Nf,C_=Ku.PROPER,T_=Ku.CONFIGURABLE,E_=c_.IteratorPrototype,P_=c_.BUGGY_SAFARI_ITERATORS,R_=Zd("iterator"),B_="keys",I_="values",D_="entries",L_=function(){return this},O_=Yc,F_=Gy,z_=sc,H_=Zd("species"),j_=Ny,N_=Gy,V_=Yy,W_=jf,G_=Pm,U_=Pc,Y_=Cm,X_=function(t,e,i,n,s,r,a){b_(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!P_&&t in p)return p[t];switch(t){case B_:case I_:case D_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[R_]||p["@@iterator"]||s&&p[s],f=!P_&&g||c(s),m="Array"==e&&p.entries||g;if(m&&(o=x_(m.call(new t)))!==Object.prototype&&o.next&&(x_(o)!==E_&&(S_?S_(o,E_):v_(o[R_])||k_(o,R_,L_)),w_(o,d,!0)),C_&&s==I_&&g&&g.name!==I_&&(T_?A_(p,"name",I_):(u=!0,f=function(){return __(g,this)})),s)if(l={values:c(I_),keys:r?f:c(B_),entries:c(D_)},a)for(h in l)(P_||u||!(h in p))&&k_(p,h,l[h]);else y_({target:e,proto:!0,forced:P_||u},l);return p[R_]!==f&&k_(p,R_,f,{name:s}),M_[e]=f,l},$_=function(t,e){return{value:t,done:e}},K_=function(t){var e=O_(t);z_&&e&&!e[H_]&&F_(e,H_,{configurable:!0,get:function(){return this}})},q_=sc,Z_=If.fastKey,J_=wp.set,Q_=wp.getterFor,tv={getConstructor:function(t,e,i,n){var s=t((function(t,s){G_(t,r),J_(t,{type:e,index:j_(null),first:void 0,last:void 0,size:0}),q_||(t.size=0),U_(s)||Y_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Q_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=Z_(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),q_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=Z_(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return V_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,q_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),q_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=W_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),V_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),q_&&N_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=Q_(e),r=Q_(n);X_(t,e,(function(t,e){J_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?$_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,$_(void 0,!0))}),i?"entries":"values",!i,!0),K_(e)}};uy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),tv);var ev=Ac,iv=Array.isArray||function(t){return"Array"==ev(t)},nv=bc,sv=nc,rv=jc,av=Jf,ov=ip,lv=function(){},hv=[],cv=Yc("Reflect","construct"),dv=/^\s*(?:class|function)\b/,uv=nv(dv.exec),pv=!dv.exec(lv),gv=function(t){if(!rv(t))return!1;try{return cv(lv,hv,t),!0}catch(t){return!1}},fv=function(t){if(!rv(t))return!1;switch(av(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pv||!!uv(dv,ov(t))}catch(t){return!0}};fv.sham=!0;var mv=!cv||sv((function(){var t;return gv(gv.call)||!gv(Object)||!gv((function(){t=!0}))||t}))?fv:gv,yv=iv,_v=mv,vv=Wc,bv=Zd("species"),xv=Array,Sv=function(t){var e;return yv(t)&&(e=t.constructor,(_v(e)&&(e===xv||yv(e.prototype))||vv(e)&&null===(e=e[bv]))&&(e=void 0)),void 0===e?xv:e},wv=jf,Av=Ec,kv=Dd,Mv=rg,Cv=function(t,e){return new(Sv(t))(0===e?0:e)},Tv=bc([].push),Ev=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=kv(l),f=Av(g),m=wv(h,c),y=Mv(f),_=0,v=d||Cv,b=e?v(l,y):i||a?v(l,0):void 0;y>_;_++)if((o||_ in f)&&(p=m(u=f[_],_,g),t))if(e)b[_]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return _;case 2:Tv(b,u)}else switch(t){case 4:return!1;case 7:Tv(b,u)}return r?-1:n||s?s:b}},Pv={forEach:Ev(0),map:Ev(1),filter:Ev(2),some:Ev(3),every:Ev(4),find:Ev(5),findIndex:Ev(6),filterReject:Ev(7)},Rv=bc,Bv=Yy,Iv=If.getWeakData,Dv=Pm,Lv=Tu,Ov=Pc,Fv=Wc,zv=Cm,Hv=Fd,jv=wp.set,Nv=wp.getterFor,Vv=Pv.find,Wv=Pv.findIndex,Gv=Rv([].splice),Uv=0,Yv=function(t){return t.frozen||(t.frozen=new Xv)},Xv=function(){this.entries=[]},$v=function(t,e){return Vv(t.entries,(function(t){return t[0]===e}))};Xv.prototype={get:function(t){var e=$v(this,t);if(e)return e[1]},has:function(t){return!!$v(this,t)},set:function(t,e){var i=$v(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=Wv(this.entries,(function(e){return e[0]===t}));return~e&&Gv(this.entries,e,1),!!~e}};var Kv,qv={getConstructor:function(t,e,i,n){var s=t((function(t,s){Dv(t,r),jv(t,{type:e,id:Uv++,frozen:void 0}),Ov(s)||zv(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=Nv(e),o=function(t,e,i){var n=a(t),s=Iv(Lv(e),!0);return!0===s?Yv(n).set(e,i):s[n.id]=i,t};return Bv(r,{delete:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).delete(t):i&&Hv(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!Fv(t))return!1;var i=Iv(t);return!0===i?Yv(e).has(t):i&&Hv(i,e.id)}}),Bv(r,i?{get:function(t){var e=a(this);if(Fv(t)){var i=Iv(t);return!0===i?Yv(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},Zv=yf,Jv=ec,Qv=bc,tb=Yy,eb=If,ib=uy,nb=qv,sb=Wc,rb=wp.enforce,ab=nc,ob=rp,lb=Object,hb=Array.isArray,cb=lb.isExtensible,db=lb.isFrozen,ub=lb.isSealed,pb=lb.freeze,gb=lb.seal,fb={},mb={},yb=!Jv.ActiveXObject&&"ActiveXObject"in Jv,_b=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},vb=ib("WeakMap",_b,nb),bb=vb.prototype,xb=Qv(bb.set);if(ob)if(yb){Kv=nb.getConstructor(_b,"WeakMap",!0),eb.enable();var Sb=Qv(bb.delete),wb=Qv(bb.has),Ab=Qv(bb.get);tb(bb,{delete:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),Sb(this,t)||e.frozen.delete(t)}return Sb(this,t)},has:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)||e.frozen.has(t)}return wb(this,t)},get:function(t){if(sb(t)&&!cb(t)){var e=rb(this);return e.frozen||(e.frozen=new Kv),wb(this,t)?Ab(this,t):e.frozen.get(t)}return Ab(this,t)},set:function(t,e){if(sb(t)&&!cb(t)){var i=rb(this);i.frozen||(i.frozen=new Kv),wb(this,t)?xb(this,t,e):i.frozen.set(t,e)}else xb(this,t,e);return this}})}else Zv&&ab((function(){var t=pb([]);return xb(new vb,t,1),!db(t)}))&&tb(bb,{set:function(t,e){var i;return hb(t)&&(db(t)?i=fb:ub(t)&&(i=mb)),xb(this,t,e),i==fb&&pb(t),i==mb&&gb(t),this}});var kb=Yc,Mb=bc,Cb=Rd,Tb=kb("Map"),Eb=kb("WeakMap"),Pb=Mb([].push),Rb=Cb("metadata"),Bb=Rb.store||(Rb.store=new Eb),Ib=function(t,e,i){var n=Bb.get(t);if(!n){if(!i)return;Bb.set(t,n=new Tb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new Tb)}return s},Db={store:Bb,getMap:Ib,has:function(t,e,i){var n=Ib(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=Ib(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){Ib(i,n,!0).set(t,e)},keys:function(t,e){var i=Ib(t,e,!1),n=[];return i&&i.forEach((function(t,e){Pb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},Lb=Tu,Ob=Db.toKey,Fb=Db.set;Xg({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:Ob(arguments[3]);Fb(t,e,Lb(i),n)}});var zb=Tu,Hb=Db.toKey,jb=Db.getMap,Nb=Db.store;Xg({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:Hb(arguments[2]),n=jb(zb(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=Nb.get(e);return s.delete(i),!!s.size||Nb.delete(e)}});var Vb=Tu,Wb=e_,Gb=Db.has,Ub=Db.get,Yb=Db.toKey,Xb=function(t,e,i){if(Gb(t,e,i))return Ub(t,e,i);var n=Wb(e);return null!==n?Xb(t,n,i):void 0};Xg({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:Yb(arguments[2]);return Xb(t,Vb(e),i)}});var $b=bc,Kb=Map.prototype,qb={Map:Map,set:$b(Kb.set),get:$b(Kb.get),has:$b(Kb.has),remove:$b(Kb.delete),proto:Kb},Zb=lc,Jb=bc,Qb=function(t,e,i){for(var n,s,r=i||t.next;!(n=Zb(r,t)).done;)if(void 0!==(s=e(n.value)))return s},tx=qb.Map,ex=qb.proto,ix=Jb(ex.forEach),nx=Jb(ex.entries),sx=nx(new tx).next,rx=fd,ax=Pc,ox=rg,lx=Dd,hx=function(t,e,i){return i?Qb(nx(t),(function(t){return e(t[1],t[0])}),sx):ix(t,e)},cx=qb.Map,dx=qb.has,ux=qb.set,px=bc([].push),gx=Xg,fx=bc,mx=Db,yx=Tu,_x=e_,vx=function(t){var e,i,n,s=lx(this),r=ox(s),a=[],o=new cx,l=ax(t)?function(t){return t}:rx(t);for(e=0;e= than the number of constructor arguments of its base class."},yS=function(t,e){return"@postConstruct error in class "+t+": "+e},_S=function(t,e){return"@preDestroy error in class "+t+": "+e},vS=function(t,e){return"onDeactivation() error in class "+t+": "+e},bS="Maximum call stack size exceeded",xS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(Zx,t),userGeneratedMetadata:Reflect.getMetadata(Kx,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(qx,t)||[]},t}(),SS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function wS(t){return t instanceof RangeError||t.message===bS}function AS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function kS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=TS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function MS(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||MS(t.parentRequest,e))}function CS(t){t.childRequests.forEach((function(t){if(MS(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=AS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(gS+" "+e)}CS(t)}))}function TS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ES=function(){function t(t){this.id=rS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),PS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===Wx?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),RS=function(t,e){this.parentContext=t,this.rootRequest=e},BS=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),IS=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),DS=function(){function t(t,e,i,n){this.id=rS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new IS(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new PS(Wx,n):n instanceof PS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:jS(t,i)}return 0}function NS(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[Xx],multiInject:e[$x],targetName:e[Gx],unmanaged:e[Ux]}}var VS=function(){function t(t,e,i,n,s){this.id=rS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function WS(t){return t._bindingDictionary}function GS(t,e,i,n,s){var r=YS(i.container,s.serviceIdentifier),a=[];return r.length===SS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=YS(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new VS(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case SS.NoBindingsAvailable:if(i.isOptional())return e;var s=AS(t),r=dS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=kS(n,s,YS),new Error(r);case SS.OnlyOneBindingAvailable:return e;case SS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=AS(t),r=cS+" "+s;throw r+=kS(n,s,YS),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function US(t,e,i,n,s,r){var a,o;if(null===s){a=GS(t,e,n,null,r),o=new VS(i,n,null,a,r);var l=new RS(n,o);n.addPlan(l)}else a=GS(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===iS.Instance&&null!==e.implementationType){var s=function(t,e){return OS(t,TS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=jS(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===nS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=KS(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=iw(iw({},s),{constr:t});n=s.isAsync?function(t){return nw(this,void 0,void 0,(function(){var e,i;return sw(this,(function(n){switch(n.label){case 0:return[4,lw(t.constructorInjections)];case 1:return e=n.sent(),[4,lw(t.propertyInjections)];case 2:return i=n.sent(),[2,ow(iw(iw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):ow(r)}else n=new t;return n}function ow(t){var e,i=new((e=t.constr).bind.apply(e,rw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function lw(t){return nw(this,void 0,void 0,(function(){var e,i,n,s;return sw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),Ow=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new Lw,onDeactivations:new Lw}},t}(),Fw=function(){return Fw=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new iA(e,i)})).inSingletonScope().whenTargetNamed(e)}class sA{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>t.name!==i&&(!e||t.fn===e))))}_parseOptions(t,e,i){let n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class rA extends sA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const aA=Symbol.for("EnvContribution"),oA=Symbol.for("Global");var lA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,n){e(i,n,t)}};let dA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new rA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}};dA=lA([Xw(),cA(0,qw(eA)),cA(0,$w(aA)),hA("design:paramtypes",[Object])],dA);const uA=kt-1e-8;class pA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>uA)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(n),g(s),s!==n)if((n%=kt)<0&&(n+=kt),(s%=kt)<0&&(s+=kt),ss;++o,a-=At)g(a);else for(a=n-n%At+At,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const fA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,mA={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},yA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let _A,vA,bA,xA,SA,wA;var AA,kA,MA,CA,TA,EA,PA,RA,BA;function IA(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(n),g=Math.sin(n),f=Math.cos(s),m=Math.sin(s),y=.5*(s-n),_=Math.sin(.5*y),v=8/3*_*_/Math.sin(y),b=e+p-v*g,x=i+g+v*p,S=e+f,w=i+m,A=S+v*m,k=w-v*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function DA(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Gt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,m=c/i,y=-c/n,_=d/n,v=f*o+m*l,b=y*o+_*l,x=f*t+m*e,S=y*t+_*e;let w=1/((x-v)*(x-v)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(v+x)-A*(S-b),M=.5*(b+S)+A*(x-v),C=Math.atan2(b-M,v-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=kt:T>0&&0===r&&(T-=kt);const E=Math.ceil(Math.abs(T/(At+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*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 FA(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class XA extends YA{bezierCurveTo(t,e,i,n,s,r,a){return super.bezierCurveTo(e,t,n,i,r,s,a)}lineTo(t,e,i){return super.lineTo(e,t,i)}moveTo(t,e){return super.moveTo(e,t)}clear(){return super.clear()}}function $A(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class KA{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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function qA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new KA(s,n),t),s}function ZA(t,e,i,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,n)}class JA{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&&ZA(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2),(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):this.context.moveTo(e,i);break;case 1:this._point=2;break;default:ZA(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}tryUpdateLength(){return this.context.tryUpdateLength()}}function QA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("basis",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new JA(s,n),t),s}function tk(t){return t<0?-1:1}function ek(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(tk(r)+tk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function ik(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function nk(t,e,i,n){const s=t._x0,r=t._y0,a=t._x1,o=t._y1,l=(a-s)/3;t.context.bezierCurveTo(s+l,r+l*e,a-l,o-l*i,a,o,n)}class sk{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._lastDefined2);break;case 3:nk(this,this._t0,ik(this,this._t0),!1!==this._lastDefined2)}(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;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(i,n);break;case 1:this._point=2;break;case 2:this._point=3,nk(this,ik(this,e=ek(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:nk(this,this._t0,e=ek(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}}tryUpdateLength(){return this.context.tryUpdateLength()}}class rk extends sk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function ak(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new YA("monotoneX",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new sk(s,n),t),s}function ok(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return qA(t,e);const s=new XA("monotoneY",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new rk(s,n),t),s}let lk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined):this.context.moveTo(e,i);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined)}}this._lastDefined=t.defined,this._x=e,this._y=i}tryUpdateLength(){return this.context.tryUpdateLength()}};function hk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new YA("step",null!=n?n:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new lk(r,e,s),t),r}class ck{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.context.closePath()}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):this.context.moveTo(e,i);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function dk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new YA("linear",null!=i?i:Ct(t[t.length-1].x-t[0].x)>Ct(t[t.length-1].y-t[0].y)?PA.ROW:PA.COLUMN);return function(t,e){$A(t,e)}(new ck(s,n),t),s}function uk(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}class pk extends gA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new pA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([yA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([yA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([yA.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([yA.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([yA.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([yA.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([yA.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([yA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([yA.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}toString(){if(!this.toStringCbList){const t=[];t[yA.M]=t=>`M${t[1]} ${t[2]}`,t[yA.L]=t=>`L${t[1]} ${t[2]}`,t[yA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[yA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[yA.A]=t=>{const e=[];LA(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;t"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;twA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),FA(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===PA.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===PA.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)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const gk=["l",0,0,0,0,0,0,0];function fk(t,e,i){const n=gk[0]=t[0];if("a"===n||"A"===n)gk[1]=e*t[1],gk[2]=i*t[2],gk[3]=t[3],gk[4]=t[4],gk[5]=t[5],gk[6]=e*t[6],gk[7]=i*t[7];else if("h"===n||"H"===n)gk[1]=e*t[1];else if("v"===n||"V"===n)gk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Pk=Object.assign(Object.assign({},Sk),{points:[],cornerRadius:0}),Rk=Object.assign(Object.assign({},Sk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),Bk=Object.assign(Object.assign({},Sk),{width:0,height:0,cornerRadius:0,length:0}),Ik=Object.assign(Object.assign({},Sk),{symbolType:"circle",size:10,keepDirIn3d:!0}),Dk=Object.assign(Object.assign(Object.assign({},Sk),bk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Lk=Object.assign(Object.assign({},Sk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Ok=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Sk),{fill:!0}),Fk=Object.assign(Object.assign({},Ok),{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});var zk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Hk=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Dk.fontSize}=e,n=0,s=0;for(let e=0;ei?{str:"",width:0}:this._clipText(t,e,i,0,t.length-1))}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(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._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffix(t,e,i,n){if(""===n)return this.clipText(t,e,i);if(0===t.length)return{str:"",width:0};const s=this.measureTextWidth(t,e);if(s<=i)return{str:t,width:s};const r=this.measureTextWidth(n,e);if(r>i)return{str:"",width:0};i-=r;const a=this._clipText(t,e,i,0,t.length-1);return a.str+=n,a.width+=r,a}};Hk=zk([Xw()],Hk);var jk=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Nk=Symbol.for("TextMeasureContribution");let Vk=class extends Hk{};Vk=jk([Xw()],Vk);const Wk=new Nw;const Gk=new class{},Uk=Symbol.for("CanvasFactory"),Yk=Symbol.for("Context2dFactory");function Xk(t){return Wk.getNamed(Uk,Gk.global.env)(t)}const $k=1e-4,Kk=Math.sqrt(3),qk=1/3;function Zk(t){return t>-dM&&tdM||t<-dM}const Qk=[0,0],tM=[0,0],eM=[0,0];function iM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function nM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function sM(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 rM(t){return(t%=Mt)<0&&(t+=Mt),t}function aM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function oM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Mt);let d=Math.atan2(l,o);return d<0&&(d+=Mt),d>=n&&d<=s||d+Mt>=n&&d+Mt<=s}function cM(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(Zk(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 pM=[-1,-1,-1],gM=[-1,-1];function fM(){const t=gM[0];gM[0]=gM[1],gM[1]=t}function mM(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Zk(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,qk):Math.pow(i,qk),n=n<0?-Math.pow(-n,qk):Math.pow(n,qk);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+Kk*Math.sin(e)))/(3*a),h=(-o+i*(n-Kk*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,pM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&fM(),p=sM(e,n,r,o,gM[0]),u>1&&(g=sM(e,n,r,o,gM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(Zk(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,pM);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=nM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);pM[0]=-l,pM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Mt-1e-4){n=0,s=Mt;const e=r?1:-1;return a>=pM[0]+t&&a<=pM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Mt,s+=Mt);let c=0;for(let e=0;e<2;e++){const i=pM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Mt+t),(t>=n&&t<=s||t+Mt>=n&&t+Mt<=s)&&(t>wt/2&&t<1.5*wt&&(e=-e),c+=e)}}return c}function vM(t){return Math.round(t/wt*1e8)/1e8%2*wt}function bM(t,e){let i=vM(t[0]);i<0&&(i+=Mt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Mt?s=i+Mt:e&&i-s>=Mt?s=i-Mt:!e&&i>s?s=i+(Mt-vM(i-s)):e&&i1&&(i||(h+=aM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],y=a[2],_=a[3],v=a[4],b=a[5],x=a[6];let S=v,w=b;xM[0]=S,xM[1]=w,bM(xM,Boolean(a[6])),S=xM[0],w=xM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-m)*_/_+m;switch(f){case yA.M:u=m,p=y,c=u,d=p;break;case yA.L:if(i){if(cM(c,d,m,y,e,n,s))return!0}else h+=aM(c,d,m,y,n,s)||0;c=m,d=y;break;case yA.C:if(i){if(lM(c,d,m,y,_,v,b,x,e,n,s))return!0}else h+=mM(c,d,m,y,_,v,b,x,n,s)||0;c=b,d=x;break;case yA.Q:if(i){if(oM(c,d,m,y,_,v,e,n,s))return!0}else h+=yM(c,d,m,y,_,v,n,s)||0;c=_,d=v;break;case yA.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+y,g?(u=o,p=l):h+=aM(c,d,o,l,n,s),i){if(hM(m,y,_,A,A+k,M,e,C,s))return!0}else h+=_M(m,y,_,A,A+k,M,C,s);c=Math.cos(A+k)*_+m,d=Math.sin(A+k)*_+y;break;case yA.R:if(u=c=m,p=d=y,o=u+_,l=p+v,i){if(cM(u,p,o,p,e,n,s)||cM(o,p,o,l,e,n,s)||cM(o,l,u,l,e,n,s)||cM(u,l,u,p,e,n,s))return!0}else h+=aM(o,p,o,l,n,s),h+=aM(u,l,u,p,n,s);break;case yA.Z:if(i){if(cM(c,d,u,p,e,n,s))return!0}else h+=aM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AM=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kM=function(t,e){return function(i,n){e(i,n,t)}};let MM=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){if(this.configured)return;const i=Xk({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:bk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new He(Object.assign({defaultFontParams:{fontFamily:bk.fontFamily,fontSize:bk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var CM;MM=wM([Xw(),kM(0,qw(eA)),kM(0,$w(Nk)),kM(1,qw(oA)),AM("design:paramtypes",[Object,Object])],MM),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(CM||(CM={}));const TM=new qt;let EM=class{constructor(){this.matrix=new qt}init(t){return this.mode=CM.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=CM.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(TM.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(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}scale(t,e,i){return this.mode===CM.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return TM.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(TM.a,TM.b,TM.c,TM.d,TM.e,TM.f),this}translate(t,e){return this.mode===CM.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===CM.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};EM=wM([Xw(),AM("design:paramtypes",[])],EM);const PM={arc:wk,area:Ak,circle:kk,line:Tk,path:Ek,symbol:Ik,text:Dk,rect:Rk,rect3d:Bk,polygon:Pk,richtext:Lk,richtextIcon:Fk,image:Ok,group:Mk,glyph:Ck},RM=Object.keys(PM);function BM(){return{arc:Object.assign({},PM.arc),area:Object.assign({},PM.area),circle:Object.assign({},PM.circle),line:Object.assign({},PM.line),path:Object.assign({},PM.path),symbol:Object.assign({},PM.symbol),text:Object.assign({},PM.text),rect:Object.assign({},PM.rect),rect3d:Object.assign({},PM.rect3d),polygon:Object.assign({},PM.polygon),richtext:Object.assign({},PM.richtext),richtextIcon:Object.assign({},PM.richtextIcon),image:Object.assign({},PM.image),group:Object.assign({},PM.group),glyph:Object.assign({},PM.glyph)}}function IM(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const DM=new Array(60).fill(0).map((()=>BM()));class LM{constructor(){this._defaultTheme=DM.pop()||BM(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?IM(this.userTheme,t.userTheme,!1):this.userTheme=P(t.userTheme),IM(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);RM.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const OM=new LM;function FM(t,e){return t.glyphHost?FM(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):OM.getTheme()}return null}(t)||OM.getTheme()}class zM{static GenAutoIncrementId(){return zM.auto_increment_id++}}zM.auto_increment_id=0;var HM=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 jM extends r{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=zM.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return HM(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){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof WM))return void console.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(XM(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=XM(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");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),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 WM))return void console.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=XM(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(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 WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=XM(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.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof WM))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=YM.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(XM(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(XM(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,XM(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof WM))return void console.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"):XM(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 GM))return void console.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.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;if(!this.rootTarget)return;const i=this.mappingTable[t.type];let n;const s=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[s])?n=this._prePointTargetCache[s]:(n=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[s]:n}),i)for(let e=0,s=i.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){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=0&&t<=C(this.rootTarget,"width")&&e>=0&&e<=C(this.rootTarget,"height")?this.rootTarget:null,i}}const KM={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof NM))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new UM(t,e))}},qM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class ZM{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(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,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new $M(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new WM,this.rootWheelEvent=new GM,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&f(t)&&!E(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class JM{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const QM=(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"},tC=(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 eC extends r{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=YM.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none"}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=YM.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||QM(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=tC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=YM.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=tC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=QM(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=YM.now()-i>this.config.press.time&&tC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class nC{static Avaliable(){return!0}avaliable(){return nC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class sC{static Avaliable(){return!!Gk.global.getRequestAnimationFrame()}avaliable(){return sC.Avaliable()}tick(t,e){Gk.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var rC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(rC||(rC={}));class aC{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-aC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*aC.bounceIn(2*t):.5*aC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Mt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Mt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Mt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Mt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Mt/e)*.5+1}}}aC.quadIn=aC.getPowIn(2),aC.quadOut=aC.getPowOut(2),aC.quadInOut=aC.getPowInOut(2),aC.cubicIn=aC.getPowIn(3),aC.cubicOut=aC.getPowOut(3),aC.cubicInOut=aC.getPowInOut(3),aC.quartIn=aC.getPowIn(4),aC.quartOut=aC.getPowOut(4),aC.quartInOut=aC.getPowInOut(4),aC.quintIn=aC.getPowIn(5),aC.quintOut=aC.getPowOut(5),aC.quintInOut=aC.getPowInOut(5),aC.backIn=aC.getBackIn(1.7),aC.backOut=aC.getBackOut(1.7),aC.backInOut=aC.getBackInOut(1.7),aC.elasticIn=aC.getElasticIn(1,.3),aC.elasticOut=aC.getElasticOut(1,.3),aC.elasticInOut=aC.getElasticInOut(1,.3*1.5);const oC=new class{constructor(){this.id=zM.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===CA.END?this.removeAnimate(e):e.status===CA.RUNNING||e.status===CA.INITIAL?(this.animateCount++,e.advance(t)):e.status===CA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class lC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class hC extends lC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let cC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:zM.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oC;this.id=t,this.timeline=e,this.status=CA.INITIAL,this.tailAnimate=new dC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Pt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&TA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:MA.ANIMATE_PLAY})}runCb(t){const e=new hC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===CA.RUNNING&&(this.status=CA.PAUSED)}resume(){this.status===CA.PAUSED&&(this.status=CA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new dC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===CA.RUNNING&&(this.status=CA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=CA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};cC.mode=TA.NORMAL,cC.interpolateMap=new Map;class dC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new uC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?aC[i]:i,s=this._addStep(e,null,n);return s.type=EA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?aC[i]:i,r=this._addStep(e,null,s);return r.type=EA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=EA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=EA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new uC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class uC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const pC=200,gC="cubicOut",fC=1e3,mC="quadInOut";var yC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(yC||(yC={}));const _C=[!1,!1,!1,!1],vC=[0,0,0,0],bC=t=>t?m(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(vC[0]=t[0],vC[2]=t[0],vC[1]=t[1],vC[3]=t[1],vC):t:t:0,xC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],SC=[1,2,3,0,1,2,3,0];function wC(t,e,i,n){for(;t>=Mt;)t-=Mt;for(;t<0;)t+=Mt;for(;t>e;)e+=Mt;xC[0].x=i,xC[1].y=i,xC[2].x=-i,xC[3].y=-i;const s=Math.ceil(t/At)%4,r=Math.ceil(e/At)%4;if(n.add(Et(t)*i,Bt(t)*i),n.add(Et(e)*i,Bt(e)*i),s!==r||e-t>wt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Ht(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Ht(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=AC(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class RC extends lC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:MA.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class BC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,m;const y=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=y.width)&&void 0!==o?o:0,v=null!==(l=y.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=Gk.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:v/2,outerRadius:null!==(m=null==s?void 0:s.radius)&&void 0!==m?m:(_+v)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class IC extends RC{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,y=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",_=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",v=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=Gk.graphicService.creator.rect({x:0,y:0,width:"in"===y&&"x"===_?0:f,height:"in"===y&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===v?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===v?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===y?x:S,"in"===y?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class DC extends lC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Mt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+wt/2;i.alpha>Mt;)i.alpha-=Mt;i.alpha=Mt-i.alpha,i.zIndex=-1e4*i.z}}class LC extends lC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class OC extends lC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?aC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function FC(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function zC(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{rt(e,n)&&rt(i,s)||t.push(e,i,n,s,n,s)};function GC(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:im:i2&&i.push(n),i}function UC(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 i=t.filter((t=>!1!==t.defined&&v(t.x)&&v(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),qC=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.length-1];o.edgeIndex>l.edgeIndex&&([o,l]=[l,o]);const h=o.point,c=l.point,d=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)d.push({x:t[e].x,y:t[e].y});d.push({x:c.x,y:c.y});const u=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},ZC=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Vt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return qC(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return qC(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);ZC(s[0],n,i),ZC(s[1],e-n,i)}};var JC={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const QC={};for(const t in JC)E(JC,t)&&(QC[JC[t]]=t);const tT={to:{},get:{}};function eT(t,e,i){return Math.min(Math.max(e,t),i)}function iT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}tT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=tT.get.hsl(t,n),i="hsl";break;case"hwb":e=tT.get.hwb(t,n),i="hwb";break;default:e=tT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},tT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=JC[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=eT(e[n],0,255);return e[3]=eT(e[3],0,1),e},tT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=eT(parseFloat(i[2]),0,100),e[2]=eT(parseFloat(i[3]),0,100),e[3]=eT(isNaN(t)?1:t,0,1),e}return null},tT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},tT.to.keyword=function(t){return QC[t.slice(0,3)]};const nT=tT;var sT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(sT||(sT={}));class rT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:sT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===sT.Color1){let e=rT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=tT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];rT.store1[t]=s,rT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=rT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=tT.get(t),n&&n.value){const e=n.value;rT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],rT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===sT.Color1){if(rT.store1[t])return;rT.store1[t]=i,rT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(rT.store255[t])return;rT.store255[t]=i,rT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function aT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 oT(t,e,i,n,s){if(!t||!e)return t&&aT(t)||e&&aT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=rT.Get(t,sT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=rT.Get(e,sT.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:aT(a)})))});return o?oT(r,l,i,n,s):oT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(n.length).fill(0).map(((t,e)=>({color:cT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),aT(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),n)}rT.store255={},rT.store1={};const lT=[0,0,0,0],hT=[0,0,0,0];function cT(t,e,i){return rT.Get(t,sT.Color255,lT),rT.Get(e,sT.Color255,hT),`rgba(${Math.round(lT[0]+(hT[0]-lT[0])*i)},${Math.round(lT[1]+(hT[1]-lT[1])*i)},${Math.round(lT[2]+(hT[2]-lT[2])*i)},${lT[3]+(hT[3]-lT[3])*i})`}const dT=(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=oT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},uT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?GC(t):[],s=GC(e);i&&n&&(i.fromTransform&&UC(n,i.fromTransform.clone().getInverse()),UC(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},gT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],fT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!gT.includes(s))return;const r=e[s];h(r)||h(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?rT.Get(t[s],sT.Color255):t[s],to:"string"==typeof r?rT.Get(r,sT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class mT extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs,this.saveOnEnd=t.saveOnEnd}getEndProps(){return{}}onBind(){this.target.createPathProxy(),this.onUpdate(!1,0,this.target.attribute)}onEnd(){}onUpdate(t,e,i){const n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;uT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&dT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const yT=(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=pT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=fT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new mT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:fC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:mC)),c};class _T extends lC{constructor(t,e,i){super(0,1,e,i),this.morphingData=t.morphingData,this.otherAttrs=t.otherAttrs}getEndProps(){return{}}onBind(){this.addPathProxy()}addPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.createPathProxy()})),this.onUpdate(!1,0,this.target.attribute)}clearPathProxy(){this.target.shadowRoot.forEachChildren((t=>{t.pathProxy=null}))}onEnd(){}onUpdate(t,e,i){this.target.shadowRoot.forEachChildren(((t,i)=>{var n;uT(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&&dT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const vT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>MC.includes(t))(i)||(e[i]=t[i])})),e},bT=(t,e,i)=>{const n=vT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=Gk.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},xT=(t,e,i)=>{const n=[],s=i?null:vT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:vT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=XC(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(Gk.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=XC(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=XC(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(Gk.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return $C(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 $C(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(Gk.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:KC(i)}];const n=[];return ZC(i,e,n),n})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.segments;r||(r=a.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[]));const o=r.filter((t=>!1!==t.defined&&v(t.x)&&v(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 ZC(r,e,h),h})(t,e).forEach((t=>{n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=GC(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(Gk.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(Gk.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&bT(t,n,e),n};class wT{static GetImage(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=wT.cache.get(t);n?"fail"===n.loadState?Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&Gk.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},wT.cache.set(t,n),n.dataPromise=Gk.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=wT.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},wT.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gk.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gk.global.loadBlob(t):"json"===e&&(i.dataPromise=Gk.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}wT.cache=new Map;const AT=new qt,kT=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],MT=["x","y"],CT=["scaleX","scaleY"],TT=["angle"],ET=new Ht;class PT extends jM{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new Wt,this._updateTag=AA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=FM(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;ET.x=i+e,ET.y=n+s}else ET.x=i,ET.y=n;return ET}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new qt),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&AA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&AA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&AA.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&AA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=AA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===kA.GLOBAL){const i=new Ht(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){Gk.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!h(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:pC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:gC)}else this.setAttributes(t,!1,{type:MA.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();E(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=AA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=AA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&AA.UPDATE_SHAPE_AND_BOUNDS)===AA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=AA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=AA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=AA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=mk.x,y:e=mk.y,scaleX:i=mk.scaleX,scaleY:n=mk.scaleY,angle:s=mk.angle,anchor:r,postMatrix:a}=this.attribute,o=[0,0];if(r){if("string"==typeof r[0]){const t=parseFloat(r[0])/100,e=this.AABBBounds;o[0]=e.x1+(e.x2-e.x1)*t}else o[0]=r[0];if("string"==typeof r[1]){const t=parseFloat(r[1])/100,e=this.AABBBounds;o[1]=e.x1+(e.x2-e.x1)*t}else o[1]=r[1]}!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Et(a),f=Bt(a);let m,y;o?(m=o[0],y=o[1]):(m=i,y=n);const _=m-i,v=y-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*m+c*y-b*_-S*v,t.f=p+h*m+d*y-x*_-w*v}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,r&&o);const l=this.getOffsetXY(mk);if(this._transMatrix.e+=l.x,this._transMatrix.f+=l.y,a){const t=AT.setValue(a.a,a.b,a.c,a.d,a.e,a.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:MA.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=oT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=oT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return FM(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gk.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return f(t,!0)?this.pathProxy=(new pk).fromString(t):this.pathProxy=new pk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};var s;this.resources.set(i,n),"string"==typeof t?(n.state="loading",x(t)||(s=t,new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(s))?(wT.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new UM(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}PT.mixin(KM);var RT=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 BT(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let IT=0;function DT(){return IT++}const LT=DT(),OT=DT(),FT=DT(),zT=DT(),HT=DT(),jT=DT(),NT=DT(),VT=DT(),WT=DT(),GT=DT(),UT=DT(),YT=DT(),XT=DT(),$T=DT(),KT=DT(),qT=DT(),ZT=Symbol.for("GraphicService"),JT=Symbol.for("GraphicCreator");var QT;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(QT||(QT={}));let tE=class t extends PT{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=jT,this._childUpdateTag=AA.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new LM),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new LM)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===kA.GLOBAL){const i=new Ht(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&AA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Gk.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return Gk.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=FM(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=Gk.graphicService.updateGroupAABBBounds(t,FM(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=bC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=AA.CLEAR_BOUNDS,this._childUpdateTag&=AA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&AA.UPDATE_BOUNDS||(this._childUpdateTag|=AA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Gk.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Gk.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,Gk.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{Gk.graphicService.onRemove(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Gk.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&AA.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=Gk.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const eE=Symbol.for("LayerHandlerContribution");class iE extends tE{get offscreen(){return this.layerHandler.offscreen}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=Wk.get(eE),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 LM,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Gk.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){throw new Error("暂不支持")}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Gk.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var nE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rE=function(t,e){return function(i,n){e(i,n,t)}};let aE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new iE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};aE=nE([Xw(),rE(0,qw(oA)),sE("design:paramtypes",[Object])],aE);var oE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hE=function(t,e){return function(i,n){e(i,n,t)}};const cE=Symbol.for("Window"),dE=Symbol.for("WindowHandlerContribution");let uE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new rA(["x","y","width","height"])},this._uid=zM.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(Wk.getNamed(dE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};oE([tA(),lE("design:type",Function),lE("design:paramtypes",[]),lE("design:returntype",void 0)],uE.prototype,"postInit",null),uE=oE([Xw(),hE(0,qw(oA)),lE("design:paramtypes",[Object])],uE);const pE=Symbol.for("TransformUtil"),gE=Symbol.for("GraphicUtil"),fE=Symbol.for("LayerService");var mE=new Vw((t=>{t(dA).toSelf().inSingletonScope(),t(oA).toService(dA),t(uE).to(uE),t(cE).toService(uE),t(MM).toSelf().inSingletonScope(),t(gE).toService(MM),t(EM).toSelf().inSingletonScope(),t(pE).toService(EM),t(aE).toSelf().inSingletonScope(),t(fE).toService(aE)}));function yE(t){return!!t}function _E(t,e){let i;return i=m(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function vE(t,e){return t*e>0}function bE(t,e,i,n){return t*e>0&&i>0&&n>0}function xE(t,e){return t*e>0}function SE(t,e,i,n){return t*e>0&&i>0&&n>0}function wE(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=FM(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,m=vE(d,u),y=xE(d,g),_=yE(h),v=_E(c,p);if(!f)return!0;if(!_&&!v)return!0;if(!(m||y||a||o))return!0;e.beginPath();return FA(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),v&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function AE(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function ME(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ct(l-o),c=l>o;let d=!1;if(s=Mt-St)e.moveTo(i+s*Et(o),n+s*Bt(o)),e.arc(i,n,s,o,l,!c),r>St&&(e.moveTo(i+r*Et(l),n+r*Bt(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:m,innerEndAngle:y,innerStartAngle:_}=t.getParsePadAngle(o,l),v=u,b=u,x=u,S=u,w=Math.max(b,v),A=Math.max(x,S);let k=w,M=A;const C=s*Et(f),T=s*Bt(f),E=r*Et(y),P=r*Bt(y);let R,B,I,D;if((A>St||w>St)&&(R=s*Et(m),B=s*Bt(m),I=r*Et(_),D=r*Bt(_),hSt){const t=Rt(v,k),r=Rt(b,k),o=kE(I,D,C,T,s,t,Number(c)),l=kE(R,B,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,s,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Et(Tt(l.y01,l.x01)),n+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+R,n+s*Bt(m))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,m,!c));if(!(r>St)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>St){const t=Rt(S,M),s=Rt(x,M),o=kE(E,P,R,B,r,-s,Number(c)),l=kE(C,T,I,D,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,n,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Et(Tt(l.y01,l.x01)),n+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+I,n+D)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,y,_,c):e.moveTo(i+r*Et(_),n+r*Bt(_))}return a?a[3]&&e.lineTo(i+s*Et(l),n+s*Et(l)):e.closePath(),d}class CE{static GetCanvas(){try{return CE.canvas||(CE.canvas=Gk.global.createCanvas({})),CE.canvas}catch(t){return null}}static GetCtx(){if(!CE.ctx){const t=CE.GetCanvas();CE.ctx=t.getContext("2d")}return CE.ctx}}class TE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=CE.GetCanvas(),n=CE.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=TE.dataMap.get(i);return n||(n=new TE(t,e),TE.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){TE.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return TE.dataMap.get(t)}}TE.dataMap=new Map;class EE{static GetSize(t){for(let e=0;e=t)return EE.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=EE.GenKey(t,e,i,n,s),l=EE.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=EE.GenKey(t,e,i,n,s);EE.cache[l]?EE.cache[l].push({width:a,height:o,pattern:r}):EE.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,n,s){return`${e},${i},${n},${s},${t.join()}`}}EE.cache={},EE.ImageSize=[20,40,80,160,320,640,1280,2560];const PE=Symbol.for("ArcRenderContribution"),RE=Symbol.for("AreaRenderContribution"),BE=Symbol.for("CircleRenderContribution"),IE=Symbol.for("GroupRenderContribution"),DE=Symbol.for("ImageRenderContribution"),LE=Symbol.for("PathRenderContribution"),OE=Symbol.for("PolygonRenderContribution"),FE=Symbol.for("RectRenderContribution"),zE=Symbol.for("SymbolRenderContribution"),HE=Symbol.for("TextRenderContribution"),jE=Symbol.for("InteractiveSubRenderContribution");var NE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},WE=function(t,e){return function(i,n){e(i,n,t)}};let GE=class{constructor(t){this.arcRenderContribitions=t,this.numberType=LT}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Ct(d-c),p=d>c;let g=!1;if(sSt||M>St)&&(D=s*Et(v),L=s*Bt(v),O=r*Et(x),F=r*Bt(x),uSt){const t=Rt(S,T),r=Rt(w,T),a=kE(O,F,P,R,s,t,Number(p)),o=kE(D,L,B,I,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>St)||y<.001)e.lineTo(i+B,n+I),g=!0;else if(E>St){const t=Rt(k,E),s=Rt(A,E),a=kE(B,I,D,L,r,-s,Number(p)),o=kE(P,R,O,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!p);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Et(x),n+r*Bt(x));return g}drawShape(t,e,i,n,s,r,a,l){const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible,x:_=h.x,y:v=h.y}=t.attribute,b=vE(p,g),x=xE(p,m),S=yE(c),w=_E(u,f);if(!t.valid||!y)return;if(!(S||w||d))return;if(!(b||x||a||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=!1;const{isFullStroke:E,stroke:P}=(t=>{var e;let i=!0;if(o(t,!0)){for(let n=0;n<4;n++)_C[n]=t,i&&(i=!(null!==(e=_C[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)_C[e]=!!t[e],i&&(i=!!_C[e]);else _C[0]=!1,_C[1]=!1,_C[2]=!1,_C[3]=!1;return{isFullStroke:i,stroke:_C}})(u);if(S||E||d){if(e.beginPath(),ME(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(a?a(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,_-i,v-n,h),e.fill())),w&&E&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,_-i,v-n,h),e.stroke()))}if(!E&&w){if(e.beginPath(),ME(t,e,i,n,A,k,P),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if(M&&C){const{startAngle:r,endAngle:o}=t.getParsedAngle();if(Ct(o-r)>=Mt-St){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:o=h.endAngle,fill:c=h.fill}=t.attribute,d=o;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!T){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===BA.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}T=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Mt;for(;i>Mt;)i-=Mt;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),oT(o.color,l.color,h,!1)}(0,0,o,s);a||vE&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,a,l)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};GE=NE([Xw(),WE(0,qw(eA)),WE(0,$w(PE)),VE("design:paramtypes",[Object])],GE);var UE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XE=function(t,e){return function(i,n){e(i,n,t)}};let $E=class{constructor(t){this.circleRenderContribitions=t,this.numberType=zT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:m=l.strokeOpacity,opacity:y=l.opacity,lineWidth:_=l.lineWidth,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(y,f),w=xE(y,m),A=yE(h),k=_E(d,_);t.valid&&v&&(A||k||c)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};$E=UE([Xw(),XE(0,qw(eA)),XE(0,$w(BE)),YE("design:paramtypes",[Object])],$E);const KE=["radius","startAngle","endAngle",...kT];class qE extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=zT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}doUpdateAABBBounds(t){const e=FM(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateCircleAABBBounds(i,FM(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function JE(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function QE(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class tP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o){const l=[],h=[e,i],c=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a);l.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?c[0]=h[0]/-2:"right"!==n&&"end"!==n||(c[0]=-h[0])),"top"===s||("middle"===s?c[1]=h[1]/-2:"bottom"===s&&(c[1]=-h[1]));const d={xOffset:c[0],yOffset:c[1],width:h[0],height:h[1]};return this.layoutWithBBox(d,l,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0;t=t.map((t=>t.toString()));const a=[],o=[0,0];if("number"==typeof r&&r!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=qT,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=FM(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){var e;const i=FM(this).text,n=Gk.graphicUtil.textMeasure;let s,r;const a=2,o=this.attribute,{maxLineWidth:l=i.maxLineWidth,ellipsis:h=i.ellipsis,textAlign:c=i.textAlign,textBaseline:d=i.textBaseline,fontSize:u=i.fontSize,fontWeight:p=i.fontWeight,stroke:g=i.stroke,lineHeight:f=(null!==(e=o.lineHeight)&&void 0!==e?e:(o.fontSize||i.fontSize)+a),lineWidth:m=i.lineWidth}=o;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=JE(c,s),e=QE(d,f,u);return this._AABBBounds.set(t,e,t+s,e+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}if(Number.isFinite(l)){if(h){const e=!0===h?i.ellipsis:h,a=n.clipTextWithSuffix(t.toString(),{fontSize:u,fontWeight:p},l,e);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:u,fontWeight:p},l);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:u,fontWeight:p}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=JE(c,s),_=QE(d,f,u);return this._AABBBounds.set(y,_,y+s,_+f),g&&this._AABBBounds.expand(m/2),this._AABBBounds}updateMultilineAABBBounds(t){var e;const i=FM(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth}=n;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 g=Gk.graphicUtil.textMeasure,f=new tP(s,{fontSize:o,fontWeight:l},g).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,d),{bbox:m}=f;return this.cache.layoutData=f,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).text[t]}needUpdateTags(t){for(let e=0;e{WP[t.type]=t}));const GP=["symbolType","size",...kT];let UP=class t extends PT{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=KT}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return m(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=FM(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=WP[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new pk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Pt(r,a);return s.transform(0,0,o,o),this._parsedPath=new VP(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=FM(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateSymbolAABBBounds(i,FM(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=VT}isValid(){return super.isValid()&&this._isValid()}_isValid(){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=kC(i,n,e))}doUpdateAABBBounds(){const t=FM(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateLineAABBBounds(e,FM(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const $P=["width","height","cornerRadius",...kT];class KP extends PT{constructor(t){super(t),this.type="rect",this.numberType=YT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=FM(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRectAABBBounds(e,FM(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).rect[t]}needUpdateTags(t){for(let e=0;e<$P.length;e++){const i=$P[e];if(-1!==t.indexOf(i))return!0}return!1}needUpdateTag(t){for(let e=0;e<$P.length;e++)if(t===$P[e])return!0;return!1}toCustomPath(){const t=this.attribute,e=t.width,i=t.height,n=new pk;return n.moveTo(0,0),n.rect(0,0,e,i),n}clone(){return new KP(Object.assign({},this.attribute))}}const qP=[[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 ZP extends KP{constructor(t){super(t),this.type="rect3d",this.numberType=XT}findFace(){const t={polygons:[],vertices:[],edges:[]},e=FM(this).rect3d,{width:i=e.width,height:n=e.width,length:s=Rt(e.width,e.height)}=this.attribute;for(let e=0;e{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){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=Gk.graphicService.updateGlyphAABBBounds(this.attribute,FM(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new JP(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}const QP={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"}},tR=!0,eR=!1,iR=/\w|\(|\)/,nR=/[.?!,;:/,。?!、;:]/,sR=/\S/;function rR(t,e,i,n,s){if(!e||e<=0)return 0;const r=Gk.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=function(t,e){let i=e;for(;iR.test(t[i-1])&&iR.test(t[i])||nR.test(t[i]);)if(i--,i<=0)return e;return i}(t,a)),a}function aR(t,e){const i=Gk.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}class oR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=QP[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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,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=this.lines[i].getWidthWithEllips();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((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=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(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=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class lR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=aR(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=aR(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=rR(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=aR(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||eR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||tR;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=rR(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=aR(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const hR=["width","height","image",...kT];class cR extends PT{constructor(t){super(t),this.type="image",this.numberType=NT,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=FM(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateImageAABBBounds(e,FM(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Ok[t]}needUpdateTags(t){for(let e=0;e{if(m(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=bC(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Ok.width,height:e=Ok.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 uR{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 dR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=QP[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof lR){const e=sR.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof dR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof dR)break;const{width:n}=aR("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof dR?t.width:t.getWidthWithEllips(this.direction)})),e}}class pR{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=QP[this.direction]}store(t){if(t instanceof dR){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 uR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t){t instanceof dR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=rR(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new lR(i,t.newLine,t.character),new lR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const gR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...kT];class fR extends PT{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=$T}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.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:Lk.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=FM(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateRichTextAABBBounds(e,FM(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return Lk[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new pR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const mR=["path","customPath",...kT];class yR extends PT{constructor(t){super(t),this.type="path",this.numberType=WT}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=FM(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pk?e.path:(h(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pk?this.cache:t.path)}doUpdateAABBBounds(){const t=FM(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePathAABBBounds(e,FM(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;f(t.path,!0)?this.cache=(new pk).fromString(t.path):t.customPath&&(this.cache=new pk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return FM(this).path[t]}needUpdateTags(t){for(let e=0;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 vR(Object.assign({},this.attribute))}}const bR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kT];class xR extends PT{constructor(t){super(t),this.type="arc",this.numberType=LT}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=FM(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(v(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=FM(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Xt(e),i=e+r,n&&Ct(r)St&&o>St)return{startAngle:e-s*c*r,endAngle:i+s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=FM(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=It(n*n+s*s)}=this.attribute,o=Ct(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>St&&a>St){const i=e>t?1:-1;let r=Ot(Number(a)/s*Bt(u)),o=Ot(Number(a)/n*Bt(u));return(p-=2*r)>St?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>St?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=Gk.graphicService.updateArcAABBBounds(i,FM(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=bC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Mt-St)o.moveTo(0+s*Et(e),0+s*Bt(e)),o.arc(0,0,s,e,i,!a),n>St&&(o.moveTo(0+n*Et(i),0+n*Bt(i)),o.arc(0,0,n,i,e,a));else{const t=s*Et(e),r=s*Bt(e),l=n*Et(i),h=n*Bt(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new xR(Object.assign({},this.attribute))}}class SR extends xR{constructor(t){super(t),this.type="arc3d",this.numberType=OT}doUpdateAABBBounds(){const t=FM(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updateArc3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const wR=["points","cornerRadius",...kT];class AR extends PT{constructor(t){super(t),this.type="polygon",this.numberType=GT}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePolygonAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=kC(i,n,e))}getDefaultAttribute(t){return FM(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new AR(Object.assign({},this.attribute))}}class kR extends AR{constructor(t){super(t),this.type="pyramid3d",this.numberType=UT}doUpdateAABBBounds(){const t=FM(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=Gk.graphicService.updatePyramid3dAABBBounds(e,FM(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=bC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}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}}var MR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CR=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};CR=MR([Xw()],CR);var TR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ER=Symbol.for("RectBoundsContribution");let PR=class extends CR{};PR=TR([Xw()],PR);var RR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const BR=Symbol.for("SymbolBoundsContribution");let IR=class extends CR{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;BT(i,n+r+o/2,!0,a)}return i}};IR=RR([Xw()],IR);var DR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const LR=Symbol.for("CircleBoundsContribution");let OR=class extends CR{};OR=DR([Xw()],OR);var FR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const zR=Symbol.for("ArcBoundsContribution");let HR=class extends CR{};HR=FR([Xw()],HR);var jR=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const NR=Symbol.for("PathBoundsContribution");let VR=class extends CR{};VR=jR([Xw()],VR);class WR{constructor(){this.pools=[]}static identity(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return WR.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XR=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$R=function(t,e){return function(i,n){e(i,n,t)}};function KR(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,y;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],y=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]=y,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+m*r+e[14],t[15]=h*n+p*s+y*r+e[15]),t}function qR(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 ZR(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function JR(t,e,i){var n;const{x:s=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:y}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(n=m[2])&&void 0!==n?n:0}if(function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t),KR(t,t,[s+o,r+l,a+h]),KR(t,t,[_[0],_[1],_[2]]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),KR(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=UR.allocate(),n=[0,0];if(y){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]}KR(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),KR(i,i,[-n[0],-n[1],0]),ZR(t,t,i)}}let QR=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new rA(["graphic"]),onSetStage:new rA(["graphic","stage"]),onRemove:new rA(["graphic"]),onAddIncremental:new rA(["graphic","group","stage"]),onClearIncremental:new rA(["graphic","group","stage"]),beforeUpdateAABBBounds:new rA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new rA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Wt,this.tempAABBBounds2=new Wt}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)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new pA(t);return FA(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){BT(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),Nt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Mt-St?i.set(-a,-a,a,a):wC(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){const{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;let{endAngle:a=e.endAngle,startAngle:o=e.startAngle}=t;if(o>a){const t=o;o=a,a=t}return s<=St?i.set(0,0,0,0):Math.abs(a-o)>Mt-St?i.set(-s,-s,s,s):(wC(o,a,s,i),wC(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(m(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){BT(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){BT(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Nt(e,e,s.transMatrix)}};QR=YR([Xw(),$R(0,qw(JT)),$R(1,qw(eA)),$R(1,$w(ER)),$R(2,qw(eA)),$R(2,$w(BR)),$R(3,qw(eA)),$R(3,$w(LR)),$R(4,qw(eA)),$R(4,$w(zR)),$R(5,qw(eA)),$R(5,$w(NR)),XR("design:paramtypes",[Object,Object,Object,Object,Object,Object])],QR);class tB extends tE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const eB=["heightLimit","lineClamp"];class iB extends iP{_isValid(){const{text:t}=this.attribute;return m(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e;const i=FM(this).text,{fontFamily:n=i.fontFamily,textAlign:s=i.textAlign,textBaseline:r=i.textBaseline,fontSize:a=i.fontSize,lineHeight:o=this.attribute.lineHeight||this.attribute.fontSize||i.fontSize,ellipsis:l=i.ellipsis,maxLineWidth:h,stroke:c=i.stroke,lineWidth:d=i.lineWidth,heightLimit:u=0,lineClamp:p}=this.attribute;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),c&&this._AABBBounds.expand(d/2),this._AABBBounds}const g=Gk.graphicUtil.textMeasure,f=new tP(n,{fontSize:a},g),m=t.map((t=>t.toString())),y=[],_=[0,0];let v=1/0;if(u>0&&(v=Math.max(Math.floor(u/o),1)),p&&(v=Math.min(v,p)),"number"==typeof h&&h!==1/0){if(h>0)for(let t=0;t{t=Math.max(t,e.width)})),_[0]=t}else{let t,e,i=0;for(let n=0,s=m.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bB=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},m=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(m){const n=UR.allocate(),s=UR.allocate();JR(s,t,e),ZR(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),UR.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(m)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,y=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,m,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()}};function xB(t,e,i,n,s){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0}=s||{};let l=!0;const{curves:h}=e;if(i>=1)return void h.forEach((e=>{e.defined?(l&&t.moveTo(e.p0.x+r,e.p0.y+a,o),SB(t,e,1,s),l=!1):l=!0}));if(i<=0)return;let c;"x"===n?c=PA.ROW:"y"===n?c=PA.COLUMN:"auto"===n&&(c=e.direction);const d=i*e.tryUpdateLength(c);let u=0;for(let e=0,i=h.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let AB=class extends bB{constructor(){super(...arguments),this.numberType=VT}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var f;t.beginPath();const y=null!==(f=this.z)&&void 0!==f?f:0;xB(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:y}),u.cache&&!m(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:_=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,_-c,v-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,_-c,v-d,o),t.stroke())),!1}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,m=vE(d,u),y=xE(d,p),_=yE(h),v=_E(c,g);if(!t.valid||!f)return;if(!_&&!v)return;if(!(m||y||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=l.curveType}=t.attribute,s=e;if(i&&i.length){let e,s;t.cache=i.map(((t,i)=>(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),s=uk(t.points,n,{startPoint:e}),s)))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();t.cache=uk(s,n)}t.clearUpdateShapeTag()}const{clipRange:b=l.clipRange,clipRangeByDimension:x=l.clipRangeByDimension}=t.attribute;if(Array.isArray(t.cache))if(1===b){let s=!1;t.cache.forEach(((r,d)=>{s||(s=this.drawSegmentItem(e,r,!!h,!!c,u,p,t.attribute.segments[d],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const s=t.cache.reduce(((t,e)=>t+e.getLength()),0),r=b*s;let d=0,g=!1;t.cache.forEach(((s,f)=>{if(g)return;const m=s.getLength(),y=(r-d)/m;d+=m,y>0&&(g=this.drawSegmentItem(e,s,!!h,!!c,u,p,t.attribute.segments[f],[l,t.attribute],Rt(y,1),x,i,n,t,a,o))}))}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function kB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),MB(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),MB(t,l,1,n),o=!1):o=!0}t.closePath()}function MB(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]=VA(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)}}AB=wB([Xw()],AB);var CB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},EB=function(t,e){return function(i,n){e(i,n,t)}};function PB(t,e,i){switch(e){case"linear":default:return qA(t,i);case"basis":return QA(t,i);case"monotoneX":return ak(t,i);case"monotoneY":return ok(t,i);case"step":return hk(t,.5,i);case"stepBefore":return hk(t,0,i);case"stepAfter":return hk(t,1,i);case"linearClosed":return dk(t,i)}}let RB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=FT}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=FM(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:m=g.fillOpacity,opacity:y=g.opacity,visible:_=g.visible,z:v=g.z,stroke:b=t.attribute.stroke,lineWidth:x=g.lineWidth,strokeOpacity:S=g.strokeOpacity}=t.attribute,w=vE(y,m),A=yE(f),k=_E(b,x),M=xE(y,S);if(!t.valid||!_)return;if(!A&&!k)return;if(!(w||a||M||o))return;const{clipRange:C=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=i.map(((t,i)=>(1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY),s=PB(t.points,n,{startPoint:e}),s)));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=PB(s,n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cache=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=PB(i,n),a=PB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea))if(1===C){let r=!1;t.cacheArea.forEach(((l,h)=>{r||(r=this.drawSegmentItem(e,l,A,m,k,S,t.attribute.segments[h],[g,t.attribute],C,i,n,v,t,s,a,o))}))}else{const r=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),l=C*r;let h=0,c=!1;t.cacheArea.forEach(((r,d)=>{if(c)return;const u=r.top.getLength(),p=(l-h)/u;h+=u,p>0&&(c=this.drawSegmentItem(e,r,A,m,k,S,t.attribute.segments[d],[g,t.attribute],Rt(p,1),i,n,v,t,s,a,o))}))}else this.drawSegmentItem(e,t.cacheArea,A,m,k,S,t.attribute,g,C,i,n,v,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=FM(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){t.beginPath(),function(t,e,i,n){var s;const{top:r,bottom:a}=e;if(i>=1){const e=[],i=[];let s=!0;for(let o=0,l=r.curves.length;od?PA.ROW:PA.COLUMN,Number.isFinite(c)||(o=PA.COLUMN),Number.isFinite(d)||(o=PA.ROW);const u=i*(o===PA.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===BA.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:y=0,x:_=0}=a;if(!1!==i&&(g?g(t,a,o):n&&(t.setCommonStyle(u,a,y-h,_-c,o),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===BA.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,g,null,{attribute:a})})),!1!==s)if(f)f(t,a,o);else{const{stroke:i}=a;m(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),xB(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,"auto",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,y-h,_-c,o),t.stroke()}return!1}};RB=CB([Xw(),EB(0,qw(eA)),EB(0,$w(RE)),TB("design:paramtypes",[Object])],RB);var BB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DB=function(t,e){return function(i,n){e(i,n,t)}};let LB=class extends bB{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=WT}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=FM(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:m,lineWidth:y=c.lineWidth,visible:_=c.visible,x:v=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=vE(f,p),w=xE(f,g),A=yE(d),k=_E(u,y);if(t.valid&&_&&(A||k||m)&&(S||w||a||o||m)){if(e.beginPath(),t.pathShape)FA(t.pathShape.commandList,e,i,n,1,1,x);else{FA((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,v-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,v-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};LB=BB([Xw(),DB(0,qw(eA)),DB(0,$w(LE)),IB("design:paramtypes",[Object])],LB);const OB=wt/2;function FB(t,e,i,n,s,r){let a;if(v(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],m=[l[0],l[1]+u[1]],y=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!G(f,m)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-OB,0,!1)}if(t.lineTo(_[0],_[1]),!G(y,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,OB,!1)}if(t.lineTo(b[0],b[1]),!G(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],OB,wt,!1)}if(t.lineTo(g[0],g[1]),!G(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],wt,wt+OB,!1)}return t.closePath(),t}var zB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jB=function(t,e){return function(i,n){e(i,n,t)}};let NB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=YT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,fillOpacity:y=l.fillOpacity,lineWidth:_=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=bE(f,y,u,p),A=SE(f,v,u,p),k=yE(h),M=_E(d,_);if(!t.valid||!b)return;if(!(k||M||c))return;if(!(w||A||a||o||c))return;0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),FB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};NB=zB([Xw(),jB(0,qw(eA)),jB(0,$w(FE)),HB("design:paramtypes",[Object])],NB);var VB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GB=function(t,e){return function(i,n){e(i,n,t)}};let UB=class extends bB{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=KT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,stroke:y=h.stroke,visible:_=h.visible,x:v=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=vE(f,p),A=xE(f,g),k=yE(d),M=_E(y,m);if(!t.valid||!_)return;if(!(k||M||u))return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,v-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(v-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};UB=VB([Xw(),GB(0,qw(eA)),GB(0,$w(zE)),WB("design:paramtypes",[Object])],UB);var YB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$B=function(t,e){return function(i,n){e(i,n,t)}};let KB=class extends bB{constructor(t){super(),this.textRenderContribitions=t,this.numberType=qT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:m=h.lineWidth,visible:y=h.visible,underline:_=h.underline,lineThrough:v=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,fontSize:x=h.fontSize,textBaseline:S=h.textBaseline,x:w=h.x,y:A=h.y}=t.attribute,k=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:x,M=vE(f,p),C=xE(f,g),T=yE(d),E=_E(u,m);if(!t.valid||!y)return;if(!(T||E||M||C))return;const P=!b,R=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===BA.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}if(this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),P&&this.transformUseContext2d(t,h,R,e),Array.isArray(c)){e.setTextStyleWithoutAlignBaseline(t.attribute,h,R);const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,R)})))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,R),this.drawMultiUnderLine(_,v,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,R,s.width,h,e)}))))}else{e.setTextStyle(t.attribute,h,R);const s=t.clipedText;let r=0;k!==x&&("top"===S?r=(k-x)/2:"middle"===S||"bottom"===S&&(r=-(k-x)/2)),E&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,w-i,A-n,h),e.strokeText(s,i,n+r,R))),T&&(a?a(e,t.attribute,h):M&&(e.setCommonStyle(t,t.attribute,w-i,A-n,h),e.fillText(s,i,n+r,R),this.drawUnderLine(_,v,t,i,n+r,R,h,e)))}P&&this.restoreTransformUseContext2d(t,h,R,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,T,E,M,C,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=JE(l,g),m=QE(h,c,c),y={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){y.lineWidth=t,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const e=s+m+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){y.lineWidth=e,o.setStrokeStyle(i,y,n,s,a),o.beginPath();const t=s+m+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=JE(h,a),f=QE("alphabetic",c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let y=-3;if(t){m.lineWidth=t,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const e=s+f+c+y;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(y=-1,e){m.lineWidth=e,l.setStrokeStyle(i,m,n,s,o),l.beginPath();const t=s+f+c/2+y;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};KB=YB([Xw(),$B(0,qw(eA)),$B(0,$w(HE)),XB("design:paramtypes",[Object])],KB);var qB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZB=class{};function JB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nI=function(t,e){return function(i,n){e(i,n,t)}};let sI=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=GT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:f=l.strokeOpacity,lineWidth:y=l.lineWidth,opacity:_=l.opacity,visible:v=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=vE(_,p),w=xE(_,f),A=yE(c),k=_E(d,y);t.valid&&v&&(A||k||g)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||m(u)&&u.every((t=>0===t))?JB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)JB(t,e,i,n);else for(let a=0;ab&&(y=b,m=b*f);const x=tI(l,y,_,c,d),S=tI(l,y,v,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=QB(w,A),M=tI(l,QB(y,m),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,m),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):f&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=FM(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);wE(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};sI=eI([Xw(),nI(0,qw(eA)),nI(0,$w(OE)),iI("design:paramtypes",[Object])],sI);var rI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oI=function(t,e){return function(i,n){e(i,n,t)}};const lI=["","repeat-x","repeat-y","repeat"];let hI=class{constructor(t){this.imageRenderContribitions=t,this.numberType=NT}drawShape(t,e,i,n,s,r,a){const o=FM(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:m}=t.attribute,y=vE(d,u),_=yE(l);if(t.valid&&p&&_&&(y||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),_)if(a)a(e,t.attribute,o);else if(y){if(!m||!t.resources)return;const s=t.resources.get(m);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,lI[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,_,!1,y,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=FM(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};hI=rI([Xw(),oI(0,qw(eA)),oI(0,$w(DE)),aI("design:paramtypes",[Object])],hI);const cI=Symbol.for("IncrementalDrawContribution"),dI=Symbol.for("ArcRender"),uI=Symbol.for("Arc3dRender"),pI=Symbol.for("AreaRender"),gI=Symbol.for("CircleRender"),fI=Symbol.for("GraphicRender"),mI=Symbol.for("GroupRender"),yI=Symbol.for("LineRender"),_I=Symbol.for("PathRender"),vI=Symbol.for("PolygonRender"),bI=Symbol.for("RectRender"),xI=Symbol.for("Rect3DRender"),SI=Symbol.for("SymbolRender"),wI=Symbol.for("TextRender"),AI=Symbol.for("RichTextRender"),kI=Symbol.for("Pyramid3dRender"),MI=Symbol.for("GlyphRender"),CI=Symbol.for("ImageRender"),TI=Symbol.for("RenderSelector"),EI=Symbol.for("DrawContribution");function PI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function RI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(m(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const m=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{m.addColorStop(t.offset,t.color)})),m}(t,a,i,n,s)),r||"orange")}const BI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(t)},t));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};return Xk(Object.assign({nativeCanvas:Gk.global.createCanvas(e)},e))}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(){this.pools=[]}};var II=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},LI=function(t,e){return function(i,n){e(i,n,t)}};let OI=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};OI=II([Xw()],OI);let FI=class{constructor(t){this.subRenderContribitions=t,this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};FI=II([Xw(),LI(0,qw(eA)),LI(0,$w(jE)),DI("design:paramtypes",[Object])],FI);let zI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=BI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return BI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Mt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;if(!p)return;let y=this.textureMap.get(p);if(!y)switch(p){case"circle":y=this.createCirclePattern(f,m,g,e);break;case"diamond":y=this.createDiamondPattern(f,m,g,e);break;case"rect":y=this.createRectPattern(f,m,g,e);break;case"vertical-line":y=this.createVerticalLinePattern(f,m,g,e);break;case"horizontal-line":y=this.createHorizontalLinePattern(f,m,g,e);break;case"bias-lr":y=this.createBiasLRLinePattern(f,m,g,e);break;case"bias-rl":y=this.createBiasRLLinePattern(f,m,g,e);break;case"grid":y=this.createGridPattern(f,m,g,e)}y&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=y,e.fill(),e.highPerformanceRestore())}};zI=II([Xw()],zI);var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{innerRadius:u=l.innerRadius,outerRadius:p=l.outerRadius,startAngle:g=l.startAngle,endAngle:f=l.endAngle,opacity:m=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p+r,innerRadius:u-r,startAngle:g-a,endAngle:f+a}),e.beginPath(),ME(t,e,i,n,p+r,u-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=m,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=s/p;if(t.setAttributes({outerRadius:p-r,innerRadius:u+r,startAngle:g+a,endAngle:f-a}),e.beginPath(),ME(t,e,i,n,p-r,u+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=m,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:p,innerRadius:u,startAngle:g,endAngle:f})}};jI=HI([Xw()],jI);let NI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};NI=HI([Xw()],NI);let VI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};VI=HI([Xw()],VI);var WI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let GI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,opacity:f=l.opacity,outerBorder:m,innerBorder:y}=t.attribute;if(m){const{distance:s=l.outerBorder.distance}=m,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u+r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,m,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,m,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(y){const{distance:s=l.innerBorder.distance}=y,r=PI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,u-r,p,g),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};GI=WI([Xw()],GI);let UI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};UI=WI([Xw()],UI);let YI=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};YI=WI([Xw()],YI);var XI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $I=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};$I=XI([Xw()],$I);var KI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let qI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=FM(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};qI=KI([Xw()],qI);var ZI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JI=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:f=l.opacity,outerBorder:y,innerBorder:_}=t.attribute;if(y){const{distance:s=l.outerBorder.distance}=y,r=PI(e,s,e.dpr),a=i-r,h=n-r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u+c,p+c)):(e.beginPath(),FB(e,a,h,u+c,p+c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,y,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=f,e.setStrokeStyle(t,y,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(_){const{distance:s=l.innerBorder.distance}=_,r=PI(e,s,e.dpr),a=i+r,h=n+r,c=2*r;if(0===g||m(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(a,h,u-c,p-c)):(e.beginPath(),FB(e,a,h,u-c,p-c,g)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,_,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=f,e.setStrokeStyle(t,_,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};JI=ZI([Xw()],JI);let QI=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};QI=ZI([Xw()],QI);let tD=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};tD=ZI([Xw()],tD);let eD=class{constructor(){this.time=BA.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};eD=ZI([Xw()],eD);let iD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};iD=ZI([Xw()],iD);var nD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sD=class{constructor(){this.time=BA.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{size:u=l.size,opacity:p=l.opacity,outerBorder:g,innerBorder:f}=t.attribute,m=t.getParsedPath();if(m){if(g){const{distance:s=l.outerBorder.distance}=g,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.outerBorder);else if(o){const s=l.outerBorder.opacity;l.outerBorder.opacity=p,e.setStrokeStyle(t,g,i,n,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=f,r=PI(e,s,e.dpr);if(e.beginPath(),!1===m.drawOffset(e,u,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,f,l.innerBorder);else if(o){const s=l.innerBorder.opacity;l.innerBorder.opacity=p,e.setStrokeStyle(t,f,i,n,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}}};sD=nD([Xw()],sD);class rD extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}}class aD extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}}var oD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hD=function(t,e){return function(i,n){e(i,n,t)}};const cD=Symbol.for("RenderService");let dD=class{constructor(t){this.drawContribution=t}prepare(t){this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){}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)}};dD=oD([Xw(),hD(0,qw(EI)),lD("design:paramtypes",[Object])],dD);var uD=new Vw((t=>{t(dD).toSelf(),t(cD).toService(dD)})),pD=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 gD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return pD(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function mD(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var yD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const _D=Symbol.for("PickItemInterceptor");let vD=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===OT,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};vD=yD([Xw()],vD);var bD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SD=function(t,e){return function(i,n){e(i,n,t)}};const wD=Symbol.for("PickerService");let AD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new qt(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=UR.allocate();if(qR(i,e),a){if(i){const t=UR.allocate();r.modelMatrix=ZR(t,a,i),UR.free(i)}}else qR(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Ht(e.x,e.y),a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Ht(e.x,e.y);l.transformPoint(r,r);const a=FM(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&UR.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),GR.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};AD=bD([Xw(),SD(0,qw(oA)),SD(1,qw(eA)),SD(1,$w(_D)),xD("design:paramtypes",[Object,Object])],AD);var kD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},MD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},CD=function(t,e){return function(i,n){e(i,n,t)}};const TD=Symbol.for("GlobalPickerService");let ED=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new qt(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 Ht(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function PD(t,e,i){const n=e[0],s=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],y=e[14],_=e[15];let v=i[0],b=i[1],x=i[2],S=i[3];return t[0]=v*n+b*o+x*d+S*f,t[1]=v*s+b*l+x*u+S*m,t[2]=v*r+b*h+x*p+S*y,t[3]=v*a+b*c+x*g+S*_,v=i[4],b=i[5],x=i[6],S=i[7],t[4]=v*n+b*o+x*d+S*f,t[5]=v*s+b*l+x*u+S*m,t[6]=v*r+b*h+x*p+S*y,t[7]=v*a+b*c+x*g+S*_,v=i[8],b=i[9],x=i[10],S=i[11],t[8]=v*n+b*o+x*d+S*f,t[9]=v*s+b*l+x*u+S*m,t[10]=v*r+b*h+x*p+S*y,t[11]=v*a+b*c+x*g+S*_,v=i[12],b=i[13],x=i[14],S=i[15],t[12]=v*n+b*o+x*d+S*f,t[13]=v*s+b*l+x*u+S*m,t[14]=v*r+b*h+x*p+S*y,t[15]=v*a+b*c+x*g+S*_,t}function RD(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}ED=kD([Xw(),CD(0,qw(oA)),MD("design:paramtypes",[Object])],ED);class BD{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=UR.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=UR.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],m=e[2],y=n[0],_=n[1],v=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const LD=[0,0,0],OD=new qt(1,0,0,1,0,0);let FD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},yk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},vk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new qt(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.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&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Mt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(y),d.moveTo(0,0),d.lineTo(f,-2*v),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&&EE.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(RD(LD,[t,e,i],this.modelMatrix),t=LD[0],e=LD[1],i=LD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gk.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=Gk.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:bk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:bk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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&&(RD(LD,[e,i,n],this.modelMatrix),e=LD[0],i=LD[1],n=LD[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={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=RI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}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={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=ZE(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=ZE(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(OD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};FD.env="browser",FD=ID([Xw(),DD("design:paramtypes",[Object,Number])],FD);var zD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},HD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const jD={WIDTH:500,HEIGHT:500,DPR:1};let ND=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=jD.WIDTH,height:n=jD.HEIGHT,dpr:s=jD.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=Gk.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new FD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}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.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};ND.env="browser",ND=zD([Xw(),HD("design:paramtypes",[Object])],ND);const VD=Symbol.for("CanvasArcPicker"),WD=Symbol.for("CanvasArc3dPicker"),GD=Symbol.for("CanvasAreaPicker"),UD=Symbol.for("CanvasCirclePicker"),YD=Symbol.for("CanvasImagePicker"),XD=Symbol.for("CanvasLinePicker"),$D=Symbol.for("CanvasPathPicker"),KD=Symbol.for("CanvasRectPicker"),qD=Symbol.for("CanvasRect3dPicker"),ZD=Symbol.for("CanvasSymbolPicker"),JD=Symbol.for("CanvasTextPicker"),QD=Symbol.for("CanvasPolygonPicker"),tL=Symbol.for("CanvasPyramid3dPicker"),eL=Symbol.for("CanvasRichTextPicker"),iL=Symbol.for("CanvasGlyphPicker"),nL=Symbol.for("CanvasPickerContribution"),sL=Symbol.for("MathArcPicker"),rL=Symbol.for("MathAreaPicker"),aL=Symbol.for("MathCirclePicker"),oL=Symbol.for("MathLinePicker"),lL=Symbol.for("MathPathPicker"),hL=Symbol.for("MathRectPicker"),cL=Symbol.for("MathSymbolPicker"),dL=Symbol.for("MathTextPicker"),uL=Symbol.for("MathPolygonPicker"),pL=Symbol.for("MathGlyphPicker"),gL=Symbol.for("MathPickerContribution");var fL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yL=function(t,e){return function(i,n){e(i,n,t)}};let _L=class extends AD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new ND(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const xL=new qt(1,0,0,1,0,0),SL={x:0,y:0};let wL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new qt(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new qt(1,0,0,1,0,0),this.path=new pk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return GR.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(GR.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},SL),function(t,e,i){return SM(t,0,!1,e,i)}(this.path.commandList,SL.x,SL.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},SL);const i=PI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return SM(t,e,!0,i,n)}(this.path.commandList,i,SL.x,SL.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(xL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>GR.free(t))),this.stack.length=0}};wL=vL([Xw(),bL("design:paramtypes",[Object,Number])],wL);var AL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ML=function(t,e){return function(i,n){e(i,n,t)}};let CL=class extends AD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new wL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};AL([tA(),kL("design:type",Function),kL("design:paramtypes",[]),kL("design:returntype",void 0)],CL.prototype,"init",null),CL=AL([Xw(),ML(0,qw(eA)),ML(0,$w(gL)),ML(1,qw(oA)),ML(2,qw(eA)),ML(2,$w(_D)),kL("design:paramtypes",[Object,Object,Object])],CL);var TL=new Vw((t=>{t(_L).toSelf().inSingletonScope(),t(CL).toSelf().inSingletonScope(),t(wD).toService(_L),t(ED).toSelf().inSingletonScope(),t(TD).toService(ED),t(vD).toSelf().inSingletonScope(),t(_D).toService(vD),nA(t,_D)})),EL=new Vw((t=>{t(QR).toSelf().inSingletonScope(),t(ZT).toService(QR),t(PR).toSelf().inSingletonScope(),t(ER).toService(PR),nA(t,ER),t(IR).toSelf().inSingletonScope(),t(BR).toService(IR),nA(t,BR),t(OR).toSelf().inSingletonScope(),t(LR).toService(OR),nA(t,LR),t(HR).toSelf().inSingletonScope(),t(zR).toService(HR),nA(t,zR),t(VR).toSelf().inSingletonScope(),t(NR).toService(VR),nA(t,NR),t(JT).toConstantValue(mB)}));const PL=Symbol.for("AutoEnablePlugins"),RL=Symbol.for("PluginService");var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DL=function(t,e){return function(i,n){e(i,n,t)}};let LL=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Wk.isBound(PL)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};LL=BL([Xw(),DL(0,qw(eA)),DL(0,$w(PL)),IL("design:paramtypes",[Object])],LL);var OL=new Vw((t=>{t(LL).toSelf(),t(RL).toService(LL),nA(t,PL)})),FL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};zL=FL([Xw()],zL);var HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function NL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let VL=class extends zL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(b(o)?o:1),y:(s-r.top)/(b(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return NL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return NL(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:zM.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(){}};function WL(){Wk.rebind(wD).toService(CL)}VL=HL([Xw(),jL("design:paramtypes",[])],VL);var GL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YL=class extends zL{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};YL=GL([Xw(),UL("design:paramtypes",[])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let KL=class extends zL{constructor(){super(),this.type="taro",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,Wk.rebind(wD).toService(CL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=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){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}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(){}};KL=XL([Xw(),$L("design:paramtypes",[])],KL);var qL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ZL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let JL=!1;try{JL=!!lynx.createCanvasNG}catch(t){}let QL=class extends zL{constructor(){super(),this.type="lynx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=JL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,JL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),WL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(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(){}};QL=qL([Xw(),ZL("design:paramtypes",[])],QL);var tO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let eO=class extends zL{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 1}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).then((t=>({loadState:t?"success":"fail",data:t}))).catch((()=>({loadState:"fail",data:null}))):Promise.reject(new Error("node-canvas loadImage could not be found!"))}loadSvg(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};eO=tO([Xw()],eO);var iO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sO=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let rO=class extends zL{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,n,s){return sO(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let r=0;r{wx.createSelectorQuery().select(`#${a}`).fields({node:!0,size:!0}).exec((o=>{const l=o[0].node,h=o[0].width,c=o[0].height;l.width=h*t,l.height=c*t,i.set(a,l),r>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList).then((()=>{WL()}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return setTimeout(t,1e3/60,!0)}}getCancelAnimationFrame(){return t=>{clearTimeout(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};rO=iO([Xw(),nO("design:paramtypes",[])],rO);var aO=new Vw((t=>{t(VL).toSelf().inSingletonScope(),t(aA).toService(VL),t(YL).toSelf().inSingletonScope(),t(aA).toService(YL),t(KL).toSelf().inSingletonScope(),t(aA).toService(KL),t(QL).toSelf().inSingletonScope(),t(aA).toService(QL),t(rO).toSelf().inSingletonScope(),t(aA).toService(rO),t(eO).toSelf().inSingletonScope(),t(aA).toService(eO),nA(t,aA)})),oO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hO=class{constructor(){this._uid=zM.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};hO=oO([Xw(),lO("design:paramtypes",[])],hO);var cO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uO=function(t,e){return function(i,n){e(i,n,t)}};let pO=class extends hO{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}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 this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ND(n)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new ND({width:n,height:s,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};pO.env="browser",pO=cO([Xw(),uO(0,qw(oA)),dO("design:paramtypes",[Object])],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}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;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};fO.env="feishu",fO=gO([Xw()],fO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _O={WIDTH:500,HEIGHT:500,DPR:1};let vO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=_O.WIDTH,height:n=_O.HEIGHT,dpr:s=_O.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new fO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};vO.env="feishu",vO=mO([Xw(),yO("design:paramtypes",[Object])],vO);var bO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SO=function(t,e){return function(i,n){e(i,n,t)}};let wO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 vO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};wO.env="feishu",wO=bO([Xw(),SO(0,qw(oA)),xO("design:paramtypes",[Object])],wO);var AO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kO=class extends FD{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(RI(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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(PI(this,l,this.dpr)),r.setStrokeStyle(RI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=ZE(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=ZE(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}};kO.env="taro",kO=AO([Xw()],kO);var MO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const TO={WIDTH:500,HEIGHT:500,DPR:1};let EO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=TO.WIDTH,height:n=TO.HEIGHT,dpr:s=TO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new kO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};EO.env="taro",EO=MO([Xw(),CO("design:paramtypes",[Object])],EO);var PO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BO=function(t,e){return function(i,n){e(i,n,t)}};let IO=class extends hO{get container(){return null}constructor(t){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:zM.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)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 EO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};IO.env="taro",IO=PO([Xw(),BO(0,qw(oA)),RO("design:paramtypes",[Object])],IO);var DO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let LO=class extends FD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;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:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=PI(this,l,this.dpr),r.strokeStyle=RI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};LO.env="lynx",LO=DO([Xw()],LO);var OO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},FO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const zO={WIDTH:500,HEIGHT:500,DPR:1};let HO=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=zO.WIDTH,height:n=zO.HEIGHT,dpr:s=zO.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new LO(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};HO.env="lynx",HO=OO([Xw(),FO("design:paramtypes",[Object])],HO);var jO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VO=function(t,e){return function(i,n){e(i,n,t)}};let WO=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",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:zM.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)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 HO({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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};WO.env="lynx",WO=jO([Xw(),VO(0,qw(oA)),NO("design:paramtypes",[Object])],WO);var GO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},UO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let YO=class extends FD{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 qt(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};YO.env="node",YO=GO([Xw(),UO("design:paramtypes",[Object,Number])],YO);var XO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$O=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const KO={WIDTH:500,HEIGHT:500,DPR:1};let qO=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=KO.WIDTH,height:n=KO.HEIGHT,canvasControled:s=!0,dpr:r=KO.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new YO(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&l(this._nativeCanvas.release)&&this._nativeCanvas.release()}};qO.env="node",qO=XO([Xw(),$O("design:paramtypes",[Object])],qO);var ZO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},JO=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},QO=function(t,e){return function(i,n){e(i,n,t)}};let tF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:zM.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new qO(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new qO({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};tF.env="node",tF=ZO([Xw(),QO(0,qw(oA)),JO("design:paramtypes",[Object])],tF);var eF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iF=class extends FD{draw(){}createPattern(t,e){return null}};iF.env="wx",iF=eF([Xw()],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rF={WIDTH:500,HEIGHT:500,DPR:1};let aF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=rF.WIDTH,height:n=rF.HEIGHT,dpr:s=rF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new iF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};aF.env="wx",aF=nF([Xw(),sF("design:paramtypes",[Object])],aF);var oF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hF=function(t,e){return function(i,n){e(i,n,t)}};class cF{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let dF=class extends hO{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new cF}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:zM.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new aF(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new aF({width:i,height:n,dpr:s,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,n,s;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};dF.env="wx",dF=oF([Xw(),hF(0,qw(oA)),lF("design:paramtypes",[Object])],dF);var uF=new Vw((t=>{t(pO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(pO))).whenTargetNamed(pO.env),t(wO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(wO))).whenTargetNamed(wO.env),t(IO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(IO))).whenTargetNamed(IO.env),t(WO).toSelf(),t(dE).toDynamicValue((t=>t.container.get(WO))).whenTargetNamed(WO.env),t(dF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(dF))).whenTargetNamed(dF.env),t(tF).toSelf(),t(dE).toDynamicValue((t=>t.container.get(tF))).whenTargetNamed(tF.env)})),pF=new Vw((t=>{t(Vk).toSelf().inSingletonScope(),t(Nk).toService(Vk),nA(t,Nk)})),gF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mF=function(t,e){return function(i,n){e(i,n,t)}};let yF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=Xk({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,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()}};yF=gF([Xw(),mF(0,qw(oA)),fF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bF=function(t,e){return function(i,n){e(i,n,t)}};let xF=class{constructor(t){this.global=t,this.offscreen=!0}init(t,e,i){this.layer=t;const n=Xk({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};xF=_F([Xw(),bF(0,qw(oA)),vF("design:paramtypes",[Object])],xF);var SF=new Vw((t=>{t(yF).toSelf(),t(xF).toSelf(),t(eE).toService(yF)}));var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const AF=Symbol.for("DrawItemInterceptor"),kF=new Wt;let MF=class{constructor(){this.order=1}afterDrawItem(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){kF.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(kF),!0}};MF=wF([Xw()],MF);let CF=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=UR.allocate();qR(l,o);const h=r.modelMatrix;if(h){if(l){const t=UR.allocate();r.modelMatrix=ZR(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===OT,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Mt;for(;o<0;)o+=Mt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&UR.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};CF=wF([Xw()],CF);var TF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},EF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PF=function(t,e){return function(i,n){e(i,n,t)}};let RF=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Vt,this.backupDirtyBounds=new Vt}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=be(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.clip()),n.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=mD(e,i,Sk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Se(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):gD(t,Sk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_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||Wk.get(cI);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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IF=class{selector(t){return null}};IF=BF([Xw()],IF);var DF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let FF=class{constructor(t){this.groupRenderContribitions=t,this.numberType=jT}drawShape(t,e,i,n,s,r,a,o){const l=FM(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:y=l.fillOpacity,strokeOpacity:_=l.strokeOpacity,cornerRadius:v=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=bE(u,y,p,g),A=SE(u,_,p,g),k=yE(h),M=_E(d,x);if(!t.valid||!S)return;if(!f){if(!(k||M||c))return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===v||m(v)&&v.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),FB(e,i,n,p,g,v));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===BA.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),f&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===BA.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=FM(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=UR.allocate(),i=UR.allocate();JR(i,t,a),ZR(e,o||e,i),s.modelMatrix=e,UR.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&UR.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};FF=DF([Xw(),OF(0,qw(eA)),OF(0,$w(IE)),LF("design:paramtypes",[Object])],FF);var zF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HF=class extends AB{constructor(){super(...arguments),this.numberType=VT}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=FM(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,y=vE(u,p),_=xE(u,g),v=yE(c),b=_E(d,f);if(!t.valid||!m)return;if(!v&&!b)return;if(!(y||_||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};HF=zF([Xw()],HF);var jF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NF=class extends RB{constructor(){super(...arguments),this.numberType=FT}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=FM(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=vE(u,d),f=yE(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};NF=jF([Xw()],NF);var VF,WF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UF=function(t,e){return function(i,n){e(i,n,t)}},YF=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"}(VF||(VF={}));let XF=class extends RF{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=VF.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new rA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return YF(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,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Sk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Sk.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 YF(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return YF(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>YF(this,void 0,void 0,(function*(){if(2!==t.count)yield fD(t,Sk.zIndex,((i,n)=>{if(this.status===VF.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return YF(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return YF(this,void 0,void 0,(function*(){this.rendering&&(this.status=VF.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=VF.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 YF(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:()=>YF(this,void 0,void 0,(function*(){yield fD(t,Sk.zIndex,(t=>YF(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};WF([qw(oA),GF("design:type",Object)],XF.prototype,"global",void 0),XF=WF([Xw(),UF(0,Zw(fI)),UF(1,qw(TI)),UF(2,qw(HF)),UF(3,qw(NF)),UF(4,qw(fE)),UF(5,qw(eA)),UF(5,$w(AF)),GF("design:paramtypes",[Array,Object,Object,Object,Object,Object])],XF);var $F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let KF=class extends bB{constructor(){super(...arguments),this.type="rect3d",this.numberType=XT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:y=h.strokeOpacity,visible:_=h.visible}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=bE(g,f,u,p),x=SE(g,y,u,p),S=yE(c),w=_E(d,m);if(!t.valid||!_)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}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){const l=nT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],m={x:t+u[0],y:e+u[1],z:i+u[2]},y={x:t+p[0],y:e+p[1],z:i+p[2]},_={x:t+g[0],y:e+g[1],z:i+g[2]},v={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.lineTo(v.x,v.y,v.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};KF=$F([Xw()],KF);var qF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ZF=class{constructor(){this.numberType=$T}drawShape(t,e,i,n,s){const r=FM(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&vE(l,h)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=FM(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:y=o,backgroundHeight:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(y-o)/2,s=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,y,_)):(e.beginPath(),FB(e,i-t,n-s,y,_,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const v=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));v&&"success"===v.state&&(e.globalAlpha=h,e.drawImage(v.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).richtext;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);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};ZF=qF([Xw()],ZF);var JF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let QF=class{constructor(){this.numberType=HT}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=FM(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};QF=JF([Xw()],QF);var tz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ez=class extends bB{constructor(){super(...arguments),this.numberType=OT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=vE(p,g),v=xE(p,m),b=yE(c),x=_E(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!y)return;if(!(b||x||d))return;if(!(_||v||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=nT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(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 d=!1;if(r=Mt-St)e.moveTo(i+r*Et(o),n+r*Bt(o),s),e.arc(i,n,r,o,l,!c,s),a>St&&(e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:m}=t.getParsePadAngle(o,l),y=r*Et(p),_=r*Bt(p),v=a*Et(f),b=a*Bt(f);h<.001?d=!0:(e.moveTo(i+y,n+_,s),e.arc(i,n,r,p,g,!c,s)),!(a>St)||u<.001?(e.lineTo(i+v,n+b,s),d=!0):(e.lineTo(i+v,n+b,s),e.arc(i,n,a,f,m,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Mt,!0,E.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),d=h>l;let u=!1;if(a<=St)e.moveTo(i,n,s);else if(c>=Mt-St)e.moveTo(i+a*Et(l),n+a*Bt(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Et(h),n+a*Bt(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Et(c),f=a*Bt(c),m=a*Et(p),y=a*Bt(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+m,n+y,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):_&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):v&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=FM(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,wE(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&UR.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};ez=tz([Xw()],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let nz=class extends bB{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=UT}drawShape(t,e,i,n,s,r,a,o){var l;const h=FM(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:m=h.visible,points:y,face:_=[!0,!0,!0,!0,!0,!0]}=t.attribute,v=null!==(l=this.z)&&void 0!==l?l:0,b=vE(u,p),x=xE(u,f),S=yE(c),w=_E(d,g);if(!t.valid||!m||4!==y.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=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,v,M,_,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,v,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=nT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],m=p[s[2]],y=p[s[3]],_={x:t+g[0],y:e+g[1],z:i+g[2]},v={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+y[0],y:e+y[1],z:i+y[2]};a.beginPath(),a.moveTo(_.x,_.y,_.z),a.lineTo(v.x,v.y,v.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=FM(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};nz=iz([Xw()],nz);var sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};rz=sz([Xw()],rz);let az=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};az=sz([Xw()],az);var oz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};lz=oz([Xw()],lz);let hz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}};hz=oz([Xw()],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class extends OI{constructor(){super(...arguments),this.time=BA.beforeFillStroke}};dz=cz([Xw()],dz);let uz=class extends zI{constructor(){super(...arguments),this.time=BA.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:y=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:CC(l,"texture")),textureColor:v=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:CC(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:CC(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:CC(l,"texturePadding"))}=y;if(!_)return;let S=this.textureMap.get(_);if(!S)switch(_){case"circle":S=this.createCirclePattern(b,x,v,e);break;case"diamond":S=this.createDiamondPattern(b,x,v,e);break;case"rect":S=this.createRectPattern(b,x,v,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,v,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,v,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,v,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,v,e);break;case"grid":S=this.createGridPattern(b,x,v,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};uz=cz([Xw()],uz);var pz=new Vw((t=>{t(RF).toSelf(),t(EI).toService(RF),t(XF).toSelf(),t(cI).toService(XF),t(IF).toSelf(),t(TI).toService(IF),t($E).toSelf().inSingletonScope(),t(gI).to($E),t(fI).to($E),t(GI).toSelf().inSingletonScope(),t(UI).toSelf().inSingletonScope(),t(YI).toSelf().inSingletonScope(),t(BE).toService(GI),t(BE).toService(UI),t(BE).toService(YI),nA(t,BE),t(NB).toSelf().inSingletonScope(),t(bI).to(NB),t(fI).to(NB),t(KF).toSelf().inSingletonScope(),t(xI).toService(KF),t(fI).toService(xI),t(JI).toSelf().inSingletonScope(),t(QI).toSelf().inSingletonScope(),t(tD).toSelf().inSingletonScope(),t(eD).toSelf().inSingletonScope(),t(iD).toSelf().inSingletonScope(),t(FE).toService(JI),t(FE).toService(QI),t(FE).toService(tD),t(FE).toService(eD),t(FE).toService(iD),nA(t,FE),t(KB).toSelf().inSingletonScope(),t(wI).to(KB),t(fI).to(KB),nA(t,HE),t(LB).toSelf().inSingletonScope(),t(_I).to(LB),t(fI).to(LB),t(lz).toSelf().inSingletonScope(),t(hz).toSelf().inSingletonScope(),t(LE).toService(lz),t(LE).toService(hz),nA(t,LE),t(UB).toSelf().inSingletonScope(),t(SI).to(UB),t(fI).to(UB),t(sD).toSelf().inSingletonScope(),t(rD).toSelf().inSingletonScope(),t(aD).toSelf().inSingletonScope(),t(zE).toService(sD),t(zE).toService(rD),t(zE).toService(aD),nA(t,zE),t(GE).toSelf().inSingletonScope(),t(dI).to(GE),t(fI).to(GE),t(ez).toSelf().inSingletonScope(),t(uI).toService(ez),t(fI).toService(uI),t(jI).toSelf().inSingletonScope(),t(NI).toSelf().inSingletonScope(),t(VI).toSelf().inSingletonScope(),t(PE).toService(jI),t(PE).toService(NI),t(PE).toService(VI),nA(t,PE),t(AB).toSelf().inSingletonScope(),t(yI).to(AB),t(fI).to(AB),t(HF).toSelf().inSingletonScope(),t(NF).toSelf().inSingletonScope(),t(RB).toSelf().inSingletonScope(),t(pI).to(RB),t(fI).to(RB),t(dz).toSelf().inSingletonScope(),t(uz).toSelf().inSingletonScope(),t(RE).toService(dz),t(RE).toService(uz),nA(t,RE),t(FF).toSelf().inSingletonScope(),t(mI).to(FF),t(fI).to(FF),t($I).toSelf().inSingletonScope(),t(IE).toService($I),nA(t,IE),t(sI).toSelf().inSingletonScope(),t(vI).to(sI),t(fI).to(sI),t(rz).toSelf().inSingletonScope(),t(az).toSelf().inSingletonScope(),t(OE).toService(rz),t(OE).toService(az),nA(t,OE),t(QF).toSelf().inSingletonScope(),t(MI).toService(QF),t(fI).toService(MI),t(hI).toSelf().inSingletonScope(),t(CI).toService(hI),t(fI).toService(CI),t(qI).toSelf().inSingletonScope(),t(DE).toService(qI),nA(t,DE),t(ZF).toSelf().inSingletonScope(),t(AI).toService(ZF),t(fI).toService(AI),t(nz).toSelf().inSingletonScope(),t(kI).toService(nz),t(fI).toService(kI),t(FI).toSelf().inSingletonScope(),t(HE).toService(FI),t(PE).toService(FI),t(LE).toService(FI),t(zE).toService(FI),t(FE).toService(FI),t(DE).toService(FI),t(BE).toService(FI),t(RE).toService(FI),t(OE).toService(FI),nA(t,jE),nA(t,fI),t(MF).toSelf().inSingletonScope(),t(AF).toService(MF),t(CF).toSelf().inSingletonScope(),t(AF).toService(CF),nA(t,AF)}));var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mz=function(t,e){return function(i,n){e(i,n,t)}};let yz=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};yz=gz([Xw(),mz(0,qw(gI)),fz("design:paramtypes",[Object])],yz);var _z=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bz=function(t,e){return function(i,n){e(i,n,t)}};const xz=new Wt;let Sz=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=PI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;xz.setValue(i.x1,i.y1,i.x2,i.y2),xz.expand(-r/2),h=!xz.containsPoint(e)}}return n.highPerformanceRestore(),h}};Sz=_z([Xw(),bz(0,qw(bI)),vz("design:paramtypes",[Object])],Sz);var wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Az=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kz=function(t,e){return function(i,n){e(i,n,t)}};let Mz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=PI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Mz=wz([Xw(),kz(0,qw(dI)),Az("design:paramtypes",[Object])],Mz);var Cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ez=function(t,e){return function(i,n){e(i,n,t)}};let Pz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};Pz=Cz([Xw(),Ez(0,qw(pI)),Tz("design:paramtypes",[Object])],Pz);var Rz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Bz=class{constructor(){this.type="image",this.numberType=NT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};Bz=Rz([Xw()],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dz=class extends bB{};Dz=Iz([Xw()],Dz);var Lz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fz=function(t,e){return function(i,n){e(i,n,t)}};let zz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};zz=Lz([Xw(),Fz(0,qw(yI)),Oz("design:paramtypes",[Object])],zz);var Hz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nz=function(t,e){return function(i,n){e(i,n,t)}};let Vz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Vz=Hz([Xw(),Nz(0,qw(_I)),jz("design:paramtypes",[Object])],Vz);var Wz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uz=function(t,e){return function(i,n){e(i,n,t)}};let Yz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=KT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=FM(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=PI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Yz=Wz([Xw(),Uz(0,qw(SI)),Gz("design:paramtypes",[Object])],Yz);var Xz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$z=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kz=function(t,e){return function(i,n){e(i,n,t)}};let qz=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=qT}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=FM(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=QE(a,u,s),y=JE(o,f);return e.rect(y+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&UR.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};qz=Xz([Xw(),Kz(0,qw(wI)),$z("design:paramtypes",[Object])],qz);var Zz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qz=function(t,e){return function(i,n){e(i,n,t)}};let tH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};tH=Zz([Xw(),Qz(0,qw(vI)),Jz("design:paramtypes",[Object])],tH);var eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let sH=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=$T}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};sH=eH([Xw(),nH(0,qw(AI)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};lH=rH([Xw(),oH(0,qw(MI)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let uH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=XT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};uH=hH([Xw(),dH(0,qw(xI)),cH("design:paramtypes",[Object])],uH);var pH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let mH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=UT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mH=pH([Xw(),fH(0,qw(kI)),gH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vH=function(t,e){return function(i,n){e(i,n,t)}};new Wt;let bH=class extends Dz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=OT}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&UR.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};bH=yH([Xw(),vH(0,qw(uI)),_H("design:paramtypes",[Object])],bH);var xH=new Vw(((t,e,i,n)=>{t(yz).toSelf().inSingletonScope(),t(UD).toService(yz),t(nL).toService(UD),t(Sz).toSelf().inSingletonScope(),t(KD).toService(Sz),t(nL).toService(KD),t(uH).toSelf().inSingletonScope(),t(qD).toService(uH),t(nL).toService(qD),t(Mz).toSelf().inSingletonScope(),t(VD).toService(Mz),t(nL).toService(VD),t(Pz).toSelf().inSingletonScope(),t(GD).toService(Pz),t(nL).toService(GD),t(Bz).toSelf().inSingletonScope(),t(YD).toService(Bz),t(nL).toService(YD),t(zz).toSelf().inSingletonScope(),t(XD).toService(zz),t(nL).toService(XD),t(Vz).toSelf().inSingletonScope(),t($D).toService(Vz),t(nL).toService($D),t(Yz).toSelf().inSingletonScope(),t(ZD).toService(Yz),t(nL).toService(ZD),t(qz).toSelf().inSingletonScope(),t(JD).toService(qz),t(nL).toService(JD),t(tH).toSelf().inSingletonScope(),t(QD).toService(tH),t(nL).toService(QD),t(mH).toSelf().inSingletonScope(),t(tL).toService(mH),t(nL).toService(tL),t(bH).toSelf().inSingletonScope(),t(WD).toService(bH),t(nL).toService(WD),t(sH).toSelf().inSingletonScope(),t(eL).toService(sH),t(nL).toService(eL),t(lH).toSelf().inSingletonScope(),t(iL).toService(lH),t(nL).toService(iL),nA(t,nL)})),SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=WT}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=FM(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([Xw(),AH(0,qw(_I)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=zT}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=FM(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([Xw(),TH(0,qw(gI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},BH=function(t,e){return function(i,n){e(i,n,t)}};const IH=new Wt;let DH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=YT}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=FM(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||v(r,!0)&&0!==r||m(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;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;IH.setValue(i.x1,i.y1,i.x2,i.y2),IH.expand(-r/2),h=!IH.containsPoint(e)}}return n.highPerformanceRestore(),h}};DH=PH([Xw(),BH(0,qw(bI)),RH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},OH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FH=function(t,e){return function(i,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=LT}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=FM(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};zH=LH([Xw(),FH(0,qw(dI)),OH("design:paramtypes",[Object])],zH);var HH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NH=function(t,e){return function(i,n){e(i,n,t)}};let VH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=FT}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=FM(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};VH=HH([Xw(),NH(0,qw(pI)),jH("design:paramtypes",[Object])],VH);var WH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UH=function(t,e){return function(i,n){e(i,n,t)}};let YH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=VT}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=FM(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};YH=WH([Xw(),UH(0,qw(yI)),GH("design:paramtypes",[Object])],YH);var XH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KH=function(t,e){return function(i,n){e(i,n,t)}};let qH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=KT}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=FM(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qH=XH([Xw(),KH(0,qw(SI)),$H("design:paramtypes",[Object])],qH);var ZH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JH=class{constructor(){this.type="text",this.numberType=qT}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};JH=ZH([Xw()],JH);var QH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ej=function(t,e){return function(i,n){e(i,n,t)}};let ij=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=GT}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=FM(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};ij=QH([Xw(),ej(0,qw(vI)),tj("design:paramtypes",[Object])],ij);var nj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rj=function(t,e){return function(i,n){e(i,n,t)}};let aj=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=HT}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};aj=nj([Xw(),rj(0,qw(MI)),sj("design:paramtypes",[Object])],aj);var oj=new Vw((t=>{t(EH).toSelf().inSingletonScope(),t(aL).toService(EH),t(gL).toService(aL),t(DH).toSelf().inSingletonScope(),t(hL).toService(DH),t(gL).toService(hL),t(zH).toSelf().inSingletonScope(),t(sL).toService(zH),t(gL).toService(sL),t(VH).toSelf().inSingletonScope(),t(rL).toService(VH),t(gL).toService(rL),t(YH).toSelf().inSingletonScope(),t(oL).toService(YH),t(gL).toService(oL),t(kH).toSelf().inSingletonScope(),t(lL).toService(kH),t(gL).toService(lL),t(qH).toSelf().inSingletonScope(),t(cL).toService(qH),t(gL).toService(cL),t(JH).toSelf().inSingletonScope(),t(dL).toService(JH),t(gL).toService(dL),t(ij).toSelf().inSingletonScope(),t(uL).toService(ij),t(gL).toService(uL),t(aj).toSelf().inSingletonScope(),t(pL).toService(aj),t(aj).toService(pL),nA(t,gL)}));var lj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new ND(t))).whenTargetNamed(ND.env),t(Yk).toDynamicValue((()=>(t,e)=>new FD(t,e))).whenTargetNamed(FD.env)})),hj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new EO(t))).whenTargetNamed(EO.env),t(Yk).toDynamicValue((()=>(t,e)=>new kO(t,e))).whenTargetNamed(kO.env)})),cj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new vO(t))).whenTargetNamed(vO.env),t(Yk).toDynamicValue((()=>(t,e)=>new fO(t,e))).whenTargetNamed(fO.env)})),dj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new HO(t))).whenTargetNamed(HO.env),t(Yk).toDynamicValue((()=>(t,e)=>new LO(t,e))).whenTargetNamed(LO.env)})),uj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new aF(t))).whenTargetNamed(aF.env),t(Yk).toDynamicValue((()=>(t,e)=>new iF(t,e))).whenTargetNamed(iF.env)})),pj=new Vw((t=>{t(Uk).toDynamicValue((()=>t=>new qO(t))).whenTargetNamed(qO.env),t(Yk).toDynamicValue((()=>(t,e)=>new YO(t,e))).whenTargetNamed(YO.env)}));Wk.load(mE),Wk.load(EL),Wk.load(uD),Wk.load(TL),Wk.load(OL),function(t){t.load(aO),t.load(uF),t.load(pF),t.load(SF)}(Wk),function(t){t.load(pz)}(Wk),function(t){t.load(xH),t.load(oj)}(Wk),function(t){t.load(lj),t.load(cj),t.load(hj),t.load(dj),t.load(uj),t.load(pj)}(Wk);const gj=Wk.get(oA);Gk.global=gj;const fj=Wk.get(gE);Gk.graphicUtil=fj;const mj=Wk.get(pE);Gk.transformUtil=mj;const yj=Wk.get(ZT);Gk.graphicService=yj,Wk.get(TD);const _j=Wk.get(fE);Gk.layerService=_j;class vj{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),Gk.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){Gk.graphicService.hooks.onAttributeUpdate.taps=Gk.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onSetStage.taps=Gk.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class bj{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class xj{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Gk.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))})),Gk.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){Gk.graphicService.hooks.onAddIncremental.taps=Gk.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onClearIncremental.taps=Gk.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gk.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({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const Sj=new Wt;class wj{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Gk.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&&(Sj.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(Sj,t.parent&&t.parent.globalTransMatrix)))})),Gk.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))})),Gk.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Gk.graphicService.hooks.beforeUpdateAABBBounds.taps=Gk.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.afterUpdateAABBBounds.taps=Gk.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Gk.graphicService.hooks.onRemove.taps=Gk.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Aj=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===rC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=rC.INITIAL,Gk.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),Gk.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:sC},{mode:"timeout",cons:nC},{mode:"manual",cons:iC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==rC.INITIAL&&(this.status=rC.PAUSE,!0)}resume(){return this.status!==rC.INITIAL&&(this.status=rC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===rC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===rC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=rC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=rC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};Aj.addTimeline(oC),Aj.setFPS(60);class kj{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=nT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=It(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=Rt(Pt((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=f(e)?nT.get(e).value:e;const r=this.colorRgb;return nT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const Mj="white";class Cj extends tE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:Mj}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new LM,this.hooks={beforeRender:new rA(["stage"]),afterRender:new rA(["stage"])},this.global=Wk.get(oA),this.window=Wk.get(cE),this.renderService=Wk.get(cD),this.pickerService=Wk.get(wD),this.pluginService=Wk.get(RL),this.layerService=Wk.get(fE),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new Wt,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:Mj,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new ZM({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Aj,this.supportInteractiveLayer=!1!==t.interactiveLayer}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:y}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),v=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s:0),b=[_,v,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,w=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+v,w=Math.cos(d)*Math.cos(u)*1),this.light=new kj(f,m,y);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new BD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new bj))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new vj))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new xj))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Vt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new wj,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive")}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render()}setViewBox(t,e,i,n,s){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){this.forEachChildren((e=>{e.setDpr(t)}))}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Ht(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t)}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Wk.get(cE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var Tj;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(Tj||(Tj={}));const Ej="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol",Pj=Ej,Rj=14,Bj=18,Ij=4,Dj={label:{visible:!1,offset:5,position:"top",style:{stroke:"white",lineWidth:2,fontSize:Rj}}},Lj={label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Oj={bar3d:{style:{length:3}},label:{visible:!1,style:{fontSize:Rj,offset:12,position:"outside"}}},Fj={transform:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},zj={transform3d:{style:{fill:"#f5f5f5"}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:Rj,fill:"#707070"},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:Rj,fill:"#707070",textBaseline:"middle"}}},Hj="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",jj={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:Hj,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:Hj,fill:"#ddd"}}},Nj={label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Vj={defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:10,textBaseline:"middle",fill:{type:"palette",key:"labelFontColor"},stroke:"white"}}},Wj={outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},Gj={outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,position:"outside",style:{fontSize:Rj}}},Uj={label:{visible:!1,offset:5,style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Yj={point:{style:{size:8,symbolType:"circle",lineWidth:0,fillOpacity:.8}},label:{visible:!1,offset:5,position:"top",style:{lineWidth:2,stroke:"white",fontSize:Rj}}},Xj={seriesFieldName:{total:"total",increase:"increase",decrease:"decrease"},leaderLine:{style:{stroke:"black",lineWidth:1,lineDash:[4,4]}},stackLabel:{offset:12,position:"withChange",style:{fill:"black",fontSize:Rj}},label:{visible:!1,offset:12,position:"inside",style:{fontSize:Rj}}},$j={gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fontSize:Rj,fill:"white",textBaseline:"middle",textAlign:"center"}},nonLeafLabel:{padding:2*Rj,style:{fill:"black",stroke:"white",lineWidth:2,fontSize:Rj,textBaseline:"middle",textAlign:"center"}}},Kj="__VCHART",qj=500,Zj=500,Jj=`${Kj}_LABEL_LIMIT`,Qj=`${Kj}_LABEL_ALIGN`,tN=`${Kj}_LABEL_TEXT`,eN=`${Kj}_LABEL_VISIBLE`,iN=`${Kj}_LABEL_X`,nN=`${Kj}_LABEL_Y`,sN=`${Kj}_ARC_RATIO`,rN=`${Kj}_ARC_START_ANGLE`,aN=`${Kj}_ARC_END_ANGLE`,oN=`${Kj}_ARC_K`,lN=`${Kj}_ARC_LABEL_HOVER_AX`,hN=`${Kj}_ARC_LABEL_HOVER_AY`,cN=`${Kj}_ARC_LABEL_POINT_AX`,dN=`${Kj}_ARC_LABEL_POINT_AY`,uN=`${Kj}_ARC_LABEL_POINT_BX`,pN=`${Kj}_ARC_LABEL_POINT_BY`,gN=`${Kj}_ARC_LABEL_POINT_CX`,fN=`${Kj}_ARC_LABEL_POINT_CY`,mN=`${Kj}_ARC_LABEL_SELECTED_AX`,yN=`${Kj}_ARC_LABEL_SELECTED_AY`,_N=`${Kj}_ARC_MIDDLE_ANGLE`,vN=`${Kj}_ARC_QUADRANT`,bN=`${Kj}_ARC_RADIAN`,xN=-Math.PI/2,SN=3*Math.PI/2,wN=-90,AN=270,kN=.6,MN={},CN=[],TN=(t,e,i)=>{MN[t]=Object.assign(e,{type:t}),i||CN.push(t)},EN=()=>{CN.slice().forEach((t=>{(t=>{delete MN[t];const e=CN.indexOf(t);e>=0&&CN.splice(e,1)})(t)}))};function PN(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:f(t)?t:h(s=t)?null:s.fname})):null}function RN(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function BN(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const IN=":vGrammar_identifier:";function DN(t,e){return N(t).reduce(((t,i)=>{const n=f(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function LN(t,e){if(h(t))return[];if(!l(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(f(i))return N(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!l(t)&&!!(null==t?void 0:t.callback)}(t))return DN(t.dependency,e);var i;return[]}function ON(t){return l(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function FN(t,e,i,n){if(h(t))return t;if(l(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return f(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function zN(t,e){return HN(t)?t.output():e[t]}const HN=t=>t&&!h(t.grammarType),jN=t=>l(t)?t:e=>e[t],NN=t=>f(t)&&se.parseColorString(t)?t:null;function VN(t){return!!(null==t?void 0:t.scale)}function WN(t){return!!(null==t?void 0:t.field)}function GN(t,e){if(!t)return[];let i=[];return t.scale&&(i=HN(t.scale)?[t.scale]:N(e.getScaleById(t.scale))),i.concat(LN(t,e))}class UN{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return f(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=N(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const YN={},XN=t=>YN[t],$N=(t,e,i,n,s)=>(YN[t]=new UN(e,i,n,s),YN[t]);function KN(t){return null===t?0:t}function qN(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const ZN=["fillOpacity","x","y","dx","dy"],JN=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=KN(i.x),["x"]):"y"===e?(t.y=KN(i.y),["y"]):"dx"===e?(t.dx=KN(i.dx),["dx"]):"dy"===e?(t.dy=KN(i.dy),["dy"]):[]};var QN,tV,eV,iV,nV,sV,rV,aV,oV,lV,hV,cV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(QN||(QN={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(tV||(tV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip"}(eV||(eV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(iV||(iV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(nV||(nV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(sV||(sV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair"}(rV||(rV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(aV||(aV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(oV||(oV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(lV||(lV={})),function(t){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_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"}(hV||(hV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(cV||(cV={}));const dV={[tV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.area]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[tV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;b(e.width)||!b(e.x1)&&b(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):b(e.x1)||!b(e.width)&&b(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),b(e.height)||!b(e.y1)&&b(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):b(e.y1)||!b(e.height)&&b(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),b(e.length)||!b(e.z1)&&b(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):b(e.z1)||!b(e.length)&&b(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[tV.text]:[{channels:["text","limit","autoLimit"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text)?t.maxLineWidth=o===1/0?void 0:o:t.maxLineWidth=o||1/0,t.text=i.text},storedAttrs:"limitAttrs"}],[tV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return b(e)&&b(i)&&b(n)&&b(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[tV.symbol]:[{channels:["shape"],transform:(t,e,i)=>{t.symbolType=e.shape}}]};const uV=(t,e,i,n)=>{const s={},r=Object.keys(e),a=f(t)?dV[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(ZN.includes(r)?JN(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{ZN.includes(t)?JN(s,t,e):s[t]=e[t]}));return s},pV=(t,e,i)=>!(!h(t)||!h(e))||!h(t)&&!h(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(f(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e);function gV(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case tV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case tV.group:case tV.rect:case tV.image:return["width","height","y1"].includes(e);case tV.path:case tV.shape:return["path","customPath"].includes(e);case tV.line:return"defined"===e;case tV.area:return["x1","y1","defined"].includes(e);case tV.rule:return["x1","y1"].includes(e);case tV.symbol:return"size"===e;case tV.polygon:return"points"===e;case tV.text:return"text"===e}return!1}function fV(t,e,i,n,s){i&&(ON(i)?e.forEach((e=>{const s=FN(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],c=s&&!gV(t.mark.markType,r)?[e[0]]:e;if(VN(l)){const t=zN(l.scale,n),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!h(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,s=f(null==l?void 0:l.field),d=s?ll(l.field):null;let u=s?null:h(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=v(u)||v(i)?u+e+i:u}))}else if(WN(l)){const t=ll(l.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=FN(l,n,e.datum,t)}))})))}function mV(t,e,i,n){if(!t)return null;if(ON(t))return FN(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,l;const c=t[r];if(VN(c)){const t=zN(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!h(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=f(null==c?void 0:c.field),p=u?ll(c.field):null,g=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):h(null==c?void 0:c.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,c.value);s[r]=v(g)||v(d)?g+i+d:g}else if(WN(c)){const t=ll(c.field);s[r]=t(e)}else s[r]=FN(c,n,e,i)})),s}function yV(t){if(t)return t.type===Fl.Band?t.bandwidth():t.type===Fl.Point?t.step():void 0}const _V={sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=l(i)?i:pl(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},map:{transform:(t,e,i)=>{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!h(s)){if(h(t))return;t[s]=e}return e})),e;const r=n(e,i);return h(s)||h(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:(t,e)=>{const i=We.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,l=ll(a),c=(r||[]).reduce(((t,e)=>(t[l(e)]=e,t)),{}),d=h(t.default)?null:t.default,u=s.map((t=>ll(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),h(n)&&(n=o);const t=o.map((t=>ll(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],l=o.length;return(h(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*l+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=h(r)?d:r,e}),t)))},markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=PN(i,t.as||[]),s=i.map((t=>f(t)?ll(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return Y(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{const i=new Map,n=new Map,s=t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum,r="negative"===t.orient?e.slice().reverse():e,a=Symbol("dim");let o=r.map((e=>{var r,o,l;const h=null!==(r=e[t.dimensionField])&&void 0!==r?r:a,c=e[t.stackField],d=c>=0?i:n,u=null!==(o=d.get(h))&&void 0!==o?o:0,p=c+u;if(d.set(h,p),s)return{dimension:h,value:c,stack:p,prevStack:u,datum:e};const g=Object.assign({},e);return g[null!==(l=t.asStack)&&void 0!==l?l:t.stackField]=p,t.asPrevStack&&(g[t.asPrevStack]=u),g}));return s&&(o=o.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),t.asPrevStack&&(d[t.asPrevStack]=h),d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,d}))),"negative"===t.orient?o.reverse():o},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:m}=t,y=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),_=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),v=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:_,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y],x=e.map(((t,i)=>{var n,m;const y=Object.assign({},t),_=Number.parseFloat(y[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(m=e[i+1])||void 0===m?void 0:m[s]),w=b(S*_)?S/_:null,A=b(_*_)?_/x:null;return d&&(y[d]=x),p&&(y[p]=S),r&&(y[r]=w),a&&(y[a]=0===i?1:A),o&&(y[o]=!0===g?w:1/e.length),l&&(y[l]=_/v[1]),h&&(y[h]=i===e.length-1?f?0:y[l]:S/v[1]),c&&(y[c]=0===i?1:x/v[1]),u&&(y[u]=_),y}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),m=a-r;let y=r;const _=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*m;return d&&(e[d]=i),o&&(e[o]=y),l&&(e[l]=y+n),h&&(e[h]=y+n/2),c&&(e[c]=n),u&&(e[u]=RN(y+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),y=e[l],e}));return _[_.length-1][l]=a,_},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=BN(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return BN(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;h(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=h(e);let l=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(n-h)**2+(s-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=h(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{h(n[IN])&&(n[IN]=0);let s=n[IN];const r=t.as;return e.forEach((t=>{t&&h(t[r])&&(s+=1,t[r]=s)})),n[IN]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScalesByChannel(),o=yV(a.y),l="y"===t.dodgeChannel||h(t.dodgeChannel)&&o>0?"y":"x",c="y"===l?o:yV(a.x);if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!h(t.dodgeBy)){const e=rl(N(t.dodgeBy));o=t=>e(t.getDatum())}const d=[];e.forEach((t=>{const e=o(t);d.includes(e)||d.push(e)}));const u=d.length;if(u<1)return e;const p=ml(a,c);let g=p>=c?c:c-p;const f=ml(i,g);let m=(g-Math.max(u-1,0)*f)/u;m>t.maxWidth?(g-=(m-t.maxWidth)*u,m=t.maxWidth):m{y[t]=-g/2+e*(m+f)}));const _=r.markType;"rect"===_||"interval"===_?e.forEach((t=>{const e=o(t),i=y[e],n=t.getItemAttribute();if("x"===l){const e={x:(h(n.width)&&!h(n.x1)?Math.min(n.x,n.x1):n.x)+(h(n.width)?h(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};h(n.width)?e.x1=e.x+m:e.width=m,t.setItemAttributes(e)}else if("y"===l){const e={y:(h(n.height)&&!h(n.y1)?Math.min(n.y,n.y1):n.y)+(h(n.height)?h(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};h(n.height)?e.y1=e.y+m:e.height=m,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=y[e];if("x"===l){const e=t.getItemAttribute("x")+c/2;t.setItemAttributes({x:e+i+m/2})}else if("y"===l){const e=t.getItemAttribute("y")+c/2;t.setItemAttributes({y:e+i+m/2})}}))}return e},markPhase:"afterEncodeItems"}},vV="__vgrammar_scene_item__",bV=[tV.line,tV.area],xV=[tV.arc3d,tV.rect3d,tV.pyramid3d],SV="key",wV=[{}],AV=["key"],kV="VGRAMMAR_IMMEDIATE_ANIMATION",MV=0,CV=1e3,TV=0,EV=!1,PV=!1,RV="quintInOut",BV={stopWhenStateChange:!1,immediatelyApply:!0},IV={},DV=t=>IV[t],LV=(t,e)=>{IV[t]={creator:e}};class OV extends tE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new pk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:Ik.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new pk;let a,o;r.clear();const l=v(s)?s:Pt(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(hV.BEFORE_CREATE_VRENDER_MARK),e===tV.largeRects)return new OV(i);if(e===tV.largeSymbols)return new FV(i);const n=zV[e]?zV[e](i):DV(e)?DV(e).creator(i):null;return t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}function jV(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(hV.BEFORE_CREATE_VRENDER_MARK);const n=new JP(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=zV[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(hV.AFTER_CREATE_VRENDER_MARK),n}const NV=t=>{t&&(t[vV]=null,t.release(),t.parent&&t.parent.removeChild(t))};class VV{constructor(t){this.data=null,this.states=[],this.diffState=QN.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t];if(!a)return{};if(l(a))return a(this.getDatum(),this,t,e);if(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t])return this.graphicItem.states[t];const o=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));fV(this,o,a,this.mark.parameters());const h=this.transformElementItems(o,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?uV(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),h(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===QN.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(hV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=jN(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(hV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=N(FN(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===QN.unChange&&(this.diffState=QN.update)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(t)):this.initGraphicItem(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||this.useStates(this.states),this.mark.markType===tV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new pk))}encodeItems(t,e,i){const n=this.mark.isCollectionMark(),s=e.update,r=e.enter,a=e.exit,o=this.mark.isLargeMode();this.diffState===QN.enter?(r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.update?(n&&r&&fV(this,t,r,i,o),s&&fV(this,t,s,i,o)):this.diffState===QN.exit&&a&&fV(this,t,a,i,o)}coordinateTransformEncode(t){if(!this.mark.coord||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=o(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i)}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){const i=N(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice());i.length!==this.states.length&&(e&&f(t)&&this._updateRuntimeStates(t,e),this.useStates(i))}removeState(t){const e=N(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&this.useStates(i)}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=o(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)fl(n,i,t)&&E(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let c=null==l?void 0:l.nextAttrs;if(t&&t.length&&h(null===(n=l.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||qN(Object.keys(l.nextAttrs),this.mark.markType))&&function(t){return[tV.line,tV.area,tV.largeRects,tV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=l.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===tV.line||e===tV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>qN(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=KN(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),m=KN(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),y=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,_={x:f,y:m,context:t.key};if(n){const t=KN(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=KN(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);_.x1=t,_.y1=n}return!1===y&&(_.defined=!1),_})):null!=i?i:[]}(t,!0,i,e===tV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"]:["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>pV(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=uV(tV.line,t.attrs,i);return n.points=e.slice(t.startIndex,h(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?Object.assign(c,{segments:e,points:null}):Object.assign(c,{points:t,segments:null})}else p?Object.assign(c,{segments:(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}])}):Object.assign(c,{points:s,segments:null})}else e===tV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=KN(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=KN(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=KN(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=KN(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===tV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=KN(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=KN(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!M(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(e)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!h(e=C(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return C(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!E(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!E(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(NV(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(NV(this.graphicItem),this.graphicItem[vV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?h(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):h(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?m(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}const WV=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(b(e.center.x)&&(s.x=e.center.x),b(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},GV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),UV=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const YV=["visible","path","text","lineWidth","textBaseline","textAlign"],XV={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=b(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=b(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=rt(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:b(null==e?void 0:e.angle)?e.angle:"anticlockwise"===(null==e?void 0:e.orient)?Math.ceil(s/(2*Math.PI))*Math.PI*2:Math.floor(s/(2*Math.PI))*Math.PI*2,{from:{angle:s},to:{angle:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),l=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:c+u/2,width:h(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:d+p/2,height:h(l)?void 0:0},to:{y:r,y1:a,height:l}};default:return{from:{x:c+u/2,x1:c+u/2,y:d+p/2,y1:d+p/2,width:h(o)?void 0:0,height:h(l)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:l}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("width",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.x,a=t.getGraphicItem().attribute.width,o=t.getGraphicItem().attribute.y,l=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:r+a/2,x1:r+a/2,width:h(n)?void 0:0,height:s}};case"y":return{to:{y:o+l/2,y1:o+l/2,height:h(s)?void 0:0}};default:return{to:{x:r+a/2,x1:r+a/2,y:o+l/2,y1:o+l/2,width:h(n)?void 0:0,height:h(s)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:o,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:a,width:h(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("width",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("width",!1),s=t.getGraphicItem().attribute.x,r=s+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:r,x1:r,width:h(n)?void 0:0}}:{to:{x:s,x1:s,width:h(n)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:o,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:a,height:h(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("height",!1);let s;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else s=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("height",!1),s=t.getGraphicItem().attribute.y,r=s+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:r,y1:r,height:h(n)?void 0:0}}:{to:{y:s,y1:s,height:h(n)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=v(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=v(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:WV(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WV(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:GV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:GV(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:UV(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:UV(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=v(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return YV.forEach((t=>{delete n[t],delete s[t]})),N(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{fl(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},$V=Object.assign({},XV),KV=t=>$V[t],qV=(t,e)=>{$V[t]=e},ZV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.from.min=l,m.to.min=d),b(u)&&(m.from.max=l,m.to.max=u),b(p)&&(m.from.q1=l,m.to.q1=p),b(g)&&(m.from.q3=l,m.to.q3=g),b(f)&&(m.from.median=l,m.to.median=f),m},JV=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!b(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),m={from:{x:h,y:c},to:{x:h,y:c}};return b(d)&&(m.to.min=l,m.from.min=d),b(u)&&(m.to.max=l,m.from.max=u),b(p)&&(m.to.q1=l,m.from.q1=p),b(g)&&(m.to.q3=l,m.from.q3=g),b(f)&&(m.to.median=l,m.from.median=g),m},QV=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(b(null==i?void 0:i.center))return i.center;let f,m,y,_,v;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,m=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,y=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,v=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,m=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,y=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,v=i+e}return b(f)?f:b(_)&&b(v)?(_+v)/2:b(m)&&b(y)?(m+y)/2:b(y)?y:b(m)?m:NaN},tW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),y=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),v=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-m/2,y1:g+m/2}),Object.assign(u.median,{y:g-m/2,y1:g+m/2})),b(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-m/2,y1:g+m/2}),Object.assign(u.min,{y:g-m/2,y1:g+m/2}))):(b(y)?(Object.assign(u.box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),b(v)?(Object.assign(u.max,{x:p-v/2,x1:p+v/2}),Object.assign(u.min,{x:p-v/2,x1:p+v/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u};const eW=(t,e,i)=>{var n,s,r,a;if(b(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return b(o)?o:b(c)&&b(d)?(c+d)/2:b(l)&&b(h)?(l+h)/2:b(h)?h:b(l)?l:NaN},iW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),m=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),y=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),v=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(b(v)?Object.assign(u.minMaxBox,{y:g-v/2,y1:g+v/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),b(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(b(m)?Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),b(y)?(Object.assign(u.q1q3Box,{x:p-y/2,x1:p+y/2}),Object.assign(u.median,{x:p-y/2,x1:p+y/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u};const nW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",m=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/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`},sW=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",m=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/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`},rW=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sW:nW,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oW=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lW=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{h(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}};function hW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(SV,i?t.slice().sort(i):t.slice()),{keys:AV,data:n};const s=jN(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class cW{constructor(t,e,i){this.prevData=hW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}const dW=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{h(i[t])&&delete i[t]}));const n=qN(Object.keys(i),e.mark.markType);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const uW=(t,e,i,n,s)=>l(i)?i(t.getDatum(),t,s):i;class pW extends lC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class gW extends lC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{h(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:MA.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:MA.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}cC.mode|=TA.SET_ATTR_IMMEDIATELY;let fW=0;const mW=t=>!h(t)&&t.prototype instanceof lC;class yW{constructor(t,e,i){this.id=fW++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),b(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=l(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!KV(e.type))return null;const r=KV(e.type)(t,s,i);return dW(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return m(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):d(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!h(null===(r=s[i])||void 0===r?void 0:r.from),l=!h(null===(a=s[i])||void 0===a?void 0:a.to);return(o||l)&&(e.from[i]=o?uW(t,0,s[i].from,0,n):void 0,e.to[i]=l?uW(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),dW(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},o=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),c=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=mW(o);return h(o)||mW(o)?u?new o(a.from,a.to,r,t.easing,c):a.to?new gW(a.from,a.to,r,t.easing):void 0:new pW(a.from,a.to,r,t.easing,{interpolator:o,element:this.element,parameters:c})})).filter((t=>!h(t)));1===e.length?t.play(e[0]):t.play(new OC(r,e))}}}function _W(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(vW(i,t[i]))})),e}function vW(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return N(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,l,c,d,u;if(h(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:MV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:PV,loop:null!==(n=l.loop)&&void 0!==n?n:EV,controlOptions:L({},BV,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:CV,delay:null!==(a=l.delay)&&void 0!==a?a:TV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:RV,customParameters:l.customParameters,options:l.options}]}]}}const p=N(t.timeSlices).filter((t=>t.effects&&N(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(l=t.startTime)&&void 0!==l?l:MV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:PV,loop:null!==(d=t.loop)&&void 0!==d?d:EV,controlOptions:L({},BV,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:TV,effects:N(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:RV,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function bW(t,e,i){return l(t)?t.call(null,e.getDatum(),e,i):t}class xW{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!h(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class SW{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=_W(null!=e?e:{})}updateConfig(t){this.configs=_W(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==QN.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=vW(kV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new xW(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return h(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){return this.animators.size}getElementAnimators(t,e){var i;const n=N(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=N(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===QN.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(h(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},i),h=this.getAnimationUnit(t.timeline,e,n,r.length,i);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new yW(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===QN.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(hV.ANIMATION_START,d),this.mark.emit(hV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=FN(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=bW(t.startTime,e,s),o=bW(t.totalTime,e,s),l=bW(t.oneByOne,e,s),h=bW(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=bW(t.delay,e,s),l=null!==(i=bW(t.duration,e,s))&&void 0!==i?i:o/n,h=N(t.effects).map((t=>Object.assign({},t,{customParameters:bW(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=v(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:v(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===QN.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===QN.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===kV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===QN.exit&&0===a[QN.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(hV.ANIMATION_END,h),this.mark.emit(hV.ELEMENT_ANIMATION_END,h,i)}}const wW=(t,e)=>HN(t)?t.output():t&&d(t)?l(t.callback)?i=>t.callback(i,e):l(t.value)?t.value(e):t:t,AW=(t,e)=>t?d(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=wW(s,e),i}),{}):t.map((t=>wW(t,e))):t;var kW=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let MW=-1;class CW extends r{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MW}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=N(this.spec.dependency).map((t=>f(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=N(t).map((t=>f(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((i=>{var n;h(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return N(t).filter((t=>!h(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{t[i.id()]=i.output()})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return h(this.spec[e])||this.detach(LN(this.spec[e],this.view)),this.spec[e]=t,this.attach(LN(t,this.view)),this.commit(),this}}const TW=(t,e,i)=>{var n,s;if("callback"===t&&l(e))return{references:[],value:{callback:e,dependency:[]}};if(!h(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!h(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!h(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=LN(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},EW=(t,e)=>{const i=(n=t.type,MN[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(DN(a,e))));const o=((t,e,i)=>{if(h(e))return{value:e};if(m(e)){const n=e.map((e=>TW(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return TW(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},PW=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=EW(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class RW extends VV{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s,r;const a=null!==(n=null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])&&void 0!==n?n:null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t],o={};if(!a)return o;if(l(a))return o.attributes=a(this.getDatum(),this,t,e),o;if(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t])return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return fV(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),o.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=o):this.graphicItem.glyphStates={[t]:o},o}return o},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[vV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?uV(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(hV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=o(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(hV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===QN.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==QN.enter&&this.diffState!==QN.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){let e={};const i=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(e=n.call(null,t,this.getDatum(),this,this.mark.getGlyphConfig())),i){let n;Object.keys(i).forEach((s=>{var r;if(!h(t[s])){n||(n=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=i[s].call(null,s,t[s],n,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var i;e[t]=Object.assign(null!==(i=e[t])&&void 0!==i?i:{},a[t])}))}}))}return e}encodeDefault(){const t={};if(this.diffState===QN.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=uV(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{E(this.items[0].nextAttrs,e)||E(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=dV[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{E(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===tV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return bV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&E(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),E(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),E(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)fl(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[vV]=null})),this.glyphGraphicItems=null),super.release()}}const BW=t=>t.markType===tV.glyph?new RW(t):new VV(t);function IW(t){return h(t.offsetX)?h(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function DW(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return b(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),b(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&b(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&b(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const LW="window",OW="view",FW={trap:!1},zW="default",HW="width",jW="height",NW="viewWidth",VW="viewHeight",WW="padding",GW="viewBox",UW="autoFit";function YW(t,e,i,n,s){if(s===LW){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{DW(t,IW(t),!1)}))}));const e=IW(t);DW(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var XW=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 $W extends CW{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this.animate=new SW(this,{}),this.differ=new cW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=f(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=f(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!h(this.spec.layout)}handleLayoutEnd(){var t;(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===QN.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===lV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();if(this.renderContext=this.parseRenderContext(t,e),this.init(n,e),this.renderContext.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{const i=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:wV,e);let n=i;(null==i?void 0:i.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=i.progressive,n=i.progressive.output()),this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(n),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(hV.AFTER_MARK_ENCODE)}return this.emit(hV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(hV.AFTER_MARK_UPDATE),this}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>h(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return XW(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,h(t)||(f(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return f(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState("update",t,e)}encodeState(t,e,i){if(this.spec.encode[t]){const i=this.spec.encode[t];ON(i)?this.detach(GN(i,this.view)):f(e)?this.detach(GN(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(GN(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return f(e)?(this.spec.encode[t][e]=i,this.attach(GN(i,this.view))):ON(e)?(this.spec.encode[t]=e,this.attach(GN(e,this.view))):(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(GN(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=PW(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey"];return null===t?(e.forEach((t=>{h(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{h(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return bV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!h(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState===QN.exit&&t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return;const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];ON(s)||Object.keys(s).forEach((t=>{VN(s[t])&&(e[t]=zN(s[t].scale,i))}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV];if((null==n?void 0:n.mark)===this){const i=YW(this.view,t,n,e,OW);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new SW(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=zN(this.spec.group,e);this.group=t,t&&(this.emit(hV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(hV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==tV.group){if(!this.graphicItem){const t=HV(this,tV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||xV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==tV.group?(h(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),h(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=jN(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>SV),a=jN(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>SV),o=this.spec.sort,l=this.spec.groupSort,c=this.isCollectionMark(),d=new Set(this.elements.filter((t=>t.diffState===QN.enter))),u=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(h(e))s=this.elementMap.get(n),s&&(s.diffState=QN.exit);else if(h(i)){s=this.elementMap.has(n)?this.elementMap.get(n):BW(this),s.diffState===QN.exit&&(s.diffState=QN.enter,this.animate.getElementAnimators(s,QN.exit).forEach((t=>t.stop("start")))),s.diffState=QN.enter;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),u.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=QN.update;const i=c?t:a(e[0]);s.updateData(i,e,r,this.view),u.push(s)}d.delete(s)}));const p=null!=t?t:wV;this.differ.setCurrentData(hW(p,c?a:t=>`${a(t)}-${r(t)}`,c?l:void 0)),this.differ.doDiff(),d.forEach((t=>{this.elementMap.delete(c?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=u,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateEncode(t,e,i){e?(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach((t=>{t.encodeItems(t.items,e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)):t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:HV(this,this.markType,t);if(this.emit(hV.BEFORE_ADD_VRENDER_MARK),this.markType===tV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this.renderContext.progressive.groupKeys){const i=this.renderContext.progressive.groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(hV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==tV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=hW(t,this.spec.groupBy,this.spec.groupSort);return this.isCollectionMark()&&this.differ.setCurrentData(i),i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data,groupKeys:i.keys}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=jN(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>SV),r=[];if(this.isCollectionMark())return this.renderContext.progressive.groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=BW(this);e.diffState=QN.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this.renderContext.progressive.groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=BW(this);i.diffState=QN.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(e[i]&&(t[i]=function(t,e,i){if(ON(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===tV.glyph&&XN(i)){const t=XN(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>gV(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{gV(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();if(this.emit(hV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this),t.forEach(((t,a)=>{t.encodeItems(t.items,s>0||!r&&a>0?n:e,i)})),this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(hV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(gV(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(hV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(hV.AFTER_MARK_JOIN),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(hV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(hV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(hV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),(this.renderContext.progressive.groupKeys||AV).forEach((t=>{const e=HV(this,tV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(hV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(hV.AFTER_MARK_STATE),this.emit(hV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(hV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==QN.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){return dV[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){this._delegateEvent&&this.view.renderer.stage().off("*",this._delegateEvent)}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=QN.exit))}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this.animate&&this.animate.release(),this.graphicItem&&NV(this.graphicItem),this.detachAll(),super.release()}}class KW extends $W{constructor(t,e,i){super(t,tV.component,i),this._componentDatum={[SV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:DV(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,SV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[SV]+=1}evaluateJoin(t){return this.spec.key=SV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=f(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=f(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const qW=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class ZW extends tE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){p(this.attribute[t])?L(this.attribute[t],e):this.attribute[t]=e,qW.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>qW.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){h(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ct(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ct(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onSliderPointerMove),gj.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onSliderPointerMove),gj.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=dt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this._getSliderRenderBounds(),d=this._getSliderPos(dt(n,s[0],s[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ge(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]=Ge(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+r)};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this._getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=dt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*s,a+n*s],a,s-l):dt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new UM("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function QW(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&QW(t,e)}))}JW.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,sliderStyle:{fill:"rgba(0, 0, 0, .5)"},railStyle:{fill:"rgba(0, 0, 0, .0)"},padding:2,scrollRange:[0,1]};const tG=t=>!h(t)&&!1!==t.visible,eG=["#ffffff","#000000"];function iG(t,e,i,n,s){const r=aG(t),a=aG(e);return nG(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...eG);for(const s of r)if(t!==s&&nG(s,e,i,n))return s}(r,a,i,n,s)}function nG(t,e,i,n){return n?sG(t,e)>n:"largeText"===i?sG(t,e)>3:sG(t,e)>4.5}function sG(t,e){const i=rG(t),n=rG(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function rG(t){const e=ae(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 aG(t){if(null==t?void 0:t.includes("#"))return t;const e=new se(t),{r:i,g:n,b:s}=e.color;return"#"+oe(i,n,s)}function oG(t,e){return[t[0]*e,t[1]*e]}function lG(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const hG=-.5*Math.PI,cG=1.5*Math.PI,dG="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var uG;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uG||(uG={}));const pG={[uG.selectedReverse]:{},[uG.selected]:{},[uG.hover]:{},[uG.hoverReverse]:{}},gG=(t,e,i)=>new He(Object.assign({defaultFontParams:{fontFamily:dG,fontSize:11},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function fG(t,e){var i,n;if(!t)return{width:0,height:0};const s=_B({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var mG=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);sl&&(y=l,k.setAttribute("maxLineWidth",l-g[1]-g[2])));let D=0,L=0;"center"===B?(D-=y/2,m&&m.setAttribute("x",(m.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===B||"end"===B?(D-=y,m&&m.setAttribute("x",(m.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==B&&"start"!==B||f.setAttribute("x",g[3]),"middle"===I?(L-=_/2,m&&m.setAttribute("y",0)):"bottom"===I?(L-=_,m&&m.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===I&&(f.setAttribute("y",g[0]),m&&m.setAttribute("y",E/2));const{visible:O}=s,F=mG(s,["visible"]);if(u&&o(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:O&&!!e,x:D,y:L,width:y,height:_}),"rect");M(null==p?void 0:p.panel)||(t.states=p.panel)}}}yG.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var _G=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);sf?H=f:Hde&&([ce,de]=[de,ce]),ue>pe&&([ue,pe]=[pe,ue]),ge>fe&&([ge,fe]=[fe,ge]),me>ye&&([me,ye]=[ye,me])),ce>ge&&deme&&pece&&feue&&ye=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wG=class{render(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;this.poptipComponent||(this.poptipComponent=new vG(t.attribute.poptip));let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};g=n,L(e,xG.poptip,g),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const s=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:s.e,y:s.f})),h.stage.tryInitInteractiveLayer();const r=h.stage.getLayer("_builtin_interactive");r&&r.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wG=SG([Xw()],wG);var AG=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kG=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kG=AG([Xw()],kG);let MG=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=zM.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0)},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MG=AG([Xw()],MG);const CG=new Vw((t=>{t(wG).toSelf().inSingletonScope(),t(jE).toService(wG),t(kG).toSelf().inSingletonScope(),t(PL).toService(kG),t(MG).toSelf().inSingletonScope(),t(PL).toService(MG)}));class TG extends ZW{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EG extends TG{constructor(t){super(L({},EG.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})}}EG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PG extends TG{constructor(t){super(L({},PG.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})}}PG.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RG extends TG{constructor(t){super(L({},RG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}RG.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class BG extends TG{constructor(t){super(L({},BG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=hG,endAngle:n=cG}=this.attribute,s=n-i,r=Ut(Kt(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}BG.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class IG extends TG{constructor(t){super(L({},IG.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=$t(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=jt.distancePP(t,e);this.setAttribute("radius",i)}}IG.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const DG=new Uint32Array(33),LG=new Uint32Array(33);LG[0]=0,DG[0]=~LG[0];for(let t=1;t<=32;++t)LG[t]=LG[t-1]<<1|1,DG[t]=~LG[t];function OG(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.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:e=>{let n,s,r,a,{x1:o,y1:l,x2:h,y2:c}=e,d=c;for(;d>=l;--d)if(n=d*t+o,s=d*t+h,r=n>>>5,a=s>>>5,r===a){if(i[r]&DG[31&n]&LG[1+(31&s)])return!0}else{if(i[r]&DG[31&n])return!0;if(i[a]&LG[1+(31&s)])return!0;for(let t=r+1;t{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,DG[31&i]&LG[1+(31&s)]);else for(n(r,DG[31&i]),n(a,LG[1+(31&s)]),o=r+1;o{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,LG[31&i]|DG[1+(31&n)]);else for(s(r,LG[31&i]),s(a,DG[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FG(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ct(i,0,t.width),o=ct(n,0,t.width),l=ct(s,0,t.height),h=ct(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function zG(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const s=FG(t,i);return!(n&&e.outOfBounds(s)||e.getRange(s))}function HG(t,e){return!(!t||!e)&&e.encloses(t)}function jG(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];for(let r=0;ra(s.AABBBounds,r,t,n.offset)));return jG(t,e,s,h,null===(o=n.overlap)||void 0===o?void 0:o.clampForce)}return!1}if("moveY"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return jG(t,e,s,r,null===(h=n.overlap)||void 0===h?void 0:h.clampForce)}if("moveX"===i.type){const r=(i.offset?l(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return jG(t,e,s,r,null===(c=n.overlap)||void 0===c?void 0:c.clampForce)}return!1}const VG=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],WG=["top","inside-top","inside"];const GG={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UG(t,e){var i,n;return null!==(n=null===(i=GG[e])||void 0===i?void 0:i.call(GG,t))&&void 0!==n?n:{from:{},to:{}}}const YG="same-time",XG=300,$G="linear";class KG extends ZW{constructor(){super(...arguments),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||M(e.states)||(e.addState(uG.hover,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this,(t=>{M(t.states)||(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void QW(this,(t=>{M(t.states)||(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));M(e.states)||(e.addState(uG.selected,!0),QW(this,(t=>{t===e||M(t.states)||t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}render(){const t=this._checkMarks(),e=this.layout(t);this._smartInvert(e),this._renderLabels(e)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!M(e)&&(t.states=e)}_createLabelText(t){const e=dB(t);return this._bindEvent(e),this._setStates(e),e}_checkMarks(){var t;const e=this.getBaseMarks(),i=[];return e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),this._prevRelationMap=new Map(this._relationMap),null===(t=this._relationMap)||void 0===t||t.clear(),i}layout(t){const{textStyle:e,position:i,offset:n}=this.attribute;let{data:s}=this.attribute;if(l(s)&&(s=s({})),!s||0===s.length)return[];let r=[];l(this.attribute.sort)&&t&&t.length&&(t=t.sort(this.attribute.sort)),this._relationMap||(this._relationMap=new Map);for(let a=0;a1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a;if(0===t.length)return[];const o=[],h=this.getBaseMarkGroup(),c=null!==(i=e.size)&&void 0!==i?i:{width:null!==(n=null==h?void 0:h.AABBBounds.width())&&void 0!==n?n:0,height:null!==(s=null==h?void 0:h.AABBBounds.height())&&void 0!==s?s:0};if(0===c.width||0===c.height)return t;const{avoidBaseMark:d,strategy:u=[],hideOnHit:p=!0,clampForce:g=!0}=e,f=this._bmpTool||OG(c.width,c.height),m=this._bitmap||f.bitmap(),y=u.some((t=>"bound"===t.type));d&&(null===(r=this._baseMarks)||void 0===r||r.forEach((t=>{t.AABBBounds&&m.setRange(FG(f,t.AABBBounds,!0))})));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=!1===this._enableAnimation||!1===a,l=null!==(i=a.mode)&&void 0!==i?i:YG,h=null!==(n=a.duration)&&void 0!==n?n:XG,c=null!==(s=a.easing)&&void 0!==s?s:$G,d=null!==(r=a.delay)&&void 0!==r?r:0,u=new Map,p=this._textMap||new Map,g=[];t.forEach(((t,e)=>{const i=this._createLabelText(t),n=this._relationMap.get(t._relatedIndex),s=(null==p?void 0:p.get(n))?"update":"enter";if("enter"===s)if(g.push(i),u.set(n,i),!o&&n){const{from:s,to:r}=UG(t,"fadeIn");this.add(i),n.onAnimateBind=()=>{i.setAttributes(s);const t=this._afterRelatedGraphicAttributeUpdate(i,g,e,n,{mode:l,duration:h,easing:c,to:r,delay:d});n.on("afterAttributeUpdate",t)}}else this.add(i);if("update"===s){const t=p.get(n);p.delete(n),u.set(n,t),o?t.setAttributes(i.attribute):(t.animate().to(i.attribute,h,c),!1!==a.increaseEffect&&t.attribute.text!==i.attribute.text&&b(Number(t.attribute.text)*Number(i.attribute.text))&&t.animate().play(new TC({text:t.attribute.text},{text:i.attribute.text},h,c)))}})),p.forEach((t=>{o?this.removeChild(t):null==t||t.animate().to(UG(t.attribute,"fadeOut").to,h,c).onEnd((()=>{this.removeChild(t)}))})),this._textMap=u}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==MA.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===MA.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s,r,a,o,l,h,c;if(!1!==this.attribute.smartInvert)for(let d=0;d0)u.fill=iG(u.fill,u.stroke,null===(i=this.attribute.smartInvert)||void 0===i?void 0:i.textType,null===(n=this.attribute.smartInvert)||void 0===n?void 0:n.contrastRatiosThreshold,null===(s=this.attribute.smartInvert)||void 0===s?void 0:s.alternativeColors);else if(p){const t=this._relationMap.get(u._relatedIndex).attribute.fill,e=u.fill;u.fill=iG(e,t,null===(r=this.attribute.smartInvert)||void 0===r?void 0:r.textType,null===(a=this.attribute.smartInvert)||void 0===a?void 0:a.contrastRatiosThreshold,null===(o=this.attribute.smartInvert)||void 0===o?void 0:o.alternativeColors)}else if(u.lineWidth>0){const t=this._relationMap.get(u._relatedIndex);u.stroke=t.attribute.fill;const e=u.stroke,i=u.fill;u.fill=iG(i,e,null===(l=this.attribute.smartInvert)||void 0===l?void 0:l.textType,null===(h=this.attribute.smartInvert)||void 0===h?void 0:h.contrastRatiosThreshold,null===(c=this.attribute.smartInvert)||void 0===c?void 0:c.alternativeColors)}}}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._enableAnimation=!1}enableAnimation(){this._enableAnimation=!0}}class qG extends KG{constructor(t){super(L({},qG.defaultAttributes,t)),this.name="symbol-label"}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZG extends KG{constructor(t){super(L({},ZG.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let m=0,y=0;const _=i.includes("inside");return i.includes("top")?y=_?1:-1:i.includes("bottom")?y=_?-1:1:i.includes("left")?m=_?1:-1:i.includes("right")&&(m=_?-1:1),{x:u+m*n+m*l/2,y:p+y*n+y*h/2}}}ZG.tag="rect-label",ZG.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};const JG={rect:ZG,symbol:qG};class QG extends ZW{constructor(t){super(L({},QG.defaultAttributes,t)),this.name="data-label"}render(){const{dataLabels:t,size:e}=this.attribute;if(!t||0===t.length)return;const{width:i=0,height:n=0}=e||{};if(!i||!n||!b(n*i))return;this._componentMap||(this._componentMap=new Map);const s=OG(i,n),r=s.bitmap(),a=new Map,o=this._componentMap;for(let e=0;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function tU(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 eU(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=jt.distancePP(t,r),o=i?0:1;return n?s+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function iU(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=tU(t,!!s),o=tU(r,!!s);const h=jt.distancePP(n,l),c=jt.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=eU(e,t,!1,!!s),o=eU(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=tU(t,!!s),o=tU(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}QG.defaultAttributes={pickable:!1};class nU extends ZW{constructor(t){super(L({},nU.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!M(e)&&(e.forEach(((e,s)=>{const{id:a,points:o}=e;let h="";if("line"===t||"polygon"===t)h=tU(o,!!n);else if("circle"===t){const{center:t}=this.attribute;h=eU(t,o,!1,!!n)}const c=lB(Object.assign({path:h,z:r},l(i)?L({},nU.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,o=[];o.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;o.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=tU(o,!!n),g=Ct(o[0].x-o[1].x),f=Ct(o[0].y-o[1].y),m=lB(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*wt/2:0,beta:gf?[o[0].x,0]:[0,o[0].y]},l(i)?L({},nU.defaultAttributes.style,i(t,e)):i));m.name=`${this.name}-line`,m.id=this._getNodeId(`path-${s}`),this.add(m)})),e.length>1&&s)){const t=m(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=oB(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),M(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){let i;if(null==t?void 0:t.visible){const n=this._startAngle,s=this._endAngle,{points:r,state:a}=this.attribute,o=r[0],l=r[r.length-1],{refX:h=0,refY:c=0,refAngle:d=0,style:u,symbolType:p,size:g=12}=t;let f,m;"start"===e?(f={x:o.x+(n?h*Math.cos(n)+c*Math.cos(n-Math.PI/2):0),y:o.y+(n?h*Math.sin(n)+c*Math.sin(n-Math.PI/2):0)},m=n+Math.PI/2):(f={x:l.x+(s?h*Math.cos(s)+c*Math.cos(s-Math.PI/2):0),y:l.y+(s?h*Math.sin(s)+c*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2),i=uB(Object.assign(Object.assign(Object.assign({},f),{symbolType:p,size:g,angle:m+d,strokeBoundsBuffer:0}),u)),i.name=`${e}-symbol`,i.id=this._getNodeId(`${e}-symbol`),M(null==a?void 0:a.symbol)||(i.states=a.symbol),this.add(i)}return i}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var rU,aU;sU.defaultAttributes={visible:!0,lineStyle:{lineWidth:1,stroke:"#000"},startSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}},endSymbol:{visible:!1,symbolType:"triangle",size:12,refX:0,refY:0,refAngle:0,style:{fill:"#000",zIndex:1}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background"}(rU||(rU={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(aU||(aU={}));const oU={[aU.selectedReverse]:{},[aU.selected]:{},[aU.hover]:{},[aU.hoverReverse]:{}},lU={title:{space:4,padding:0,textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1}},label:{visible:!0,inside:!1,space:4,padding:0,style:{fontSize:12,fill:"#333",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#999",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#000",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var hU=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.name&&!M(e.states)&&(e.addState(uG.hover,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.hoverReverse),t.removeState(uG.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(uG.selected))return this._lastSelect=null,void QW(this.axisContainer,(t=>{t.name&&!M(t.states)&&(t.removeState(uG.selectedReverse),t.removeState(uG.selected))}));e.name&&!M(e.states)&&(e.addState(uG.selected,!0),QW(this.axisContainer,(t=>{t!==e&&t.name&&!M(t.states)&&t.addState(uG.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);L(this.attribute,t);const i=aB({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=aB({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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,grid:r,items:a,panel:o}=this.attribute,l=aB({x:0,y:0,zIndex:1});if(l.name=rU.axisContainer,l.id=this._getNodeId("container"),l.setMode(this.mode),this.axisContainer=l,t.add(l),(null==s?void 0:s.visible)&&this.renderLine(l),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(l),null==i?void 0:i.visible){const t=aB({x:0,y:0,pickable:!1});t.name=rU.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,l.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i).getChildren();this.handleLabelsOverlap(n,e,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}if((null==e?void 0:e.visible)&&this.renderTitle(l),o&&o.visible){const t=l.AABBBounds,e=hB(Object.assign({x:t.x1,y:t.y1,width:t.width(),height:t.height()},o.style));e.name=rU.background,e.id=this._getNodeId("background"),M(o.state)||(e.states=L({},pG,o.state)),l.insertBefore(e,l.firstChild)}}renderTicks(t){const e=this.getTickLineItems(),i=aB({x:0,y:0,pickable:!1});i.name=rU.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=oB(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=rU.tick,r.id=this._getNodeId(t.id),M(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=null;else{const t=this.data[n],e=L({},pG,this.attribute.tick.state);Object.keys(e).forEach((i=>{l(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(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=oB(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=rU.subTick,r.id=this._getNodeId(`${s}`),M(n.state))r.states=null;else{const i=L({},pG,n.state);Object.keys(i).forEach((n=>{l(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&&l(n)&&(e=n(e,i));const s=this._transformItems(e),r=aB({x:0,y:0,pickable:!1});r.name=`${rU.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,o=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=dB(u);if(p.name=rU.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),M(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=null;else{const n=L({},pG,this.attribute.label.state);Object.keys(n).forEach((r=>{l(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),o=Math.max(o,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),o=Math.abs(o*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:o,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new yG(Object.assign({},e));i.name=rU.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}getTextAlign(t){let e="center";return rt(t[0],0)?e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&l(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=wt/2*(l.x>e.x?1:-1):h=wt/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===_[1]?m+=(this.axisLabelLayerSize[n-1].height+C(this.attribute,"label.space",4))*n:m+=(this.axisLabelLayerSize[n-1].width+C(this.attribute,"label.space",4))*n);const v=this.getVerticalCoord(t.point,m,p),b=this.getVerticalVector(m,p,v),x=g?g(t.label,t,e,i,n):t.label;let{style:S}=f;return S=l(S)?L({},lU.label.style,S(t,e,i,n)):S,S=L({textAlign:this.getTextAlign(b),textBaseline:this.getTextBaseline(b,p)},S),l(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},v),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new nU(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${rU.grid}-sub`:`${rU.grid}`,n.id=this._getNodeId(t),e.add(n)}}const dU={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&&uU(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function uU(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function pU(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function fU(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ce(t,i),r=Ce(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Me(t),l=Me(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:ke(t.angle);let f=i?t.angle+At:ke(90-t.angle);const m=i?e.angle:ke(e.angle);let y=i?e.angle+At:ke(90-e.angle);f>Mt&&(f-=Mt),y>Mt&&(y-=Mt);const _=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(we(s,i)+we(s,n))/2>we(s,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,f,u,p)&&_((e.x2-e.x1)/2,m,c,d)&&_((e.y2-e.y1)/2,y,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function mU(t,e){"bottom"!==t&&"top"!==t||function(t,e){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"]),e.forEach((t=>{let e=t.attribute.angle||0;if(e<0)for(;e<0;)e+=2*Math.PI;if(e>0)for(;e>=2*Math.PI;)e-=2*Math.PI;const s=e/(.5*Math.PI);let r;r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,t.setAttributes({textAlign:i[r],textBaseline:n[r],angle:e})}))}(t,e),"left"!==t&&"right"!==t||function(t,e){let i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]),e.forEach(((t,e)=>{let s=t.attribute.angle||0;if(s<0)for(;s<0;)s+=2*Math.PI;if(s>0)for(;s>=2*Math.PI;)s-=2*Math.PI;const r=s/(.5*Math.PI);let a;a=r===Math.floor(r)?2*Math.floor(r):2*Math.floor(r)+1,t.setAttributes({textAlign:i[a],textBaseline:n[a],angle:s})}))}(t,e),function(t){t.forEach((t=>{const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}var yU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return oG([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const l=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:m}=l,y=yU(l,["position","space","textStyle","autoRotate","shape","background","state"]);let _=.5;"start"===c?_=0:"end"===c&&(_=1);const{verticalFactor:v=1}=this.attribute,b=-1*v,x=this.getTickCoord(_),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+C(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,T=this.getVerticalCoord(x,k,!1),E=this.getVerticalVector(k,!1);let P,R,{angle:B}=y;if(P="start"===c?"start":"end"===c?"end":"center",h(B)&&p){B=lG(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;R=1==-1*t?"bottom":"top"}else P=this.getTextAlign(E),R=this.getTextBaseline(E,!1);const I=Object.assign(Object.assign(Object.assign({},T),y),{textStyle:Object.assign({textAlign:P,textBaseline:R},u),state:M(m)?null:{text:m.text,shape:m.shape,panel:m.background}});return I.angle=B,g&&g.visible&&(I.shape=Object.assign({visible:!0},g.style),g.space&&(I.space=g.space)),f&&f.visible&&(I.panel=Object.assign({visible:!0},f.style)),I}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=hG,endAngle:r=cG}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}handleLabelsOverlap(t,e,i,n){var s,r,a;if(M(t))return;const{verticalLimitSize:o,label:c,title:d,line:u,tick:p,orient:g}=this.attribute,f=null!==(s=c.space)&&void 0!==s?s:4;let m=o,y=0,_=0;const v=(null==u?void 0:u.visible)?null!==(r=u.style.lineWidth)&&void 0!==r?r:1:0,x=(null==p?void 0:p.visible)?null!==(a=p.length)&&void 0!==a?a:4:0;(null==d?void 0:d.visible)&&(y=fG(d.text,d.textStyle).height,_=d.space),m&&(m=(m-f-_-y-v-x)/n);const{layoutFunc:S,autoRotate:w,autoRotateAngle:A,autoLimit:k,limitEllipsis:C,autoHide:T,autoHideMethod:E,autoHideSeparation:P}=c;l(S)?S(t,e,i,this):(w&&function(t,e){if(M(t))return;const{orient:i,labelRotateAngle:n=[0,45,90]}=e;if(0===n.length||t.some((t=>!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Gt(e)})),mU(i,t),!fU(t))break}}(t,{labelRotateAngle:A,orient:g}),k&&b(m)&&m>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!M(t)&&b(i)&&t.forEach((t=>{const e=0===t.attribute.angle||h(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));t.setAttributes({maxLineWidth:e,ellipsis:n})}))}(t,{limitLength:m,ellipsis:C,orient:g}),T&&function(t,e){if(M(t))return;const i=t.filter(gU);if(M(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=l(s)?s:dU[s]||dU.parity;if(n.length>=3&&pU(n,r)){do{n=a(n,r)}while(n.length>=3&&pU(n,r));n.length<3&&!V(i).attribute.opacity&&(n.length>1&&V(n).setAttribute("opacity",0),V(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:g,method:E,separation:P}))}}_U.defaultAttributes=lU;var vU,bU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=rB(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=rU.line,c.id=this._getNodeId("line"),M(null==a?void 0:a.state)||(c.states=L({},oU,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=hG,endAngle:i=cG}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=hG,endAngle:i=cG,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return $t(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return oG(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:l,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:m,state:y}=u,_=bU(u,["space","textStyle","shape","background","state"]);let v=l,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=C(this.attribute.label,"style.fontSize",12)+C(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;h(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",v={x:l.x,y:l.y-S}):"end"===A&&(w="top",v={x:l.x,y:l.y+S});const k=Object.assign(Object.assign(Object.assign({},v),_),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:M(y)?null:{text:y.text,shape:y.shape,panel:y.background}}),{angle:T}=_;return k.angle=T,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),m&&m.visible&&(k.panel=Object.assign({visible:!0},m.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=L({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}handleLabelsOverlap(t,e,i,n){}}xU.defaultAttributes=lU;class SU extends lC{constructor(){super(...arguments),this.mode=TA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return QW(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},QW(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=b(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=_t.lastIndex=vt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=_t.exec(t))&&(n=vt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:mt(i,n)})),r=vt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=vU.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=vU.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=vU.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=vU.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===vU.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===vU.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=vU.endHandler):this.state.start=this.state.start+o:this._activeTag===vU.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),"browser"===gj.env&&(gj.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),gj.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===vU.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ct(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ct(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===vU.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=AU(t,["formatMethod"]),{formatMethod:s}=e,r=AU(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,L({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,L({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const m=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,y=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(m+y)/2,f={x:f.x+m/2,y:f.y}):(g-=(m+y)/2,f={x:f.x,y:f.y+m})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,m,y,_,v,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:B,width:I,height:D}=this.getLayoutAttrFromConfig(),L=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=L,this._background=L.createOrUpdateChild("background",Object.assign({x:B.x,y:B.y,width:I,height:D,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",L),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",L),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x+P*I,y:B.y,width:(R-P)*I,height:D,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=L.createOrUpdateChild("selectedBackground",Object.assign({x:B.x,y:B.y+P*D,width:I,height:(R-P)*D,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",L),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",L),this.renderText(),this._isHorizontal?(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+P*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+R*I,y:B.y+D/2,size:D,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:B.x+P*I,y:B.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*I,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:B.x+(P+R)/2*I,y:B.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=L.createOrUpdateChild("startHandler",Object.assign({x:B.x+I/2,y:B.y+P*D,size:I,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=L.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?B.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):B.x+I,y:B.y+P*D,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*D},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=L.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?B.x-((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2:B.x+I+((null===(y=null==M?void 0:M.background)||void 0===y?void 0:y.size)||10)/2,y:B.y+(P+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(v=null===(_=null==M?void 0:M.icon)||void 0===_?void 0:_.symbolType)&&void 0!==v?v:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=L.createOrUpdateChild("endHandler",Object.assign({x:B.x+I/2,y:B.y+R*D,size:I,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i}=this.attribute,{start:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new yG(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;c(t)&&c(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||this.setAttributes({start:t,end:e}))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...N(a))}setUpdateStateCallback(t){l(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){l(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){l(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){l(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){l(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){l(t)&&(this._statePointToData=t)}};var MU,CU,TU;kU.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(MU||(MU={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(CU||(CU={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(TU||(TU={}));class EU extends ZW{render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;if(null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i)if(this._container)this.updateMarker();else{const t=aB({});t.name="marker-container",this.add(t),this._container=t,this.initMarker(t)}}}const PU={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:MU.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]}},RU={start:{textAlign:"right",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:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},BU={label:{position:CU.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}},IU={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"}},DU={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"}};let LU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},RU[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new sU({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new yG(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};LU.defaultAttributes=PU;let OU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},IU[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=gB(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new yG(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};OU.defaultAttributes=BU;let FU=class t extends EU{constructor(e){super(L({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=TU.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},DU[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=uB(Object.assign(Object.assign({},e),n)):"text"===i?o=new yG(Object.assign({},e)):"richText"===i?o=fB(Object.assign(Object.assign({},e),s)):"image"===i?o=pB(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new sU({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=oB({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};FU.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const zU={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class HU extends ZW{getCurrent(){return this._current}constructor(t){super(L({},HU.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new UM("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new UM("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.hasState(WU.selected)?this._setLegendItemState(t,WU.selectedHover):this._setLegendItemState(t,WU.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(GU.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=i.delegate;t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{t.removeState(WU.unSelectedHover),t.removeState(WU.selectedHover)}));const e=t.getChildren()[0].find((t=>t.name===UU.focus),!1);e&&e.setAttribute("visible",!1),this._dispatchEvent(GU.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(UU.item)){const t=a.delegate;if(a.name===UU.focus){const e=t.hasState(WU.focus);t.toggleState(WU.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover,WU.focus]),this._setLegendItemState(t,WU.selected)})):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover,WU.focus]),this._setLegendItemState(e,WU.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(WU.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(WU.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(GU.legendItemClick,t);n?(this._removeLegendItemState(t,[WU.selected,WU.selectedHover]),this._setLegendItemState(t,WU.unSelected)):(this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]))}else this._setLegendItemState(t,WU.selected),this._removeLegendItemState(t,[WU.unSelected,WU.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}this._dispatchEvent(GU.legendItemClick,t)}}}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,WU.selected),this._removeLegendItemState(e,[WU.unSelected,WU.unSelectedHover])):(this._removeLegendItemState(e,[WU.selected,WU.selectedHover]),this._setLegendItemState(e,WU.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||M(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=aB({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:h,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=jU,spaceRow:f=NU,maxWidth:m,width:y,height:_}=t;c(m)?c(y)?this._itemWidthByUser=Math.min(m,y):this._itemWidthByUser=m:c(y)&&(this._itemWidthByUser=y),c(_)&&(this._itemHeightByUser=_);let v=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!M(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,c(l)&&(o>=l?(v=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,c(h)&&h0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;v&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:l=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:m={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),m=this._handleStyle(m,t,e,i,n);const y=Ge(l);let _;!1===m.visible?(_=aB({x:0,y:0,cursor:(null==m?void 0:m.style).cursor}),this._appendDataToShape(_,UU.item,t,_)):(_=aB(Object.assign({x:0,y:0},null==m?void 0:m.style)),this._appendDataToShape(_,UU.item,t,_,null==m?void 0:m.state)),_.addState(e?WU.selected:WU.unSelected);const v=aB({x:0,y:0,pickable:!1});_.add(v);let b=0;const x=C(p,"style.size",10),S=C(p,"space",8),w=uB(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&h(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&h(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,UU.itemShape,t,_,null==p?void 0:p.state),w.addState(e?WU.selected:WU.unSelected),v.add(w);let k=0;if(d){const e=C(u,"size",10);A=uB(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:y})),this._appendDataToShape(A,UU.focus,t,_),k=e}const M=dB(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,UU.itemLabel,t,_,null==g?void 0:g.state),M.addState(e?WU.selected:WU.unSelected),v.add(M);const T=C(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+T,c(a)){const n=C(f,"space",d?8:0),s=dB(Object.assign(Object.assign({x:b+T,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));this._appendDataToShape(s,UU.itemValue,t,_,null==f?void 0:f.state),s.addState(e?WU.selected:WU.unSelected),this._itemWidthByUser&&(s.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-M.AABBBounds.width()-T-k-n),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-y[1]-y[3]-k-n})),b=s.AABBBounds.x2+n,v.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-y[1]-y[3]-x-S-k);A&&(A.setAttribute("x",b),v.add(A));const E=v.AABBBounds,P=E.width(),R=E.height(),B=this._itemWidthByUser||P+y[1]+y[3],I=this._itemHeightByUser||R+y[0]+y[2];return _.attribute.width=B,_.attribute.height=I,v.translateTo(-E.x1+y[3],-E.y1+y[0]),_}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=jU,spaceRow:h=NU}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=VU}=o,f=XU(o,["animation","animationDuration","animationEasing","space"]);let m,y=0,_=0,v=0,b=0,x=1;if(t){if(m=new HU(Object.assign({layout:1===r?"horizontal":"vertical",total:99},L({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=m,this._innerView.add(m),y=(r-1)*h+this._itemHeight*r,_=i-m.AABBBounds.width()-g,_<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;_0&&t.setAttributes({x:v,y:b}),v+=l+i})),m.setAttributes({total:Math.ceil(x/r),x:_,y:e+y/2-m.AABBBounds.height()/2})}else{if(m=new HU(Object.assign({layout:"horizontal",total:99},f)),this._pager=m,this._innerView.add(m),_=this._itemMaxWidth*s+(s-1)*l,y=n-m.AABBBounds.height()-g-e,y<=0)return this._innerView.removeChild(m),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:v,y:b}),b+=h+i})),m.setAttributes({total:Math.ceil(x/s),x:(_-m.AABBBounds.width())/2,y:n-m.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(y+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(_+l)));const S=aB({x:0,y:e,width:_,height:y,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(y+h)}:{x:-(i-1)*(_+l)},u,p):t?c.setAttribute("y",-(i-1)*(y+h)):c.setAttribute("x",-(i-1)*(_+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&t.addState(e,i)}))}_removeLegendItemState(t,e){e.forEach((e=>{t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==UU.focus&&e.forEach((e=>{t.removeState(e)}))}))}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(WU.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=L({},$U,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new UM(t,{item:e,data:e.data,selected:e.hasState(WU.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=L({},t);return t.style&&l(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&l(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var qU;function ZU(t){return m(t)?t:[t,t]}function JU(t){return t?"ew-resize":"ns-resize"}KU.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:jU,spaceRow:NU,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:VU,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"}(qU||(qU={}));let QU=class t extends ZW{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(L({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onHandlerPointerMove),gj.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ct(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===gj.env)gj.removeEventListener("pointermove",this._onHandlerPointerMove),gj.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===gj.env?(gj.addEventListener("pointermove",this._onTrackPointerMove),gj.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ct(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ct(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===gj.env?(gj.removeEventListener("pointermove",this._onTrackPointerMove),gj.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute,r=this._startHandler,a=this._endHandler;let o,l,h,d;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,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(c(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const[e,i]=N(t),{layout:n,railWidth:s,railHeight:r,min:a,max:o}=this.attribute,{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===n?r:s,d=(e-a)/(o-a)*c;if(l&&this._updateHandler(l,d,e),h){const t=(i-a)/(o-a)*c;this._updateHandler(h,t,i)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:l,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;h(u)&&(u=[o,l]),this._currentValue={startValue:ZU(u)[0],endValue:ZU(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=aB({x:0,y:0});g.name=qU.innerView,this.add(g),this._innerView=g;let f,m=0;if(r&&r.visible){f=dB(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=qU.startText,g.add(f);const e=c(r.space)?r.space:0;m+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const y=aB({x:p?m:0,y:p?0:m});g.add(y);const _=aB({x:0,y:0});let v;if(_.name=qU.railContainer,this._railContainer=_,y.add(_),this._renderRail(_),m+=p?n:s,a&&a.visible){const t=c(a.space)?a.space:0;v=dB(Object.assign({x:p?m+t:n/2,y:p?s/2:m+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),v.name=qU.endText,g.add(v)}this._renderTrack(_),d&&(this._renderHandlers(y),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=hB(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=qU.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:c}=this.attribute;let{value:d}=this.attribute;h(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?l:o,[f,m]=ZU(d),y=(f-i)/(n-i)*g,_=this._renderHandler(Object.assign({x:p?y:l/2,y:p?o/2:y,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(_.name=qU.startHandler,this._startHandler=_,t.add(_),this._currentValue.startPos=y,u){const e=this._renderHandlerText(f);e.name=qU.startHandlerText,t.add(e),this._startHandlerText=e}if(e){const e=(m-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":JU(p)},r));if(a.name=qU.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(m);e.name=qU.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:l}=this.attribute;let{value:c}=this.attribute;h(c)&&(c=[i,n]);const u=this._isHorizontal,p=u?r:s;let[g,f]=ZU(c);e||(g=i);const m=aB({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=qU.trackContainer;const y=d(e)&&!0===e.draggableTrack;let _;_=!1===l?"default":!1===e||!1===y?"pointer":JU(u);const v=(f-g)/(n-i)*p,b=hB(Object.assign({x:u?(g-i)/(n-i)*p:0,y:u?0:(g-i)/(n-i)*p,width:u?v:r,height:u?s:v,cursor:_},a));b.name=qU.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return uB(t)}_renderHandlerText(t){var e,i,n;const{align:s,min:r,max:a,handlerSize:o=14,handlerText:l={},railHeight:h,railWidth:c,slidable:d}=this.attribute,u=this._isHorizontal,p=(t-r)/(a-r)*(u?c:h),g=null!==(e=l.space)&&void 0!==e?e:4,f=Object.assign({text:(null==l?void 0:l.formatter)?l.formatter(t):t.toFixed(null!==(i=null==l?void 0:l.precision)&&void 0!==i?i:0),lineHeight:null===(n=l.style)||void 0===n?void 0:n.lineHeight,cursor:!1===d?"default":JU(u)},l.style);return u?"top"===s?(f.textBaseline="bottom",f.textAlign="center",f.x=p,f.y=(h-o)/2-g):(f.textBaseline="top",f.textAlign="center",f.x=p,f.y=(h+o)/2+g):"left"===s?(f.textBaseline="middle",f.textAlign="end",f.x=(c-o)/2-g,f.y=p):(f.textBaseline="middle",f.textAlign="start",f.x=(c+o)/2+g,f.y=p),dB(f)}_bindEvents(){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),d(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===qU.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===qU.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===qU.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===qU.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new UM("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};QU.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},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}}};class tY extends YU{constructor(t){super(L({},tY.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,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:y,tooltip:_}=this.attribute,v=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{y.push({offset:(t.offset-n)/r,color:t.color})})),y.push({offset:1,color:m}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:y}))}}}function eY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}tY.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class iY extends YU{constructor(t){super(L({},iY.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,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:y,sizeBackground:_}=this.attribute,v=aB({x:0,y:0});this._innerView.add(v);const b=new QU({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:eY(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:y});v.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=lB(Object.assign(Object.assign({x:0,y:S,path:x},_),{zIndex:0}));v.add(w);const A=this._title?this._title.AABBBounds.height()+C(this.attribute,"title.space",12):0;v.translate(0-v.AABBBounds.x1,A-v.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}iY.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)"}};let nY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,h,d,u,p,g,f,m,y,_,v,b,x,S,w,A,k,M,C,T,E,P,R,B,I,D,L,O,F,z,H,j,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:mt,minHeight:yt,maxHeight:_t,align:vt,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ge(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&c(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else c(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(h=null==ct?void 0:ct.maxLineWidth)&&void 0!==h?h:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&c(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(m=ut.y)&&void 0!==m?m:At,width:null!==(_=null!==(y=ut.width)&&void 0!==y?y:pt)&&void 0!==_?_:0,height:null!==(b=null!==(v=ut.height)&&void 0!==v?v:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else c(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(c(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),c(gt)&&(Et=gt),c(ft)&&Ttmt&&(Tt=mt)),c(yt)&&Et_t&&(Et=_t)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],c(vt)||c(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:vt,e=null!==(O=null==ct?void 0:ct.width)&&void 0!==O?O:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(z=this._mainTitle)||void 0===z||z.setAttribute("textAlign","left")):"center"===t?(null===(H=this._mainTitle)||void 0===H||H.setAttribute("x",e/2),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(c(vt)||c(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:vt,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(c(bt)||c(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};nY.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 sY={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"}}};let rY=class extends ZW{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(c(i))if(!1!==i.visible){const t=L({},C(sY,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:c(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&b(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&b(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(c(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=N(n),s=[];let h=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=L({},C(sY,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:c(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+h}),"text");e.autoFit&&b(a)&&this._setAutoFit(a,d,e),e.autoLimit&&b(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;h+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const h=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-h/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const h=fG(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(h>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/h,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",c(i.style.lineHeight)?i.style.lineHeight:s)}}};class aY extends UP{constructor(t){super(t)}}var oY,lY;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(oY||(oY={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(lY||(lY={}));class hY extends ZW{constructor(t){super(L({},hY.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style: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"},hY.defaultControllerAttr),this.attribute.start.style)},this._pauseAttr={style: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"},hY.defaultControllerAttr),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign({},hY.defaultControllerAttr),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{h(this._playController)&&(this._playController=new aY(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{h(this._backwardController)&&(this._backwardController=new aY(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{h(this._forwardController)&&(this._forwardController=new aY(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new UM(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(oY.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(oY.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(oY.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(oY.OnBackward);this.dispatchEvent(t)},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()}}hY.defaultControllerAttr={x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},hY.defaultAttributes={visible:!0,[lY.Start]:{},[lY.Pause]:{},[lY.Backward]:{},[lY.Forward]:{}};const cY={style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},dY=[200,10];var uY,pY;!function(t){t.Default="default",t.Reverse="reverse"}(uY||(uY={})),function(t){t.OnChange="onChange",t.OnPlay="onPlay",t.OnPause="onPause",t.OnBackward="onBackward",t.OnForward="onForward",t.OnEnd="onEnd"}(pY||(pY={}));const gY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},fY=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===uY.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===uY.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},mY=t=>"top"===t||"bottom"===t;class yY extends ZW{constructor(t){super(L({},yY.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;b(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Pt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:b(n)?n:void 0,handlerStyle:this._handlerStyle,dy:this.attribute.slider.dy,dx:this.attribute.slider.dx,slidable:!0,visible:!0,range:!1,handlerText:{visible:!1},startText:{visible:!1},endText:{visible:!1}};if(mY(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:dY[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:dY[1];s.layout="vertical",s.railWidth=e,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 QU(t),this.add(this._slider)},this._updateControllerAttrs=()=>{const t={visible:!0,start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return mY(this._orient)?(t.layout="horizontal",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},t.forward={style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}):(t.layout="vertical",t.start={style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.pause={style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})},t.backward={style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})},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 hY(t),this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._railStyle=Object.assign({},null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.railStyle),this._trackStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.trackStyle),this._handlerStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.handlerStyle),this._start=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.controller)||void 0===o?void 0:o.start),this._pause=Object.assign({},null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.pause),this._forward=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.forward),this._backward=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=mY(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:dY[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=v(i)?i:Pt(i[0],i[1]);return t+e.space+n}),0),l=(mY(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,h=l-this.attribute.slider.space,c=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mY(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mY(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=v(s)?s:Pt(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mY(this._orient)?t+n:(this._size.width-r)/2,y:mY(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new UM(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}yY.defaultAttributes={visible:!0,data:[],interval:1e3,orient:"bottom",align:"center",size:{height:20,width:300},slider:{space:10,dx:0,dy:0,railStyle:{cornerRadius:5},trackStyle:{},handlerStyle:{}},controller:{start:Object.assign(Object.assign({},cY),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},cY),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},cY),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},cY),{key:"backward",position:"start"})}};class _Y extends yY{constructor(t){super(L({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:uY.Default,this._dataIndex=h(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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(pY.OnChange)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(gY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||fY({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===uY.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(pY.OnPlay),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=gj.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(pY.OnChange),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(pY.OnChange)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=gj.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(),gj.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnBackward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(pY.OnChange),this.dispatchCustomEvent(pY.OnForward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var vY=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class bY extends yY{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(oY.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(oY.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(oY.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(oY.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,n=i/this._maxIndex;this._elapsed=n*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(pY.OnChange))},this.play=()=>vY(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(pY.OnPlay),this._rafId=gj.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=gj.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnEnd)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,gj.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(pY.OnPause))},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(pY.OnBackward)},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(pY.OnForward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}const xY={debounce:gt,throttle:ft};let SY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{this._outOfInteractiveRange(t)||(this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?"brushEnd":"brushMaskUp",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._operatingMask.setAttribute("pickable",!1))}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",xY[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e,removeOnClick:i}=this.attribute,n=this.eventPosToStagePos(t);this._cacheDrawPoints=[n],this._operatingMask||this._addBrushMask(),"single"===e&&i?(this._container.incrementalClearChild(),this._addBrushMask()):"multiple"===e&&this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushStart",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskDown",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){const e=this.eventPosToStagePos(t);if(this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(e.x===(null==t?void 0:t.x)&&e.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(e);const i=this._computeMaskPoints();this._operatingMask.setAttribute("points",i),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushing",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:"brushMaskMove",operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=gB(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return L(t,...i,{shape:s.every(h)?void 0:L({},...s),key:r.every(h)?void 0:L({},...r),value:a.every(h)?void 0:L({},...a)})},AY=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:N(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},kY={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:dG,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:dG,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Wt).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},MY=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let CY=class t extends ZW{constructor(e){super(L({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const h=Ge(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:h[3],y:h[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",L({symbolType:"circle"},d.shape,{visible:tG(d)&&tG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:tG(d)&&tG(d.value)},AY(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:tG(d)&&tG(d.value)},d.value),"text");const u=tG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-h[3]-h[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const m=tG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",h[3]),this._tooltipContent.setAttribute("y",h[0]+m);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!tG(l))return;const h=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(h,{visible:!0,x:0,y:e},"group");let u=0;if(tG(l.shape)&&d.createOrUpdateChild(`${h}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),tG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},AY(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(tG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},AY(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${h}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";c(l.value.textAlign)?e=l.value.textAlign:tG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>MY.includes(t)))?(this._mergeAttributes(e,n),h(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&tG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=tG(g),y=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=gG(u),v=gG(p);let b=0;if(tG(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(tG(p)){const{width:t,height:e}=v.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&WP[y]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return wY({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wY({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};CY.defaultAttributes=kY;const TY={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class EY extends KW{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=f(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}LV(nV.lineAxis,((t,e)=>new _U(t,e))),LV(nV.circleAxis,(t=>new xU(t)));class PY extends EY{constructor(t,e,i){super(t,eV.axis,e),this.spec.componentType=eV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=L({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=DV(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=mV(s,e,i,n);const c=FN(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=FN(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=FN(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case nV.lineAxis:return((t,e,i)=>{var n,s;const r=TY.axis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p);case nV.circleAxis:return((t,e,i)=>{var n,s;const r=TY.circleAxis;return t?L({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):L({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(h(e)){const i=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?nV.circleAxis:nV.lineAxis,this._axisComponentType}}LV(sV.discreteLegend,(t=>new KU(t))),LV(sV.colorLegend,(t=>new tY(t))),LV(sV.sizeLegend,(t=>new iY(t)));class RY extends EY{constructor(t,e){super(t,eV.legend,e),this.spec.componentType=eV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==sV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":GU.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=f(t)?this.view.getDataById(t):t,l=f(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,iV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=DV(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=mV(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case sV.discreteLegend:return((t,e)=>{const i=TY.discreteLegend;return t?L({},i,{items:Array.from(new Set(N(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=NN(n),r=s?Object.assign(Object.assign({},TY.discreteLegend.items[0].shape),{fill:s,stroke:s}):TY.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):L({},i,null!=e?e:{})})(o,a);case sV.colorLegend:return((t,e)=>{const i=TY.colorLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{colors:t.range().slice(),min:n[0],max:V(n)},null!=e?e:{})})(o,a);case sV.sizeLegend:return((t,e)=>{const i=TY.sizeLegend;if(!t)return L({},i,null!=e?e:{});const n=t.domain();return L({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&zl(i)){const t=e.getScale().range();NN(null==t?void 0:t[0])?this._legendComponentType=sV.colorLegend:this._legendComponentType=sV.sizeLegend}else this._legendComponentType=sV.discreteLegend}return this._legendComponentType}}LV(rV.lineCrosshair,(t=>new EG(t))),LV(rV.rectCrosshair,(t=>new PG(t))),LV(rV.sectorCrosshair,(t=>new BG(t))),LV(rV.circleCrosshair,(t=>new RG(t))),LV(rV.polygonCrosshair,(t=>new IG(t)));const BY=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(jl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Yt(Kt(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else zl(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=Kt(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}};class IY extends EY{constructor(t,e){super(t,eV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(f(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case rV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return L({},l,BY(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case rV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=TY.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=BY(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=L({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case rV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(jl(e.type)){const i=Yt(Kt(u,t)+2*Math.PI);f=e.scale(e.invert(i))}else zl(e.type)&&(f=Kt(u,t));return L({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.circleCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l;const h=TY.circleCrosshair,c=null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2,d=null!==(l=null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center)&&void 0!==l?l:{x:n.width/2,y:n.height/2};let u=0;if(jl(e.type)){const i=Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2);u=e.scale(e.invert(i))}else zl(e.type)&&(u=Math.min(c,Math.sqrt((t.x-d.x)**2+(t.y-d.y)**2)));return L({},h,{center:d,radius:u,startAngle:h.startAngle,endAngle:h.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case rV.polygonCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=TY.circleCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2};let p=0;if(jl(e.type)){const i=Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2);p=e.scale(e.invert(i))}else zl(e.type)&&(p=Math.min(d,Math.sqrt((t.x-u.x)**2+(t.y-u.y)**2)));return L({},c,{center:u,radius:p,startAngle:c.startAngle,endAngle:c.endAngle},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=DV(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?rV.sectorCrosshair:rV.rectCrosshair:"radius"===n?rV.circleCrosshair:"radius-polygon"===n?rV.polygonCrosshair:rV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}LV(eV.slider,(t=>new QU(t)));class DY extends KW{constructor(t,e){super(t,eV.slider,e),this.spec.componentType=eV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=f(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=f(t)?this.view.getDataById(t):t,a=f(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,iV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>L({},TY.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(h(this.spec.min)?0:FN(this.spec.min,i,t,e),h(this.spec.max)?1:FN(this.spec.max,i,t,e),mV(n,t,e,i))}),e}),{});this._encoders=e}}LV(eV.label,(t=>new QG(t)));let LY=class extends KW{constructor(t,e){super(t,eV.label,e),this.spec.componentType=eV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let l=FN(this.spec.size,i);return l||(l=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=TY.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case tV.line:r=TY.lineLabel;break;case tV.rect:r=TY.rectLabel;break;case tV.symbol:r=TY.symbolLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[vV],n=mV(i,e.getDatum(),e,s),o=L({},r.data[0],n);a.push(o)}}));const o=FN(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return L({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!h(t)));return L({},r,{size:e,dataLabels:a})})(a,l,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};LV(eV.datazoom,(t=>new kU(t)));class OY extends KW{constructor(t,e){super(t,eV.datazoom,e),this.spec.componentType=eV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!h(this.spec.preview)){const t=this.spec.preview.data,e=f(t)?this.view.getDataById(t):t;this.detach(e),this.detach(GN(this.spec.preview.x,this.view)),this.detach(GN(this.spec.preview.y,this.view)),this.detach(GN(this.spec.preview.x1,this.view)),this.detach(GN(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=f(t)?this.view.getDataById(t):t;this.attach(r),this.attach(GN(e,this.view)),this.attach(GN(i,this.view)),this.attach(GN(n,this.view)),this.attach(GN(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=f(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t,c=f(e)?(t,i)=>{if(h(i.start)||h(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,l,iV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),l&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:l,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},TY.datazoom,t),n=DV(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=f(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r,a,o,l,h;const c=mV(s,t,e,n);return((t,e,i,n,s,r,a,o)=>{const l=TY.datazoom;return t?L({},l,{previewData:t,previewXCallback:e?t=>mV({x:e},t,r,a).x:null,previewYCallback:i?t=>mV({y:i},t,r,a).y:null,previewX1Callback:n?t=>mV({x1:n},t,r,a).x1:null,previewY1Callback:s?t=>mV({y1:s},t,r,a).y1:null},null!=o?o:{}):L({},l,null!=o?o:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),null===(a=this.spec.preview)||void 0===a?void 0:a.x,null===(o=this.spec.preview)||void 0===o?void 0:o.y,null===(l=this.spec.preview)||void 0===l?void 0:l.x1,null===(h=this.spec.preview)||void 0===h?void 0:h.y1,e,n,c)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=f(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}LV(oV.continuousPlayer,(t=>new bY(t))),LV(oV.discretePlayer,(t=>new _Y(t)));let FY=class extends KW{constructor(t,e){super(t,eV.player,e),this.spec.componentType=eV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=m(t)?null:f(t)?this.view.getDataById(t):t;this.detach(e)}const r=m(e)?null:f(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=f(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(pY.OnChange,this._filterCallback),this.spec.target=void 0;const l=f(t)?this.view.getDataById(t):t;return this._filterData(o,l,iV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(pY.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=L({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:DV(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=mV(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=m(o)?null:f(o)?this.view.getDataById(o):o,h=m(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>L({},TY.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>L({},TY.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};LV(eV.tooltip,(t=>new CY(t)));let zY=class extends KW{constructor(t,e){super(t,eV.tooltip,e),this._targetMarks=[],this._onTooltipShow=ft(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new Wt).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e),c=((t,e,i,n,s)=>L({},TY.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{}))(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=eV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.title(t.title),this.content(t.content),this}target(t){if(this.spec.target){const t=N(this.spec.target).map((t=>f(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=N(t).map((t=>f(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!h(t))),this.commit(),this}title(t){return this.spec.title&&this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,t&&this.attach(this._parseTooltipRow(this.spec.title)),this.commit(),this}content(t){return this.spec.content&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&this.attach(this._parseTooltipRow(this.spec.content)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=mV(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return N(t).reduce(((t,e)=>(t=t.concat(LN(e.visible,this.view)),WN(e.key)||(t=t.concat(LN(e.key,this.view))),WN(e.value)||(t=t.concat(LN(e.value,this.view))),WN(e.symbol)||(t=t.concat(LN(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i,n){let s,r,a,o=FN(t.visible,n,e,i);return o=!!h(o)||!!o,s=WN(t.key)?ll(t.key.field)(e):FN(t.key,n,e,i),s=h(s)?void 0:u(s)?s:{text:s},r=WN(t.value)?ll(t.value.field)(e):FN(t.value,n,e,i),r=h(r)?void 0:u(r)?r:{text:r},a=WN(t.symbol)?ll(t.symbol.field)(e):FN(t.symbol,n,e,i),a=h(a)?void 0:u(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=t.getDatum(),i=this.parameters();return{title:this.spec.title?this._computeTooltipRow(this.spec.title,e,t,i):void 0,content:this.spec.content?N(this.spec.content).map((n=>this._computeTooltipRow(n,e,t,i))):void 0}}};var HY=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 jY extends CW{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this},this._loadTasks=[],h(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=LN(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];N(t.source).forEach((t=>{const i=HN(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return HY(this,void 0,void 0,(function*(){const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return h(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return h(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=N(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=PW(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=PW(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(N(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=N(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function NY(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function VY(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,NY(t,e,s,n)}class WY{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}return this.nodes.push(t),NY(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),NY(this.nodes,e,0,this.compare),VY(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,VY(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class GY{constructor(t){this.list=[],this.ids={},this.idFunc=t||hl}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var UY=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 YY{constructor(){this.grammars=[],this.logger=We.getInstance(),this._curRank=0,this._committed=new GY((t=>t.uid)),this._heap=new WY(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return UY(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>h(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new GY((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return UY(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const XY=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===tV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class $Y{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(hV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return RT(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gk.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&this._stage.render(),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(hV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new Cj(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(hV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(hV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(hV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new JM(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=d(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new eC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class KY extends CW{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?FN(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(m(t)&&m(this.value)&&t.length===this.value.length){for(let e=0;e0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function rX(t,e,i){FN(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=FN(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),h(null==n?void 0:n.clamp)||(l(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function aX(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i),rX(t,e,i)}function oX(t,e,i){t.round&&e.round(FN(t.round,i,e),!0),t.padding&&e.padding(FN(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(FN(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(FN(t.paddingOuter,i,e),!0),t.align&&e.align(FN(t.align,i,e),!0)}function lX(t,e,i,n){const s=t.field,r=zN(t.data,i),a=f(s)?r.map((t=>t[s])):s.reduce(((t,e)=>(r.forEach((i=>{t.push(i[e])})),t)),[]);return t.sort&&a.sort(t.sort),zl(e.type)?(n&&a.filter((t=>v(t))),[Math.min.apply(null,a),Math.max.apply(null,a)]):a}function hX(t,e,i){if(ZY(t.domain)?e.domain(lX(t.domain,e,i,!0),!0):e.domain(FN(t.domain,i,e),!0),ZY(t.range))e.range(lX(t.range,e,i),!0);else if(JY(t.range)){const n=zN(t.range.coordinate,i);!function(t){switch(t){case Fl.Quantile:case Fl.Quantize:case Fl.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(FN(t.range,i,e),!0);switch(t.type){case"linear":aX(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){oX(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){aX(t,e,i);const n=FN(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i);const n=FN(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){aX(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){aX(t,e,i);const n=FN(t.constant,i,e);b(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){iX(t,e,i),sX(t,e,i),rX(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){iX(t,e,i),nX(t,e,i),sX(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class cX extends CW{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=qY(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=qY(this.spec.type)),hX(this.spec,this.scale,e),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return h(this.spec.domain)||this.detach(tX(this.spec.domain,this.view)),this.spec.domain=t,this.attach(tX(t,this.view)),this.commit(),this}range(t){return h(this.spec.range)||this.detach(tX(this.spec.range,this.view)),this.spec.range=t,this.attach(tX(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!h(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisiualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!h(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return h(e)?null:this.parameters()[e]}configure(t){return this.detach(eX(this.spec.type,t,this.view)),h(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(eX(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let dX=-1;const uX=[HW,jW,WW,NW,VW,GW,UW],pX=t=>{var e,i,n,s;return v(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},gX=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:RV,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:TV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:CV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:PV,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null}}},fX=(t,e)=>(null==e?void 0:e.debounce)?gt(t,e.debounce):(null==e?void 0:e.throttle)?ft(t,e.throttle):t,mX=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:OW;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):zV[t]?(i.markType=t,i.source=e):i.source=t===LW?LW:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},yX={},_X=()=>yX;let vX=class extends $W{constructor(t,e){super(t,tV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return dV.rect}evaluateJoin(t){return super.evaluateJoin(wV)}};function bX(t,e){if(b(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return b(t)?t*e:0}return 0}function xX(t,e){return Math.min(t<0?t+e:t-1,e)}function SX(t,e,i){let n=xX(t,i),s=xX(e,i);if(b(t)||b(e)?b(t)?b(e)||(n=xX(Math.max(0,s-1),i)):s=xX(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const wX=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>bX(t,i))),u=l.map((t=>bX(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const m=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));m.push(f);let y=0;const _=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=y;return y+=i+c,n}));return _.push(y),{rows:m,columns:_,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=SX(e,i,r),{start:h,end:c}=SX(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Vt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},AX=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=ml(r.maxChildWidth,s.width()),o=ml(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=pX(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&d{null==t||t.forEach((t=>{var n;if(t.markType!==tV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(l(r))r.call(null,t,s,a,e);else if(l(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=AX(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1-a.y1,right:a.x2-r.x2,left:r.x1-a.x1,bottom:a.y2-r.y2};i.updateSignal(NW,o),i.updateSignal(VW,l),i.updateSignal(WW,h)}else AX(t,s,a,e);else"grid"===r.display&&wX(t,s,a);kX(s,e,i)}))};class MX extends $W{constructor(t,e,i){super(t,tV.glyph,i),this.glyphType=e,this.glyphMeta=XN(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=jV(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let CX=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return h(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return h(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return m(t)?(i.x=t[0],i.y=t[1]):v(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new qt,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class TX extends CX{constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(b(t.x1)||b(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisiualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=h(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=h(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=m(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class EX extends CX{constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Yt(s);const r=rt(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function PX(t){switch(t){case"cartesian":default:return new TX;case"polar":return new EX}}class RX extends CW{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=PX(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=PX(this.spec.type)),function(t,e,i){var n,s,r,a,o,l,c;!h(t.start)&&e.start(null!==(n=FN(t.start,i))&&void 0!==n?n:[0,0]),!h(t.end)&&e.end(null!==(s=FN(t.end,i))&&void 0!==s?s:[0,0]),!h(t.origin)&&e.origin(null!==(r=FN(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!h(t.translate)){const e=FN(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!h(t.rotate)){const e=FN(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!h(t.scale)){const e=FN(t.scale,i);d.push({type:"scale",scale:{x:null!==(l=null==e?void 0:e[0])&&void 0!==l?l:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}h(t.transpose)||FN(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const BX=Symbol.for("key");class IX{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i[0]}):h(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&(i.morphAll||t.getMorphConfig().morph)&&t.markType!==tV.group?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=hW(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=hW(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!h(e.morphElementKey)){const i=jN(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new cW(t,i);return s.setCallback(((t,e,i)=>{h(e)?n.exit.push({prev:i}):h(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(hW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:BX})),r=hW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:BX}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==BX){const e=s.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=FN(i.animation.delay,s,o,l),d=FN(i.animation.duration,s,o,l),u=FN(i.animation.oneByOne,s,o,l),p=FN(i.animation.splitPath,s,o,l),g=b(u)&&u>0?t=>v(u)?t*u:!0===u?t*d:0:void 0;1!==t.length&&0!==t.length||1!==e.length?1===t.length&&e.length>1?((t,e,i)=>{var n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(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);yT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,r;const a=t.filter((t=>t.toCustomPath&&t.valid));a.length||console.error(t," is not validate"),e.valid&&e.toCustomPath||console.error(e," is not validate");const o=("clone"===(null==i?void 0:i.splitPath)?xT:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:ST)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>pT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>fT(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:MA.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new mT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:fC,null!==(l=i.easing)&&void 0!==l?l:mC))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:MA.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new _T({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:fC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:mC))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):yT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class DX{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=f(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);this._grammarMap[n]?(this._grammars[n].push(t),h(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),h(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),h(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),h(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class LX{constructor(t){this._animations=[],this._onAnimationStart=t=>{0===this._animations.length&&this._view.emit(hV.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._animations=this._animations.filter((e=>e.config!==t.animationConfig||e.mark!==t.mark)),0===this._animations.length&&this._view.emit(hV.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(hV.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(hV.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e)})),this}pause(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e)})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e)})),this}enable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})),this}disable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i||i.call(e)})),this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.enableAnimationState)||void 0===n||n.call(i,t)})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.disableAnimationState)||void 0===n||n.call(i,t)})),this}isAnimating(){return 0!==this._animations.length}animate(){return this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}release(){this._view.removeEventListener(hV.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(hV.ALL_ANIMATION_END,this._onAnimationEnd)}}class OX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const l=mV(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===Fl.Band){if(!h(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.y1=n.y.scale(s)}const t=n.x.bandwidth();l.x=l.x+t/4,l.x1=l.x+t/2}else if(n&&n.y&&n.y.type===Fl.Band){if(!h(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;l.x1=n.x.scale(s)}const t=n.y.bandwidth();l.y=l.y+t/4,l.y1=l.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();l.cx=e.x,l.cy=e.y}}return l}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:dV.rect}addGraphicItem(t,e){const i=HV(this,this.coord&&"polar"===this.coord.output().type?tV.arc:tV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class FX extends $W{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=ON(e)?null:Object.keys(e).reduce(((t,n)=>(VN(e[n])&&(t[n]=zN(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=mV(e,t,i,s);if(h(r.size)){const t=n.x?yV(n.x):void 0,e=n.y?yV(n.y):void 0;h(t)&&h(e)?r.size=10:h(t)?r.size=e:h(e)&&(r.size=t),r.size=[t,e]}return h(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(v(i.padding)&&i.padding>0)t.size=m(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(m(i.padding)&&2===i.padding.length){const e=m(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(dV.symbol)}release(){super.release(),this._encoders=null}}var zX=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 HX extends r{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[vV],s=YW(0,t,n,e,OW);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){f(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new KY(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new jY(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new cX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new RX(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=f(e)?this.getMarkById(e):e;let s;switch(t){case tV.group:s=new vX(this,n);break;case tV.glyph:s=new MX(this,null==i?void 0:i.glyphType,n);break;case tV.component:s=((t,e,i,n)=>{switch(e){case eV.axis:return new PY(t,i,n);case eV.legend:return new RY(t,i);case eV.crosshair:return new IY(t,i);case eV.slider:return new DY(t,i);case eV.label:return new LY(t,i);case eV.datazoom:return new OY(t,i);case eV.player:return new FY(t,i);case eV.tooltip:return new zY(t,i)}return new KW(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case tV.interval:s=new OX(this,t,n);break;case tV.cell:s=new FX(this,t,n);break;default:s=new $W(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(tV.group,t)}glyph(t,e){return this.mark(tV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(tV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(tV.component,t,{componentType:eV.axis,mode:e})}legend(t){return this.mark(tV.component,t,{componentType:eV.legend})}crosshair(t){return this.mark(tV.component,t,{componentType:eV.crosshair})}slider(t){return this.mark(tV.component,t,{componentType:eV.slider})}label(t){return this.mark(tV.component,t,{componentType:eV.label})}datazoom(t){return this.mark(tV.component,t,{componentType:eV.datazoom})}player(t){return this.mark(tV.component,t,{componentType:eV.player})}tooltip(t){return this.mark(tV.component,t,{componentType:eV.tooltip})}customized(t,e){const i=(t=>yX[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec())),this}removeGrammar(t){const e=f(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?(this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&uX.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(hV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++dX;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(HW,t.width),this.updateSignal(jW,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=_X();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(hV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=lV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:HW,value:null!==(i=t[HW])&&void 0!==i?i:0},{id:jW,value:null!==(n=t[jW])&&void 0!==n?n:0},{id:WW,value:pX(null!==(s=t[WW])&&void 0!==s?s:e[WW])},{id:NW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[HW]-i.left-i.right},dependency:[HW,WW]}},{id:VW,update:{callback:(t,e)=>{const i=pX(e[WW]);return e[jW]-i.top-i.bottom},dependency:[jW,WW]}},{id:GW,update:{callback:(t,e)=>{const i=pX(e[WW]);return(t||new Vt).setValue(i.left,i.top,i.left+e[NW],i.top+e[VW])},dependency:[NW,VW,WW]}},{id:UW,value:null!==(r=t[UW])&&void 0!==r?r:e[UW]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===tV.glyph?{glyphType:t.glyphType}:t.type===tV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(HW);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jW);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(NW);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(VW);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(WW);if(arguments.length){const i=pX(t);return this.updateSignal(e,i),i}return pX(e.output())}autoFit(t){const e=this.getSignalById(UW);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(GW);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=lV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===tV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||kX;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(hV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(hV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(hV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{XY(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(hV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(hV.BEFORE_MARK_RENDER_END),XY(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(hV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return zX(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return zX(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(hV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(hV.AFTER_DO_RENDER)}evaluate(t){var e,i;return zX(this,void 0,void 0,(function*(){const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=gX(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.releaseCachedGrammars();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=lV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=lV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=lV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!uX.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):t.morph&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(){this._cachedGrammars.traverse((t=>{if("mark"===t.grammarType){const e=t;e.prepareRelease(),e.animate.animate(),0===e.animate.getAnimatorCount()?e.release():e.addEventListener("animationEnd",(t=>{0===e.animate.getAnimatorCount()&&e.release()}))}else t.release()})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return XY(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=en(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return zX(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(HW,t)),e!==this.height()&&(n=!0,this.updateSignal(jW,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:l}=t,c=mX(e);if(!c)return;const{source:u,type:p}=c,g=h((v=c).markId)?t=>t&&t.mark.id()===v.markId:h(v.markName)?t=>t&&t.mark.name()===v.markName:h(v.type)?t=>t&&t.mark.markType===v.type:()=>!0,m=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:f(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),y=DN(l,this),_=fX(((t,e)=>{const n=u===OW&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===LW&&(t=YW(0,t,e,p,LW));let s=!1;if((!i||i(t))&&(!g||g(e))&&m.length){const e=y.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});m.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var v;if(u===OW){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||d(n)&&!n[i])}(this._eventConfig,OW,p))return this.addEventListener(p,_,FW),()=>{this.removeEventListener(p,_)}}else if(u===LW)return gj.addEventListener(p,_),this._eventListeners.push({type:p,source:gj,handler:_}),()=>{gj.removeEventListener(p,_);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===gj&&t.handler===_));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);f(e)?i.type=e:d(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:zW,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?f(r)?r:r.user:zW,o=r&&a===r.user&&(s===r.element||h(s)&&h(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==zW?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){this.renderer.stage().on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!h(document)&&document.body:this.container;return e?h(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new $Y(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new DX((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new DX((t=>t.id())),this._options.logger&&We.setInstance(this._options.logger),this.logger=We.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new YY,this.animate=new LX(this),this._morph=new IX,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{m(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[OW,LW]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&gj.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=lV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==tV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=gj.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&gj.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),EN(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const jX=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{TN(e,t[e],!0)}))}))};jX(_V);const NX=["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 VX,WX,GX;!function(t){t.initialized="initialized",t.rendered="rendered",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.rawDataStatisticsUpdate="rawDataStatisticsUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover"}(VX||(VX={})),function(t){t.chart="chart",t.window="window"}(WX||(WX={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(GX||(GX={}));const UX=`${Kj}_waterfall_default_seriesField`,YX=`${Kj}_DEFAULT_DATA_INDEX`,XX=`${Kj}_DEFAULT_DATA_KEY`,$X=`${Kj}_DEFAULT_DATA_SERIES_FIELD`,KX=`${Kj}_DEFAULT_SERIES_STYLE_NAME`;var qX;!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.Built_In=99]="Built_In"}(qX||(qX={}));const ZX=`${Kj}_STACK_START`,JX=`${Kj}_STACK_END`,QX=`${Kj}_STACK_START_PERCENT`,t$=`${Kj}_STACK_END_PERCENT`,e$=`${Kj}_STACK_START_OffsetSilhouette`,i$=`${Kj}_STACK_END_OffsetSilhouette`,n$=`${Kj}_SEGMENT_START`,s$=`${Kj}_SEGMENT_END`;var r$,a$;!function(t){t[t.Axis_Grid=100]="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"}(r$||(r$={})),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"}(a$||(a$={}));const o$=["linear","radial","conical"],l$={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}},h$={innerRadius:0,outerRadius:1,startAngle:wN,endAngle:AN,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{stroke:"#ffffff",fillOpacity:1,cursor:"pointer"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}};var c$,d$;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(c$||(c$={})),function(t){t.middle="middle",t.start="start",t.end="end"}(d$||(d$={}));const u$={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,tickSize:Ij,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:Ij/2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,space:10,style:{fontSize:Rj,fill:{type:"palette",key:"labelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,style:{fontSize:Rj,fill:"#333333",fontWeight:"normal",fillOpacity:1}}},p$={trigger:"hover",xField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},yField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},categoryField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}},valueField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:"#b2bacf",opacity:.2,lineDash:[]}},label:{visible:!1,style:{fontWeight:"normal",fill:"#fff",fontSize:Rj},labelBackground:{padding:{bottom:2,top:2,left:4,right:4},style:{fill:"rgba(47, 59, 82, 0.9)",cornerRadius:4}}}}},g$={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:Rj,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},f$={name:"light",padding:12,fontFamily:Pj,colorScheme:{default:{dataScheme:[{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"]}],palette:{labelFontColor:"#89909D",titleFontColor:"#000000",axisGridColor:"#EBEDF2",axisDomainColor:"#D9DDE4"}}},mark:{text:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:Rj,fontWeight:"normal",fillOpacity:1}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round"}},point:{style:{size:8,stroke:"#ffffff",lineWidth:1,fillOpacity:1}},word:{style:{fontSize:null}},fillingWord:{style:{fontSize:null}},sunburst:{style:{lineWidth:1,stroke:"#fff"}},circlePacking:{style:{lineWidth:1,stroke:"#fff"}},funnel3d:{style:{stroke:!1}}},series:{scatter:Yj,line:Nj,area:Dj,bar:Lj,bar3d:Oj,pie:Wj,pie3d:Gj,map:Vj,radar:Uj,dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:10}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:10}}},link:{arrow:{style:{size:10}}},wordCloud:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},wordCloud3d:{word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},funnel:Fj,funnel3d:zj,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:"#E7EBED",fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}}},waterfall:Xj,gauge:{outerRadius:.8,innerRadius:.6,padAngle:.02,segment:{style:{fillOpacity:1}}},gaugePointer:jj,treemap:$j,sunburst:h$,rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{fill:"#ffffff",fontSize:Rj},minLabel:{position:d$.end},maxLabel:{position:d$.start}}},circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",stroke:"#ffffff"}},label:{visible:!0,style:{cursor:"pointer",fill:"#000000"}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{lineWidth:0,fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{fill:"white",textAlign:"center",textBaseline:"middle",fontSize:12}}},boxPlot:{boxPlot:{style:{lineWidth:1}}}},component:{discreteLegend:{orient:"bottom",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:Rj,fill:{type:"palette",key:"titleFontColor"},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:10,padding:2,background:{state:{selectedHover:{fill:"gray",fillOpacity:.7},unSelectedHover:{fill:"gray",fillOpacity:.2}}},shape:{space:4,state:{unSelected:{fillOpacity:.5}}},label:{space:4,style:{fill:{type:"palette",key:"labelFontColor"},fontSize:Rj},state:{unSelected:{fillOpacity:.5}}}},allowAllCanceled:!1},colorLegend:{horizontal:{...g$,rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}}},vertical:{...g$,rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}}}},sizeLegend:{horizontal:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},...g$},vertical:{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},...g$}},axis:u$,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:10},title:{space:10},maxHeight:"30%"},axisY:{label:{space:20},title:{space:20,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:10}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:14,fontWeight:"normal",fontStyle:"normal",fill:"#fff",stroke:"#fff",lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:"#fff",border:{color:"#ffffff",width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:"rgba(0, 0, 0, 0.1)"}},spaceRow:6,titleLabel:{fontSize:14,fontColor:"#4E5969",fontWeight:"bold",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:Rj,fontColor:"#4E5969",textAlign:"left",lineHeight:18,textBaseline:"middle",spacing:26},valueLabel:{fontSize:Rj,fontColor:"#4E5969",lineHeight:18,textBaseline:"middle",spacing:0}},dataZoom:{showDetail:"auto",middleHandler:{visible:!0,background:{size:6,style:{stroke:"#D1D5DA",cornerRadius:2}},icon:{style:{size:4,fill:"white",stroke:"#D1D5DA",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:"#F6F8FA",stroke:"#F6F8FA",lineWidth:1}},startHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},endHandler:{style:{symbolType:"M-651.40493822 1451.33576377m0-418.93088554l0-2094.65442779q0-418.93088556 418.93088555-418.93088733l418.93088556 0q418.93088556 0 418.93088553 418.93088733l0 2094.65442779q0 418.93088556-418.93088553 418.93088554l-418.93088556 0q-418.93088556 0-418.93088555-418.93088554Z M-546.67221684 1032.40487819a314.19816417 314.19816417 0 0 0 314.19816418 314.19816421l418.93088555 1e-8a314.19816417 314.19816417 0 0 0 314.19816418-314.19816418l-1e-8-2094.65442779a314.19816417 314.19816417 0 0 0-314.19816417-314.19816596l-418.93088556 0a314.19816417 314.19816417 0 0 0-314.19816417 314.19816596l0 2094.65442775m-104.73272138 4e-8l0-2094.65442779a418.93088556 418.93088556 0 0 1 418.93088555-418.93088733l418.93088556 0a418.93088556 418.93088556 0 0 1 418.93088553 418.93088733l0 2094.65442779a418.93088556 418.93088556 0 0 1-418.93088553 418.93088554l-418.93088556 0a418.93088556 418.93088556 0 0 1-418.93088555-418.93088554z M-232.47405266 404.00854987l-1e-8-837.86177109 104.73272138 0 0 837.86177109z M81.72411149 404.00854987l0-837.86177109 104.7327214 0 0 837.8617711z",fill:"#FFF",stroke:"#AEB8C6",lineWidth:1}},startText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},endText:{padding:8,style:{fontSize:10,fill:"#6F6F6F"}},selectedBackground:{style:{fill:"#D8E4F7"}},dragMask:{style:{fill:"#D9E5F8",stroke:"#AEB8C6",lineWidth:1}},backgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}},selectedBackgroundChart:{area:{style:{stroke:!1,fill:"#CACFD7"}},line:{style:{stroke:"#CACFD7",lineWidth:1}}}},crosshair:p$,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:"#3073F2"},railStyle:{fill:"#D1D5DA"},handlerStyle:{size:15,stroke:"#FFFFFF",lineWidth:2,fill:"#0564FE"}},controller:{start:{order:0,space:0,style:{size:25,fill:"#3073F2"}},pause:{order:0,space:0,style:{size:25,fill:"#3073F2"}},backward:{order:0,space:10,position:"start",style:{size:12,fill:"#3073F2"}},forward:{order:0,space:10,position:"end",style:{size:12,fill:"#3073F2"}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:{title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:20,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:16,fill:"black",fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},title:{padding:{bottom:30},textStyle:{fontSize:Bj,fontColor:{type:"palette",key:"titleFontColor"}},subtextStyle:{fontSize:Rj,lineHeight:Bj,fontColor:{type:"palette",key:"labelFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:Rj,fontFamily:Pj}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:12,fontWeight:"bold",fill:"#4E5969"},contentStyle:{fontSize:12,fill:"#4E5969"},panel:{visible:!0,fill:"#fff",stroke:"#ffffff",lineWidth:0,cornerRadius:3,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:"rgba(0, 0, 0, 0.1)",size:0,space:12}}}},m$=new Map([[f$.name,f$]]),y$=f$.name;class _${static instances=new Map;static registerInstance(t){_$.instances.set(t.id,t)}static unregisterInstance(t){_$.instances.delete(t.id)}static getInstance(t){return _$.instances.get(t)}static instanceExist(t){return _$.instances.has(t)}static forEach(t,e=[],i){const n=N(e);return _$.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}class v${static themes=new Map;static _currentThemeName=y$;static registerTheme(t,e){t&&v$.themes.set(t,L({},v$.getDefaultTheme(),e))}static getTheme(t){return v$.themes.get(t)||v$.getDefaultTheme()}static removeTheme(t){return v$.themes.delete(t)}static themeExist(t){return v$.themes.has(t)}static getDefaultTheme(){return v$.themes.get(y$)}static setCurrentTheme(t){v$.themeExist(t)&&(v$._currentThemeName=t,_$.forEach((e=>e?.setCurrentTheme(t))))}static getCurrentTheme(){return v$.getTheme(v$._currentThemeName)}static getCurrentThemeName(){return v$._currentThemeName}}v$.registerTheme(y$,m$.get(y$)),m$.forEach(((t,e)=>{e!==y$&&v$.registerTheme(e,t)}));const b$=(t,e,i)=>new He({defaultFontParams:{fontFamily:Ej,fontSize:14},getTextBounds:i?void 0:_B,specialCharSet:"-/: .,@%'\"~"+He.ALPHABET_CHAR_SET+He.ALPHABET_CHAR_SET.toUpperCase(),...e??{}},t),x$=fB({});function S$(t,e){for(let i=0;it.key===e))}function A$(t,e){if(!t)return e??null;const i=t.getFields();return i&&i[e]?i[e].alias??e:e??null}const k$=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sP$(t.style(e,i,n,s)):M(t.style)||(e.style=P$(t.style)),!M(t.state)){const i={};Object.keys(t.state).forEach((e=>{l(t.state[e])?i[e]=(i,n,s,r)=>P$(t.state[e](i,n,s,r)):M(t.state[e])||(i[e]=P$(t.state[e]))})),e.state=i}return e}function T$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e,n,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function E$(t){if(M(t))return null;const e={};return Object.keys(t).forEach((i=>{l(t[i])?e[i]=(e,n,s,r)=>P$(t[i](e.rawValue,n,e,s,r)):M(t[i])||(e[i]=P$(t[i]))})),e}function P$(t){return M(t)||t.angle&&(t.angle=Gt(t.angle)),t}var R$;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.rect3d="rect3d",t.image="image",t.path="path",t.area="area",t.arc="arc",t.arc3d="arc3d",t.polygon="polygon",t.pyramid3d="pyramid3d",t.boxPlot="boxPlot",t.linkPath="linkPath",t.progressArc="progressArc",t.cell="cell",t.component="component"}(R$||(R$={}));class B${static _charts={};static _series={};static _components={};static _marks={};static _regions={};static transforms={simplify:Qa,fields:io,filter:pn,fold:eo};static dataParser={csv:fo,dsv:go,tsv:mo};static _layout={};static registerChart(t,e){B$._charts[t]=e}static registerSeries(t,e){B$._series[t]=e}static registerComponent(t,e){B$._components[t]=e}static registerMark(t,e){B$._marks[t]=e}static registerRegion(t,e){B$._regions[t]=e}static registerTransform(t,e){B$.transforms[t]=e}static registerLayout(t,e){B$._layout[t]=e}static createChart(t,e,i){if(!B$._charts[t])return null;return new(0,B$._charts[t])(e,i)}static createRegion(t,e,i){if(!B$._regions[t])return null;return new(0,B$._regions[t])(e,i)}static createSeries(t,e,i){if(!B$._series[t])return null;return new(0,B$._series[t])(e,i)}static createMark(t,e,i){if(!B$._marks[t])return null;const n=new(0,B$._marks[t])(e,i);return n.type===R$.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(B$._components)}static getComponentInKey(t){return B$._components[t]}static getLayout(t){return B$._layout[t]}static getSeries(t){return B$._series[t]}}const I$=(t,e,i)=>{const n=t.getRegionsInIds(N(e.layoutBindRegionID));return 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})}))},D$=(t,e)=>t===e||!h(t)&&!h(e)&&(t.value===e.value&&t.axis?.id===e.axis?.id),L$=(t,e,i,n)=>{const s=[],r=e.getRegions();for(const e of r){const r=e.getSeries();for(const e of r)if(e.coordinate===i){const i=n(e),r=e.getViewData()?.latestData;i&&r&&s.push({series:e,datum:r.filter((e=>e[i]?.toString()===t?.toString()))})}}return s},O$="monotone",F$="linearClosed";var z$;!function(t){t.circle="circle",t.triangle="triangle",t.triangleUp="triangleUp",t.triangleLeft="triangleLeft",t.triangleRight="triangleRight",t.triangleDown="triangleDown",t.thinTriangle="thinTriangle",t.rect="rect",t.diamond="diamond",t.square="square",t.arrowLeft="arrowLeft",t.arrow2Left="arrow2Left",t.arrowRight="arrowRight",t.arrow2Right="arrow2Right",t.cross="cross",t.wedge="wedge",t.star="star",t.wye="wye"}(z$||(z$={}));var H$;function j$(t){return"bottom"===t||"top"===t}function N$(t){return"left"===t||"right"===t}function V$(t){return"z"===t}function W$(t,e){return Uh(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}!function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom",t.inside="inside"}(H$||(H$={}));const G$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.orient||"top"===n.orient:"left"===n.orient||"right"===n.orient)&&I$(t,n,i)));return n.length?n:null},U$=t=>t.fieldX[0],Y$=t=>t.fieldY[0],X$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;t{const e=$$(t,n,"x",U$);e&&o.push(e)})),a&&a.forEach((t=>{const e=$$(t,s,"y",Y$);e&&o.push(e)})),o.length?o:null},$$=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return K$(t,a,n)},K$=(t,e,i)=>{const n=t.getScale();if(!n||!jl(n.type))return null;if(h(e))return null;let s=n.domain().findIndex((t=>t?.toString()===e.toString()));s<0&&(s=void 0);const r=L$(e,t,"cartesian",i??(j$(t.orient)?U$:Y$));return{index:s,value:e,axis:t,data:r}},q$=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.orient===e&&I$(t,n,i)));return n.length?n:null},Z$=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{const e=t.getScale(),i=e?.domain(),r=e?.range();if(e&&jl(e.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=Il({x:1,y:0},d);u=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(u,r);const p=Dl(d),g=a[0]?.getScale(),f=g?.range();if((u-r?.[0])*(u-r?.[1])>0||(p-f?.[0])*(p-f?.[1])>0)return;const m=Math.abs(r[0]-r[1])/i.length/2,y=e.invert(u+m);if(h(y))return;let _=e.domain().findIndex((t=>t?.toString()===y.toString()));_<0&&(_=void 0);const v=L$(y,t,"polar",l);o.push({index:_,value:y,axis:t,data:v})}})),a&&a.forEach((t=>{const e=t.getScale(),i=e?.range();if(e&&jl(e.type)){const a=t.getCenter(),c={x:n-t.getLayoutStartPoint().x-a.x,y:s-t.getLayoutStartPoint().y-a.y};let d=Il({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const u=Dl(c),p=r[0]?.getScale(),g=p?.range();if((d-g?.[0])*(d-g?.[1])>0||(u-i?.[0])*(u-i?.[1])>0)return;const f=e.invert(u);if(h(f))return;let m=e.domain().findIndex((t=>t?.toString()===f.toString()));m<0&&(m=void 0);const y=L$(f,t,"polar",l);o.push({index:m,value:f,axis:t,data:y})}})),o.length?o:null};class J${_eventDispatcher;_mode;_callback;_chart;constructor(t,e){this._eventDispatcher=t,this._mode=e,this._chart=this._eventDispatcher.globalInstance.getChart?.()}register(t,e){throw new Error("Method not implemented.")}unregister(){throw new Error("Method not implemented.")}getTargetDimensionInfo(t,e){const i=X$(this._chart,{x:t,y:e})??[],n=Z$(this._chart,{x:t,y:e})??[],s=[].concat(i,n);return 0===s.length?null:s}dispatch(t,e){const i=this._chart?.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!jl(t.getScale().type)&&(!e?.filter||e.filter(t))})),n=[];return i.forEach((e=>{const i=K$(e,t);i&&n.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:n}),n}}var Q$;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Q$||(Q$={}));const tK={[Q$.dimensionHover]:class extends J${_cacheDimensionInfo=null;constructor(t,e){super(t,e),this.onMouseMove=this.onMouseMove.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:{...e.query,source:WX.chart},callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.register("pointerdown",{query:{...e.query,source:WX.chart},callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Jo(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}onMouseMove(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,{...t,action:"leave",dimensionInfo:[...this._cacheDimensionInfo]}),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!D$(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,{...t,action:"move",dimensionInfo:[...n]}):(this._callback.call(null,{...t,action:"enter",dimensionInfo:[...n]}),this._cacheDimensionInfo=n)}},[Q$.dimensionClick]:class extends J${constructor(t,e){super(t,e),this.onClick=this.onClick.bind(this)}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:{...e.query,source:WX.chart},callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}onClick(t){if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,{...t,action:"click",dimensionInfo:[...n]})}}};let eK=class{_eventDispatcher;_mode;_composedEventMap=new Map;getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(tK[t]){const e=new tK[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){const n=i??e;if(tK[t])if(n)this._composedEventMap.get(n)?.event.unregister(),this._composedEventMap.delete(n);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(this._composedEventMap.get(e[0])?.event.unregister(),this._composedEventMap.delete(e[0]));else if(n){const i={callback:n,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class iK{_map=new Map;_levelNodes=new Map;constructor(){this._levelNodes.set(GX.vchart,[]),this._levelNodes.set(GX.chart,[]),this._levelNodes.set(GX.model,[]),this._levelNodes.set(GX.mark,[])}addHandler(t,e){const i={level:e,handler:t};return this._levelNodes.get(e)?.push(i),this._map.set(t.callback,i),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=i?.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&i?.splice(n,1),this}getHandlers(t){return this._levelNodes.get(t)?.map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const nK={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 sK{globalInstance;_viewBubbles=new Map;_windowBubbles=new Map;_viewListeners=new Map;_windowListeners=new Map;_compiler;constructor(t,e){this.globalInstance=t,this._compiler=e}register(t,e){this._parseQuery(e);const i=this.getEventBubble(e.filter?.source||WX.chart),n=this.getEventListeners(e.filter?.source||WX.chart);i.get(t)||i.set(t,new iK);if(i.get(t).addHandler(e,e.filter?.level),this._isValidEvent(t)&&!n.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(e.filter?.source,t,i),n.set(t,i)}return this}unregister(t,e){let i=!1;const n=this.getEventBubble(e?.filter?.source||WX.chart),s=this.getEventListeners(e?.filter?.source||WX.chart);if(e){const s=n.get(t);s?.removeHandler(e),0===s?.getCount()&&(s?.release(),n.delete(t),i=!0),e?.wrappedCallback?.cancel&&e.wrappedCallback.cancel()}else{const e=n.get(t);e?.release(),n.delete(t),i=!0}if(i&&this._isValidEvent(t)){const i=s.get(t);this._compiler.removeEventListener(e?.filter?.source||WX.chart,t,i),s.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||WX.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(GX.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(GX.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(GX.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(WX.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(WX.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){if(l(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&C(i,"node.name")!==t.nodeName)return!1;if(t.markName&&i?.mark?.name!==t.markName)return!1;let n=i.model?.type;return nK[n]&&(n=nK[n]),(!t.type||n===t.type)&&(!c(t.userId)||i.model?.userId===t.userId)}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=i?.getDatum();return{...e,item:i,datum:n}}return{...e}}_onDelegate(t){const e=this.globalInstance.getChart(),i=c(t.modelId)&&e?.getModelById(t.modelId)||void 0,n=c(t.markId)&&e?.getMarkById(t.markId)||null,s=new Map;let r=t.item?.mark;for(r&&c(r.id())&&s.set(r.id(),t.item);r?.elements;){const t=r.id();c(t)&&!s.has(t)&&s.set(t,r.elements[0]),r=r.group}const a={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:s,chart:e,model:i,mark:n??void 0,node:C(t.event,"target")};this.dispatch(t.type,a)}_invoke(t,e,i){const n=t.map((t=>{const n=t.filter;if(!t.query||this._filter(n,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(n,i));return t.query?.consume&&(e=!0,i.event?.stopPropagation(),i.event?.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:c(t.id)?GX.model:GX.vchart:GX.vchart}_parseQuery(t){const e=t.query;e?.throttle?t.wrappedCallback=ft(t.callback,e.throttle):e?.debounce&&(t.wrappedCallback=gt(t.callback,e.debounce));let i=this._getQueryLevel(e),n=null,s=WX.chart,r=null,a=null,o=null;return e?.nodeName&&(r=e.nodeName),e?.markName&&(a=e.markName),!e?.type||i!==GX.model&&i!==GX.mark||(n=e.type),e?.source&&(s=e.source),c(e?.id)&&(o=e?.id,i=GX.model),t.filter={level:i,markName:a,type:n,source:s,nodeName:r,userId:o,filter:e?.filter??null},t}getEventBubble(t){switch(t){case WX.chart:return this._viewBubbles;case WX.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case WX.chart:return this._viewListeners;case WX.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return NX.includes(t)||Object.values(hV).includes(t)||Object.values(VX).includes(t)}}function rK(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function aK(t,e,i){t.getParser(e)||t.registerParser(e,i)}const oK=new Map;let lK;function hK(t,e,i={type:"geojson",centroid:!0}){oK.has(t)&&Yo(`map type of '${t}' already exists, will be overwritten.`),lK||(lK=new jo,aK(lK,"geojson",Do),aK(lK,"topojson",Oo),rK(lK,"simplify",Qa));const n=new Vo(lK),s=L({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),oK.set(t,n)}function cK(t,e=!1){let i=e;return t.latestData instanceof Vo&&(i=!1),i?R(t.latestData):t.latestData.slice()}const dK=(t,e)=>0===t.length?[]:1===t.length?cK(t[0],e?.deep):t.map((t=>cK(t,e?.deep)));function uK(t,e,i){rK(e=e instanceof jo?e:t.dataSet,"copyDataView",dK);const n=new Vo(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function pK(t,e,i=[]){if(t instanceof Vo)return t;const{id:n,values:s=[],fromDataIndex:r,fromDataId:a,transforms:o=[],fields:l,parser:h}=t;let c;const d=i.find((t=>t.name===n));if(d)c=d;else{const t={name:n};if(l&&(t.fields=l),c=new Vo(e,t),"string"==typeof a){const t=i.find((t=>t.name===a));if(!t)throw new Error(`no data matches fromDataId ${a}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else if("number"==typeof r){const t=i[r];if(!t)throw new Error(`no data matches fromDataIndex ${r}`);c.parse([t],{type:"dataview"}),c.transform({type:"copyDataView"})}else Array.isArray(s)?c.parse(s):!f(s)||h&&"csv"!==h.type&&"dsv"!==h.type&&"tsv"!==h.type?(c.parse([]),Xo("values should be array")):c.parse(s,h??{type:"csv"});o&&o.length&&o.forEach((t=>{e.getTransform(t.type)&&c.transform(t)}))}return c}const gK=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!n?.length)return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e{this._compileChart?.onLayout(this._view)},logLevel:We.getInstance().level()}),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{this._view?.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!f(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}async renderAsync(t){return this.initView(),this._view?(await(this._view?.runNextTick(t)),this):Promise.reject("srView init fail")}renderSync(t){this.initView(),this._view&&this._view?.runSync(t)}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}reRenderAsync(t){return this.isInited&&(this._rafId&&gj.getCancelAnimationFrame()(this._rafId),this._rafId=gj.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const n=function(n,s){const r=s?.mark?.context??{},a=c(r.modelId)?r.modelId:null,o=c(r.markId)?r.markId:null,l=c(r.modelUserId)?r.modelUserId:null,h=c(r.markUserId)?r.markUserId:null,d={event:n,type:e,source:t,item:s,datum:s?.getDatum?.()||null,markId:o,modelId:a,markUserId:h,modelUserId:l};i.call(null,d)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),this._view?.addEventListener(e,n)}else if(t===WX.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();s?.addEventListener(e,n)}}removeEventListener(t,e,i){if(!1!==this._option.interactive)if(t===WX.chart){const t=this._viewListeners.get(i)?.callback;t&&this._view?.removeEventListener(e,t),this._viewListeners.delete(i)}else if(t===WX.window){const t=this._getGlobalThis(),n=this._windowListeners.get(i)?.callback;n&&t?.removeEventListener(e,n),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){this.releaseEvent(),this._option=this._container=null,this._releaseModel(),this._view?.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){this._releaseModel(),this._view?.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(h(e))return;const i=e.id(),n=t.grammarType;h(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){const i=t.getProduct();if(h(i))return;const n=i.id(),s=t.grammarType,r=this._model[s][n];c(r)&&(delete r[t.id],0===Object.keys(r).length&&delete this._model[s][n]),e||this._view?.removeGrammar(i)}updateDepend(t){return c(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){return Zo(this._option.mode)?globalThis:this.getStage()?.window}}async function SK(t){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){console.error("getCanvasDataURL",t)}return t.toDataURL()}class wK{id=el();static useChart(t){t.forEach((t=>B$.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>B$.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>B$.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>B$.registerMark(t.constructorType??t.type,t)))}static useLayout(t){t.forEach((t=>B$.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){B$.registerTransform(t,e)}static registerMap(t,e,i){hK(t,e,i)}static unregisterMap(t){!function(t){oK.has(t)?oK.delete(t):Yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,oK.get(e);var e}static hideTooltip(t=[]){_$.forEach((t=>t?.hideTooltip?.()),t)}static getLogger(){return We.getInstance()}static InstanceManager=_$;static ThemeManager=v$;static globalConfig={uniqueTooltip:!0};_spec;_viewBox;_chart;_compiler;_event;_eventDispatcher;_dataSet;getDataSet(){return this._dataSet}_container;_canvas;_stage;_autoSize=!0;_option={mode:t.RenderModeEnum["desktop-browser"],animation:!0};_curSize={width:0,height:0};_observer=null;_currentThemeName;_currentTheme;_context={};constructor(t,e){this._option=L(this._option,e);const{dom:i,renderCanvas:n,mode:s,stage:r,poptip:a,...o}=this._option;i&&(this._container=f(i)?document?.getElementById(i):i),n&&(this._canvas=n),r&&(this._stage=r),"node"===s||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=v$.getCurrentThemeName(),this._setSpec(t),this._updateCurrentTheme(),this._compiler=new xK({dom:this._container??"none",canvas:n},{mode:this._option.mode,stage:r,pluginList:!1!==a?["poptipForText"]:[],...o,background:t.background||this._currentTheme.background||this._option.background}),this._eventDispatcher=new sK(this,this._compiler),this._event=new eK(this._eventDispatcher,s),this._compiler.initView(),this.getStage()?.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!Zo(s)&&(t.autoFit??this._option.autoFit??!0),this._curSize={width:t.width||0,height:t.height||0},this._bindResizeEvent(),this._event.emit(VX.initialized,{}),_$.registerInstance(this)):Xo("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=Jh(f(t)?JSON.parse(t):t))}_initData(){if(h(this._dataSet))return void Yo("dataSet is not initialized");const t=N(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout});i?(this._chart=i,this._chart.created(),this._chart.init({})):Xo("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindResizeEvent(){if(this._autoSize){if(this._container){const t=window.ResizeObserver;this._observer=new t(this._onResize),this._observer?.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_onResize=gt(((...t)=>{const{width:e,height:i}=en(this._container,qj,Zj),n=this._spec.width??e,s=this._spec.height??i;this._curSize.width===n&&this._curSize.height===s||(this.resize(n,s),this._curSize={width:n,height:s})}),100);_initDataSet(t){this._dataSet=t instanceof jo?t:new jo,aK(this._dataSet,"dataview",Fo),aK(this._dataSet,"array",cn),rK(this._dataSet,"stackSplit",gK),rK(this._dataSet,"copyDataView",dK);for(const t in B$.transforms)rK(this._dataSet,t,B$.transforms[t]);for(const t in B$.dataParser)aK(this._dataSet,t,B$.dataParser[t])}async updateCustomConfigAndRerender(t,e){const i=t();return c(i)?(i.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,this._compiler?.releaseGrammar()):i.reCompile&&(this.getComponents().forEach((t=>t.clear())),this._compiler?.compile({chart:this._chart,vChart:this},{})),await this.renderAsync(e),this):this}renderSync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return this._compiler?.renderSync(t),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}async renderAsync(t){if(!this._chart){if(this._option.performanceHook?.beforeInitializeChart?.(),this._initChart(this._spec),this._option.performanceHook?.afterInitializeChart?.(),!this._chart||!this._compiler)return this;this._option.performanceHook?.beforeCompileToVGrammar?.(),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),this._option.performanceHook?.afterCompileToVGrammar?.()}return await(this._compiler?.renderAsync(t)),this._option.animation&&(this._chart?.getAllRegions().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)})),this._chart?.getAllComponents().forEach((t=>{t.animate?.updateAnimateState(fK.update,!0)}))),this._event.emit(VX.rendered,{}),this}release(){this._onResize?.cancel&&this._onResize.cancel(),this._chart?.release(),this._compiler?.release(),this._eventDispatcher?.release(),this._unBindResizeEvent(),oK.clear(),lK=null,this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._event=null,this._eventDispatcher=null,_$.unregisterInstance(this)}async updateData(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),await this._compiler.renderAsync(),this;this._spec.data=N(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):m(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}async updateDataInBatches(t){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),await this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}updateDataSync(t,e,i){if(h(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new Vo(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}async updateSpec(t,e=!1,i){return t?(f(t)&&(t=JSON.parse(t)),e&&(t=L({},this._spec,t)),await this.updateCustomConfigAndRerender((()=>(t=Jh(t),this._spec=t,this._updateCurrentTheme(),this._compiler?.getVGrammarView()?.updateLayoutTag(),this._chart.updateSpec(t,i))),i),this):this}async resize(t,e){if(!this._chart||!this._compiler)return this;const i=this._chart.getCanvasRect();return i&&i.width===t&&i.height===e||(this._option.performanceHook?.beforeResizeWithUpdate?.(),this._chart.onResize(t,e),this._option.performanceHook?.afterResizeWithUpdate?.(),await(this._compiler.resize?.(t,e))),this}updateViewBox(t,e=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t),this._compiler.renderSync(),this._chart?.onEvaluateEnd(),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){this._event?.on(t,e,i)}off(t,e){this._event?.off(t,e)}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)}_updateCurrentTheme(){var t;f(this._spec?.theme)?(this._currentTheme=L({},v$.getTheme(this._spec.theme)),this._currentThemeName=this._spec.theme):this._currentTheme=L({},v$.getTheme(this._currentThemeName),this._spec?.theme??{}),t=L({},this._currentTheme.component?.poptip),L(xG.poptip,bG,t)}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}async setCurrentTheme(t){return v$.themeExist(t)?(await this.updateCustomConfigAndRerender((()=>(this._currentThemeName=t,this._updateCurrentTheme(),this._chart?.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}))),this):this}_getTooltipComponent(){const t=this._chart?.getAllComponents().find((t=>t.type===un.tooltip));return t}setTooltipHandler(t){this._context.tooltipHandler=t;const e=this._getTooltipComponent();e&&(e.tooltipHandler?.release?.(),e.tooltipHandler=t)}getTooltipHandlerByUser(){return this._context?.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){const i=this._getTooltipComponent();return(c(t)&&"none"!==i?.showTooltip(t,e))??!1}hideTooltip(){const t=this._getTooltipComponent();return t?.hideTooltip()??!1}getLegendDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getLegendData():[]}getLegendDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getLegendData():[]}getLegendSelectedDataById(t){const e=this._chart?.getComponentByUserId(t);return e?e.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){const e=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));return e[t]?e[t].getSelectedData():[]}setLegendSelectedDataById(t,e){const i=this._chart?.getComponentByUserId(t);i&&i.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){const i=this._chart?.getAllComponents().filter((t=>t.type===un.discreteLegend));i[t]&&i[t].setSelectedData(e)}async getDataURL(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return await SK(e)}return console.error(new ReferenceError("render is not defined")),null}async exportImg(t){if(!Zo(this._option.mode))return void console.error(new TypeError("non-browser environment can not export img"));const e=await 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):console.error(new ReferenceError("render is not defined"))}getImageBuffer(){if("node"!==this._option.mode)return void console.error(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return console.error(new ReferenceError("render is not defined")),null}setLayout(t){this._option.layout=t,this._chart?.setLayout(t)}reLayout(){this._chart?.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){return this._compiler?.getCanvas()}getContainer(){if(c(this._container))return this._container;let t;return t=f(this._canvas)?document?.getElementById(this._canvas):this._canvas,c(t)?t.parentElement:this.getCanvas()?.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){return this._chart?.setDimensionIndex(t,e)}convertDatumToPosition(t,e={},i=!1){if(!this._chart)return null;if(M(t))return null;const{seriesId:n,seriesIndex:s=0}=e;let r;if(c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r){const e=Object.keys(t),n=r.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=r.getLayoutStartPoint();let a;return a=n?r.dataToPosition(n):r.dataToPosition(t),Zh(a,s,i)}return null}convertValueToPosition(t,e,i=!1){if(!this._chart||h(t)||M(e))return null;if(!m(t)){const{axisId:n,axisIndex:s}=e;let r;if(c(n)?r=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):c(s)&&(r=this._chart.getComponentsByKey("axes")?.[s]),!r)return Yo("Please check whether the `axisId` or `axisIndex` is set!"),null;const a=r?.valueToPosition(t);if(i){const t=r.getLayoutStartPoint(),e=r.orient;return a+("bottom"===e||"top"===e?t.x:t.y)}return a}const{seriesId:n,seriesIndex:s}=e;let r;return c(n)?r=this._chart.getSeriesInUserId(n):c(s)&&(r=this._chart.getSeriesInIndex([s])?.[0]),r?Zh(r.valueToPosition(t[0],t[1]),r.getLayoutStartPoint(),i):(Yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}!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"}(yK||(yK={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(_K||(_K={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(vK||(vK={}));class AK{_children=[];_markNameMap={};getMarkNameMap(){return this._markNameMap}_infoMap=new Map;static defaultMarkInfo={};addMark(t,e){h(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,L({},AK.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]}getMarksInType(t){const e=N(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]))))}}class kK{event;interaction;_option;_marks=new AK;_markReverse=new AK;_lastDimensionEvent=null;_hover;get hover(){return this._hover}_select;get select(){return this._select}constructor(t){this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){M(t.stateStyle[yK.STATE_DIMENSION_HOVER])||this._marks.addMark(t),M(t.stateStyle[yK.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(Q$.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=m(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;e{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(yK.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(yK.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(yK.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(yK.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t}}class MK{_option;getOption(){return this._option}getCompiler;constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){return this.getCompiler()?.getVGrammarView()}release(){this._option=null}}class CK extends MK{_spec;getSpec(){return this._spec}layoutClip=!1;_autoIndent=!0;getAutoIndent(){return this._autoIndent}_layoutStartPoint={x:0,y:0};getLayoutStartPoint(){return this._layoutStartPoint}_layoutRect={width:0,height:0};_minWidth=null;_maxWidth=null;_minHeight=null;_maxHeight=null;_layoutRectLevelMap={width:0,height:0};_lastComputeRect=null;_lastComputeOutBounds={x1:0,x2:0,y1:0,y2:0};getLastComputeOutBounds(){return this._lastComputeOutBounds}_forceLayoutTag=!1;getLayoutRect=()=>this._layoutRect;layoutType="normal";layoutBindRegionID;_layoutOrient="left";get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}layoutPaddingLeft=0;layoutPaddingTop=0;layoutPaddingRight=0;layoutPaddingBottom=0;layoutOffsetX=0;layoutOffsetY=0;_attributeTag=!0;getAttributeTag(){return this._attributeTag}setAttributeTag(t){return this._attributeTag=t,this._attributeTag}layoutLevel=a$.Region;layoutZIndex=0;chartLayoutRect;_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Kh(qh(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=h(t.minHeight)?null:$h(t.minHeight,e.height,e),this._maxHeight=h(t.maxHeight)?null:$h(t.maxHeight,e.height,e),this._minWidth=h(t.minWidth)?null:$h(t.minWidth,e.width,e),this._maxWidth=h(t.maxWidth)?null:$h(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:$h(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:$h(t.height,e.height,e)},{height:9}),h(t.offsetX)||(this.layoutOffsetX=$h(t.offsetX,e.width,e)),h(t.offsetY)||(this.layoutOffsetY=$h(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){this.layoutType=t.layoutType??this.layoutType,this.layoutLevel=t.layoutLevel??this.layoutLevel,this.layoutOrient=t.orient??this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=t.clip??this.layoutClip,this.layoutZIndex=t.zIndex??this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{h(this._spec[i])||(e[i]=$h(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};h(n)||(r.width-=n),h(s)||(r.width-=s),h(e)||(r.height-=e),h(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):(h(n)?h(s)||(l.x=t.x+t.width-this.layoutPaddingRight-s-a):l.x=t.x+n+this.layoutPaddingLeft,h(e)?h(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition({x:t,y:e}){b(t)&&(this._layoutStartPoint.x=t),b(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){b(t)&&(i?.width??0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=i?.width??0),b(e)&&(i?.height??0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=i?.height??0),this._setRectInSpec(this._layoutRect)}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={...t};return this._layoutRectLevelMap.width<9?(h(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),h(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(h(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),h(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e={...this.boundsInRect(this._setRectInSpec(t),t)};return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class TK extends MK{grammarType;id=el();_product;getProduct(){if(c(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return c(e)&&c(t)&&(this._product=this._lookupGrammar(e)),this._product}_compiledProductId=null;getProductId(){return this._compiledProductId??this.generateProductId()}_depend=[];getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){c(this._product)&&this.getCompiler()?.addGrammarItem(this)}updateDepend(){if(c(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(c);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class EK extends TK{grammarType=mK.signal;name;_value;getValue(){return this._value}_updateFunc;getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}c(this._value)&&this._product.value(this._value),c(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getSignalById(t)}}class PK extends MK{_signalMap={};getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new EK(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class RK extends PK{_stateMap;getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}stateKeyToSignalName;constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=t??this._getDefaultStateMap()}compile(t){const e=t??this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(L(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class BK extends RK{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class IK extends CK{type="null";modelType="null";id;userId=void 0;event;effect;_data=null;getData(){return this._data}getSpec(){return this._spec}_specIndex=0;getSpecIndex(){return this._specIndex}specKey="";_originalSpec;getOption(){return this._option}_sceneNodeMap;_marks=new AK;getMarks(){return this._marks?.getMarks()??[]}getMarkNameMap(){return this._marks?.getMarkNameMap()}getMarkSet(){return this._marks}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}state;getState(){return this.state._stateMap}_theme;_lastLayoutRect=null;_tooltipHelper;get tooltipHelper(){return this._tooltipHelper}_isLayout=!0;constructor(t,e){super(e),this.id=el(),this._originalSpec=t,this._spec=Qh(t),this.userId=t.id,this._specIndex=e.specIndex??0,this.specKey=e.specKey??"",this.effect={},this.event=new eK(e.eventDispatcher,e.mode),e.map?.set(this.id,this),this._sceneNodeMap=new Map,this.state=new BK({...e,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)})}coordinate;_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){this._isLayout||(this._forceLayoutTag=!0,this._option.globalInstance.getChart()?.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){this._releaseEvent(),this._originalSpec={},this._spec={},this.getMarks().forEach((t=>t.release())),this.state.release(),this._data?.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Qh(t);return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){const t=this._option.getTheme?.();if(h(t)||h(this._theme))return;const{mark:e,markByName:i}=t;this.getMarkInfoList().forEach((({type:t,name:n})=>{this._theme[n]=L({},e?.[N(t)[0]]??{},i?.[n]??{},this._theme[n])}))}_preprocessSpec(t){if(arguments.length||(t=this._spec),m(t))return t.map((t=>d(t)&&!l(t)?this._preprocessSpec(t):t));const e={...t};return Object.keys(e).forEach((i=>{if(i.includes("data"))return;const n=t[i];d(n)&&!l(n)&&(Fh(n)?e[i]=Oh(n,this._option.getTheme?.()?.colorScheme,"series"===this.modelType?this.type:void 0):e[i]=this._preprocessSpec(n))})),arguments.length||(this._spec=e),e}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return{...t}}setMarkStyle(t,e,i,n){c(t)&&c(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!c(t)||!c(e))return;const{style:n,state:s}=e,r={...e};n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${Kj}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){this._data?.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}compileSignal(){this.state?.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=B$.createMark(i,n,{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale,...e});return s?.created(),s}_getDataIdKey(){}}const DK={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},LK={symbol:function(t,e){return"shape"===t?DK[e]??e:e}};const OK={};Object.values(yK).forEach((t=>{OK[t]=!0}));const FK={[yK.STATE_HOVER]:yK.STATE_HOVER_REVERSE,[yK.STATE_SELECTED]:yK.STATE_SELECTED_REVERSE,[yK.STATE_DIMENSION_HOVER]:yK.STATE_DIMENSION_HOVER_REVERSE};function zK(t){return FK[t]}class HK{_stateMarks=new Map;_stateElements=new Map;static markStateEnable(t,e){return!M(t.stateStyle[e])}registerMark(t,e){this._stateMarks.has(t)||this._stateMarks.set(t,[]),this._stateMarks.get(t)?.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){return!(!t.mark||!this._stateMarks.get(e)?.includes(t.mark))}getEventElement(t){return this._stateElements.get(t)??[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){const i=zK(t);this._stateElements.get(t)?.forEach((e=>{e.removeState(t),i&&this.addEventElement(i,e)})),e.getStates().includes(t)||(e.addState(t),i&&e.removeState(i)),this._stateElements.set(t,[e])}removeEventElement(t,e){e.removeState(t);const i=this._stateElements.get(t)?.filter((t=>t!==e))??[];this._stateElements.set(t,i);const n=zK(t);n&&(0===i.length?this.clearEventElement(n,!1):this.addEventElement(n,e))}addEventElement(t,e){e.getStates().includes(t)||e.addState(t);const i=this._stateElements.get(t)??[];i.push(e),this._stateElements.set(t,i)}clearEventElement(t,e){if(this._stateElements.get(t)?.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=zK(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=zK(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class jK extends RK{id=el();stateKeyToSignalName=t=>`${Kj}_animate_${this.id}_${t}`;getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===fK.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===fK.appear?this.updateState({animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>e.diffState===fK.enter?fK.appear:fK.none}}}}class NK extends IK{static type="region";modelType="region";type=NK.type;_series=[];layoutType="region";layoutZIndex=r$.Region;animate;interaction=new HK;_groupMark;getGroupMark(){return this._groupMark}_backgroundMark;_foregroundMark;_trigger;constructor(t,e){super(t,e),this.userId=t.id,this.coordinate=t.coordinate??"cartesian",this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler})),c(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){const t=this._option.getChart().getSpec(),e=t.dataZoom?.some?.((t=>"axis"===t.filterMode)),i=t.scrollBar?.some?.((t=>"axis"===t.filterMode));return!(!e&&!i)||this.layoutClip}created(){super.created(),this._groupMark=this._createMark({type:R$.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const t=this._spec.clip??this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:t},"normal",qX.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:this._spec.style?.cornerRadius},"normal",qX.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:R$.rect,name:"regionBackground"}),t&&(this._foregroundMark=this._createMark({type:R$.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",qX.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(r$.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,{fillOpacity:this._spec.style?.fill?1:0,...this._spec.style},"normal",qX.User_Mark),(this._spec.clip??this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",qX.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,{...this._spec.style,fillOpacity:0},"normal",qX.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!t?.style||!e.style&&t?.style?(i.reMake=!0,i):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=>(!t.name||e?.name===t.name)&&(!t.userId||!e.userId||N(t.userId).includes(e.userId))&&(!c(t.specIndex)||!e.getSpecIndex||N(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||e.getRawData?.()?.name===t.dataName)))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}seriesDataFilterOver=()=>{this.event.emit(VX.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))};release(){super.release(),this._series=[]}createTrigger(){const t={...this._option,model:this,interaction:this.interaction};this._trigger=new kK(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in _K)M(t.stateStyle[_K[e]])||this.interaction.registerMark(_K[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){super.compileSignal(),this.animate?.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}class VK{_leftCurrent=0;_topCurrent=0;_rightCurrent=0;_bottomCurrent=0;_chartLayoutRect;_chartViewBox;layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){const i=t.find((t=>t.id===e));if(!i)throw Error("can not find target region item, invalid id");return i}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.filter,t.forEach((t=>{if(!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const WK=[R$.line,R$.area,"trail"];function GK(t){return WK.includes(t)}class UK extends RK{_mark;_stateInfoList=[];getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),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];c(n.domain)&&(s.domain=n.domain),c(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){n=o(GK)?n:!t.mark||GK(t.mark.markType);let s=!1,r=!1;if(c(i.datums)&&i.datums.length>0)s=this.checkDatumState(i,e,n),r=!0;else if(i.items)s=this.checkItemsState(i,t)??!1,r=!0;else if(i.fields)s=this.checkFieldsState(i,e,t,n),r=!0;else if(!s&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};s=i.filter(e,n),r=!0}return r?s?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!OK[t])).map((t=>[t,10])),n=!t.mark||GK(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(m(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(Kj)));n=t.datums.some((t=>i&&m(t?.items)?e.every((e=>t?.items?.[0]?.[e]===s?.[e])):e.every((e=>t?.[e]===s?.[e]))))}else if(d(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(Kj)));n=e.every((e=>i?t.datums.items?.[0][e]===s[e]:t.datums?.[e]===s[e]))}else n=e===t.datums;return n}checkItemsState(t,e){return t.items?.includes(e)}checkFieldsState(t,e,i,n){let s=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=n?e[0]?.[r]:e[r];if(zl(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i,n)){s=!1;break}s=!0}else{if(!l.some((t=>t===h))){s=!1;break}s=!0}}return s}checkLinearFieldState(t,e,i,n,s){const r=s?i[0]?.[e]:i[e];return rt[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class YK extends TK{grammarType=mK.data;_data=null;getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){return this._data?.latestData}constructor(t,e){super(t),this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();h(t)||(h(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){return`${this.getDataView()?.name}`}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getDataById(t)}}class XK extends YK{_mark;constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return c(t)?t:`${Kj}_markData_${this._mark.id}`}_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct(t)}}class $K extends TK{grammarType=mK.mark;type=void 0;name="mark";key;_support3d;getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}_facet;getFacet(){return this._facet}setFacet(t){this._facet=t}_interactive=!0;getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}_zIndex=r$.Mark;getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}_visible=!0;getVisible(){return this._visible}setVisible(t){this._visible=t}_userId;getUserId(){return this._userId}setUserId(t){c(t)&&(this._userId=t)}model;_data;getDataView(){return this._data?.getDataView()}setDataView(t,e){h(this._data)&&this.initMarkData({...this._option,mark:this}),c(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}stateStyle={};state;_unCompileChannel={};hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}_event;_animationConfig;getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}_skipBeforeLayouted=!1;setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}_morph=!1;getMorph(){return this._morph}setMorph(t){this._morph=t}_morphKey;getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}_morphElementKey;getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}_groupKey;getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}_label;getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}_progressiveConfig;getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.name=e,this.model=i,this.key=t.key,this.state=new UK({...t,stateKeyToSignalName:this.stateKeyToSignalName.bind(this)},this),this._option.support3d&&this.setSupport3d(!0),this._event=new eK(i.getOption().eventDispatcher,i.getOption().mode)}_transform;setTransform(t){this._transform=t}initMarkData(t){this._data=new XK(t)}stateKeyToSignalName(t){return`${Kj}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(c(e)&&this.removeProduct());if(c(e))return;this.getCompiler().isInited&&(this._initProduct(t?.group),h(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,t??e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(h(this._data))return;this._data.compile();const t=this._data.getProduct();c(this._product)&&c(t)&&this._product.join(t,this.key,void 0,this._groupKey??this._facet)}compileEncode(){const{[yK.STATE_NORMAL]:t,...e}=this.stateStyle,i={},n={};Object.keys(t).forEach((e=>{this._unCompileChannel[e]||(!function(t,e){const i=e[t]?.style,n=function(t,e){return("fill"===t||"stroke"===t)&&e?.gradient&&e?.stops}(t,i);return!!n||(!!l(i)||!!i?.scale)}(e,t)?i[e]=this.compileCommonAttributeCallback(e,"normal"):n[e]={callback:this.compileCommonAttributeCallback(e,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encode(n),this._product.encodeState("enter",i),Object.keys(e).forEach((t=>{const i={};Object.keys(e[t]).forEach((e=>{this._unCompileChannel[e]||(i[e]={callback:this.compileCommonAttributeCallback(e,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,i)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){if(this._animationConfig){let t;if("component"===this.type)t=this.model.animate?.getAnimationStateSignalName();else{const e=this.model.getRegion();t=e.animate?.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(e,i,n)=>n[t]?.callback(e,i),dependency:t}),this._animationConfig.normal&&this._event.on(hV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===fK.appear&&this.runAnimationByState(fK.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){return(i,n)=>{const s=n.mark,r={mark:s,parent:s.group,states:n.getStates(),element:n};return a=this.type,o=t,l=this.getAttribute(t,i,e,r),LK[a]?LK[a](o,l):l;var a,o,l}}compileTransform(){this._transform?.length&&this.getProduct().transform(this._transform)}_lookupGrammar(t){return this.getCompiler().getVGrammarView()?.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){return this.getProduct()?.animate?.runAnimationByState(t)}stopAnimationByState(t){return this.getProduct()?.animate?.stopAnimationByState(t)}pauseAnimationByState(t){return this.getProduct()?.animate?.pauseAnimationByState(t)}resumeAnimationByState(t){return this.getProduct()?.animate?.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class KK extends $K{_attributeContext;_extensionChannel={};_computeExChannel={};constructor(t,e){super(e,t,e.model),this._attributeContext=e.attributeContext,e.map?.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(c(t.id)&&(this._userId=t.id),o(t.interactive)&&(this._interactive=t.interactive),c(t.zIndex)&&this.setZIndex(t.zIndex),o(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(v(t))return Sl(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Sl)),t}return"function"==typeof t?(e,i,n,s)=>Sl(t(e,i,n,s)):t}isUserLevel(t){return[qX.User_Mark,qX.User_Series,qX.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];h(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){return this.stateStyle[e][t]?.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){if(t)if(e&&i){const s=n[i]??{[e]:{}};n[i][e]={...s[e],referer:t}}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){this.stateStyle[i]?.[t]&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const r=s[i][t]?.level;c(r)&&r<=n&&L(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Hl(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return f(t.scale)&&e?.globalScale?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=Nh(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){let s;s=this.stateStyle[i]?.[t]?this.stateStyle[i][t]:this.stateStyle.normal[t];let r=this._computeStateAttribute(s,t,e,i,n);return l(s?.postProcess)&&(r=s.postProcess(r,e,this._attributeContext,n,this.getDataView())),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,r):r}_computeStateAttribute(t,e,i,n,s){if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):o$.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):Hl(t.style.scale?.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",qX.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=l(i.filter)?{filter:i.filter,...s}:{...i.filter,...s}),this.state.addStateInfo(s),this.setStyle(n,t,qX.User_Mark,e)}else this.setStyle(i,t,qX.User_Mark,e)}))}_computeGradientAttr(t,e,i){const{gradient:n,scale:s,field:r,...a}=t,o=this.getDataView();let h=s,d=r;if(!(s&&r||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();s||(h=t),d||(d=e)}const u=Dh(Ih(this.model.getOption()?.getTheme()?.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),p={},g={...l$[n],...a};return Object.keys(g).forEach((t=>{const n=g[t];"stops"===t?p.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=s??h?.scale(e[d]);return l(s)&&(a=s(e,this._attributeContext,i,o)),c(n)&&(a=Uo.SetOpacity(a,n)),{offset:l(r)?r(e,this._attributeContext,i,o):r,color:a||u[0]}})):l(n)?p[t]=n(e,this._attributeContext,i,o):p[t]=n})),p.gradient=n,p}_computeThresholdAttr(t){return(new Th).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class qK extends KK{static type=R$.group;type=qK.type;_marks=[];getMarks(){return this._marks}_getDefaultStyle(){return{...super._getDefaultStyle(),clip:!1}}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(Yo("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?(Yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),t?.ignoreChildren||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}class ZK extends KK{static type=R$.component;type="component";_componentType;_mode;constructor(t,e){super(t,e),this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(tV.component,t??e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}class JK extends KK{static type=R$.image;type=JK.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}wK.useMark([ZK,qK,JK]),B$.registerRegion("region",NK),B$.registerLayout("base",VK);var QK,tq,eq;We.getInstance(Ve.Error),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord"}(QK||(QK={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap"}(tq||(tq={}));class iq{_scaleSpecMap=new Map;_scaleMap=new Map;_modelScaleSpecMap=new Map;_markAttributeScaleMap=new Map;_spec=null;_chart=null;constructor(t,e){this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?Nh("colorOrdinal"):Nh(t.type)),e?(m(t.range)&&e.range(t.range),m(t.domain)&&(nl(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){if(!this._spec?.length)return;const t=new Map,e=new Map;this._spec.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._modelScaleSpecMap.forEach((i=>{const n=this._createFromSpec(i);n&&(t.set(i.id,n),e.set(i.id,i))})),this._scaleSpecMap=e,this._scaleMap=t}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),nl(n.domain)?e.reRender=!0:z(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)}getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,n)=>{nl(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{S$(e,[{key:t,operations:zl(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{i.dataStatistics?.rawData[0].name===t&&i.field&&S$(e,[{key:i.field,operations:zl(s.type)?["max","min"]:["values"]}])}))})),e};_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!nl(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=zl(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{zl(e.type)?(h(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),h(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;zl(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){if(!h(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(zl(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(zl(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));zl(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(h(t.field)||!h(t.changeDomain)&&"none"!==t.changeDomain&&!h(e))&&(s=i.clone()),n.push({...t,dataStatistics:e,markScale:s}),s}}class nq{_chart;constructor(t){this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(VX.regionSeriesDataFilterOver,{filter:({model:e})=>e?.id===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t])};stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][JX]/2;for(let i=0;i0){let e=Number.EPSILON,i=0,n=1,s=0;t.values.forEach((t=>{s=t[JX],s>=0?(t[ZX]=e,e+=t[JX],t[JX]=e):(t[ZX]=i,i+=t[JX],t[JX]=i)})),t.values.forEach((t=>{s=t[JX];const r=s>=0?e:i;n=s>=0?1:-1,t[QX]=Math.min(1,t[ZX]/r)*n,t[t$]=Math.min(1,t[JX]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[JX]=function(t){if(b(t))return t;const e=+t;return b(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class sq extends MK{type="chart";id=el();_spec;getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}_theme;_regions=[];_series=[];_components=[];_layoutFunc;_layoutRect={x:0,y:0,width:qj,height:Zj};getLayoutRect(){return this._layoutRect}_viewRect={width:qj,height:Zj};getViewRect(){return this._viewRect}_viewBox={x1:0,y1:0,x2:qj,y2:Zj};_modelOption;_globalScale;_idMap=new Map;_event;getEvent(){return this._event}_dataSet;_layoutTag=!0;getLayoutTag(){return this._layoutTag}setLayoutTag(t,e){return this._layoutTag=t,this.getCompiler()?.getVGrammarView()&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&this.getCompiler().reRenderAsync(e)),this._layoutTag}state={layoutUpdateRank:1};_stack;padding={top:0,left:0,right:0,bottom:0};_paddingSpec;_canvasRect;constructor(t,e){super(e),this._theme=e.getTheme(),this._paddingSpec=qh(t.padding??this._theme?.padding),this._event=new eK(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._modelOption={...e,mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale},this._stack=new nq(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),E(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.updateGlobalScaleDomain(),this.initComponent(),this.initEvent(),this._stack.init(),this._series.forEach((t=>t.getRawData()?.markRunning())),this._series.forEach((t=>t.fillData()))}onResize(t,e){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t){this._updateLayoutRect(t),this.setLayoutTag(!0)}createRegion(t){t&&t.forEach(((t,e)=>{const i=B$.createRegion("region",t,{...this._modelOption,specIndex:e,specKey:"region"});i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=pK(t.data,this._dataSet,this._spec.data):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),c(t.regionId)?i=this.getRegionsInUserId(t.regionId):c(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getAllSeries=()=>this._series??[];getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,{...this._modelOption,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey});i&&N(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=B$.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){if(this._layoutFunc=this._option.layout,!this._layoutFunc){let t=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(t=!0);const e=new(B$.getLayout(this._spec.layout?.type??(t?"layout3d":"base")))(this._spec.layout);this._layoutFunc=e.layoutItems.bind(e)}}layout(t){if(this._option.performanceHook?.beforeLayoutWithSceneGraph?.(),this.getLayoutTag()){this._event.emit(VX.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(VX.layoutEnd,{chart:this})}this._option.performanceHook?.afterLayoutWithSceneGraph?.()}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]];getAllRegions=()=>this._regions;getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[];getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>N(t).some((t=>c(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions;getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))};getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponents=()=>this._components;getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]];getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[];getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))};getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>t?.length?i.userId&&t.includes(i.userId):!e?.length||e.includes(i.getSpecIndex())));getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>e.specKey===t));if(i&&0!==i.length)return i[e]};getComponentsByKey=t=>this._components.filter((e=>e.specKey===t));getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e};getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof IK)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof KK))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof KK)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}getCanvasRect(){if(this._canvasRect)return this._canvasRect;const{width:t,height:e}=this._spec;if(c(t)&&c(e))this._canvasRect={width:t,height:e};else{let i=qj,n=Zj;const s=this._option.container,r=this._option.canvas;if(s){const{width:t,height:e}=en(this._option.container,qj,Zj);i=t,n=e}else if(r&&Zo(this._option.mode)){let t;t=f(r)?document?.getElementById(r):r;const{width:e,height:s}=en(t,qj,Zj);i=e,n=s}i=t??i,n=e??n,this._canvasRect={width:i,height:n}}return this._canvasRect}getSeriesData(t,e){if(!this._spec.data)throw new Error("no data in spec!");if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));if(e[0])return e[0];throw new Error(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._spec.data[e])return this._spec.data[e];throw new Error(`no data matches dataIndex ${e}!`)}return this._spec.data[0]}_transformSpecScale(){const t=this._spec.scales??[];let e=t.find((t=>"color"===t.id));if(!e&&(e={type:"ordinal",id:"color",domain:null,range:null},t.push(e),this._spec.color)){const t=this._spec.color;if(m(t))e.range=t.map((t=>Oh(t,this._theme?.colorScheme)));else{const i=t;Object.prototype.hasOwnProperty.call(i,"type")&&(e.type=i.type),Object.prototype.hasOwnProperty.call(i,"domain")&&(e.domain=i.domain),Object.prototype.hasOwnProperty.call(i,"range")&&(e.range=i.range),Object.prototype.hasOwnProperty.call(i,"specified")&&(e.specified=i.specified)}}return e.range?.length||(e.range=Ih(this._theme?.colorScheme),e.rangeTheme=!0),t}createGlobalScale(){this._globalScale=new iq(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color");t.rangeTheme&&(t.range=Ih(this._theme?.colorScheme),this._globalScale.getScale("color").range(t.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec),s=Object.keys(t);return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateDataSpec(i),i.reMake?i:(this.updateGlobalScaleDomain(),this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake||this.updateSeriesSpec(i),i))))}updateDataSpec(t){this._spec.data&&N(this._spec.data).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(t.values?e.updateRawData(t.values):t.latestData||e.updateRawData([]))}))}updateRegionSpec(t){this._spec?.region&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{const n=this._spec[i.specKey]??{};m(n)?(e[i.specKey]=e[i.specKey]||{specCount:n.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(n[i.getSpecIndex()]))):this._mergeUpdateResult(t,i.updateSpec(n)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.series[e.getSpecIndex()])),e.reInit()})):t.reMake=!0}getCanvas(){return this.getCompiler()?.getCanvas()??null}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){return{data:t.data?.[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Kh(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}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((async e=>{await e.setCurrentTheme(t.series[e.type],!0)}))}compile(){this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{t.afterCompile?.()})),this.getAllSeries().forEach((t=>{t.afterCompile?.()})),this.getAllComponents().forEach((t=>{t.afterCompile?.()}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileRegions(){this._option.performanceHook?.beforeRegionCompile?.(),this.getAllRegions().forEach((t=>{t.compile()})),this._option.performanceHook?.afterRegionCompile?.()}compileSeries(){this._option.performanceHook?.beforeSeriesCompile?.(),this.getAllSeries().forEach((t=>{t.compile()})),this._option.performanceHook?.afterSeriesCompile?.()}compileComponents(){this._option.performanceHook?.beforeComponentCompile?.(),this.getAllComponents().forEach((t=>{t.compile()})),this._option.performanceHook?.afterComponentCompile?.()}release(){super.release(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){if(t.context?.model&&(i=t,e=t.context.model),e&&t.isUpdated)return e.bindSceneNode?.(i.elements[0]),void e.setAttributeTag(!0);"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(M(t[n]))continue;const s=t[n];let r={stateValue:n};r=l(s.filter)?{filter:s.filter,...r}:{...s.filter,...r},s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(yK.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(yK.STATE_HOVER,!0,t,e,i)}initEvent(){[VX.dataZoomChange,VX.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(hV.AFTER_MARK_RENDER_END,e)};this._event.on(hV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?N(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||l(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){let i=null;if(Array.from(this._event.getComposedEventMap().values()).forEach((n=>{const{eventType:s,event:r}=n;if(s===Q$.dimensionHover||s===Q$.dimensionClick){const n=r.dispatch(t,e);n?.length&&(i=n)}})),i){if(!1!==e.tooltip){const t=this._components.find((t=>t.type===un.tooltip));if(t.getVisible()){const n={};i.forEach((t=>{const{axis:e,value:i,data:s}=t,r="left"===e.orient||"right"===e.orient;s.forEach((t=>{r?n[t.series.fieldY[0]]=i:n[t.series.fieldX[0]]=i}))})),t.showTooltip(n,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===un.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&i.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()}))}}}}class rq extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const e=t.orient;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}function aq(t){t.crosshair=N(t.crosshair||{}).map((e=>L({[t.direction===Gh.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(eq||(eq={}));const oq=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:l,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!h(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!h(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!h(t[a.valueField])&&(o=e+ +t[a.valueField]);t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=t[s]+ +t[n],i.end=t[r]),i.isTotal=c,(h(o)||o===UX)&&(t[UX]=c?l.total:+t[n]>=0?l.increase:l.decrease)})),f={...i,lastIndex:t},d.push(i)})),d},lq=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:s?.text||"total",[n]:t.reduce(((t,e)=>t+ +e[n]),0)};return r&&(a[r]="total"),t.push(a),t},hq=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:cq(t.map((t=>t.latestData)).flat(),e.fields,i)}};function cq(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);return i[n]=new Set,r=function(t,e,i){const n=new Map;return t.forEach((t=>{const s=t[e];n.has(s)||(n.set(s,[]),i.add(s)),n.get(s).push(t)})),Object.fromEntries(n)}(t,n,i[n]),a=(t,e)=>cq(t,s,i),Object.keys(r).reduce(((t,e)=>(t[e]=a(r[e],e),t)),{});var r,a}class dq{_fields=[];get fields(){return this._fields}_groupData;get groupData(){return this._groupData}constructor(t){this._fields=t}initData(t,e){const i=t.name,n=new Vo(e instanceof jo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),rK(e,"dimensionTree",hq),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){const e=this.groupData?.latestData?.dimensionValues?.[t];return e?Array.from(e):[]}}const uq=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},pq={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class gq{event;interaction;_spec;_option;_hover;get hover(){return this._hover}_select;get select(){return this._select}_fields=null;_marks=new AK;_markReverse=new AK;constructor(t,e){this._spec=t,this._option=e,this.event=new eK(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(yK.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(yK.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(N(i).forEach((e=>{t.on(e,{level:GX.chart},this.onHover)})),n&&"none"!==n&&N(n).forEach((e=>{t.on(e,{level:GX.vchart,source:WX.chart},this.onUnHover)}))),s&&(N(r).forEach((e=>{t.on(e,{level:GX.mark},this.onSelect)})),a&&"none"!==a&&N(a).forEach((e=>{t.on(e,{level:GX.mark},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=pq[t];this._hover={...e?.hover},this._select={...e?.select};const i=this._spec.hover;o(i)?this._hover.enable=i:d(i)&&(this._hover.enable=!0,this._hover=L(this._hover,i));const n=this._spec.select;o(n)?this._select.enable=n:d(n)&&(this._select.enable=!0,this._select=L(this._select,n))}onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)};onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,yK.STATE_HOVER)||this.interaction.getEventElement(yK.STATE_HOVER)[0]&&this.unhoverItem()};onSelect=t=>{this.handleSingleEventSelect(t)};onUnSelect=t=>{this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()};hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(yK.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(yK.STATE_HOVER,t.item),this.interaction.reverseEventElement(yK.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(yK.STATE_HOVER);this.interaction.clearEventElement(yK.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(yK.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,yK.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(yK.STATE_SELECTED);this.interaction.clearEventElement(yK.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(yK.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(yK.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(yK.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(yK.STATE_SELECTED,t.item);this.interaction.reverseEventElement(yK.STATE_SELECTED);const e=this.interaction.getEventElementData(yK.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,yK.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class fq{spec;activeType;activeTriggerSet={mark:new Set,dimension:new Set};ignoreTriggerSet={mark:new Set,dimension:new Set};getDefaultShapeType(){return"circle"}}const mq=(t,e)=>c(e)?t.map((t=>e[t])):void 0,yq=(t,e)=>i=>t.every(((t,n)=>i[t]===e?.[n])),_q=t=>!h(t)&&(m(t)?t.length>0&&t.every(c):Object.keys(t).length>0);function vq(t,e,i,n){const s={regionIndex:0,...e},r=n.getRegionsInUserIdOrIndex(c(s.regionId)?[s.regionId]:void 0,c(s.regionIndex)?[s.regionIndex]:void 0)[0];if(!r)return"none";const a=r.getSeries(),o=[];a.forEach((e=>{const i=e.getDimensionField(),n=e.getMeasureField(),s=e.getSeriesField(),r=c(s)?t[s]:void 0,a=c(s)?e.getViewDataStatistics?.()?.latestData[s]?.values??[]:[],l=mq(i,t);let d=mq(n,t);const u=_q(d),p=!u&&c(s)&&h(r)&&a.length>0;if("cartesian"===e.coordinate){const t=e,c=i.map(((t,e)=>[t,e])).filter((([,t])=>h(l?.[t])));let g=[l??[]];c.length>0&&c.forEach((([t,i])=>{const n=e.getViewDataStatistics?.()?.latestData[t]?.values??[],s=[];g.forEach((t=>{n.forEach((e=>{const n=[...t??[]];n[i]=e,s.push(n)}))})),g=s})),g.forEach((l=>{if(p){const r=t.getViewData()?.latestData.filter(yq(i,l));a.forEach((a=>{const c=r.find((t=>t[s]===a));if(d=mq(n,c),!_q(d))return;const p=t.dataToPosition(c);h(p)||isNaN(p.x)||isNaN(p.y)||o.push({pos:p,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:a},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}))}else if("polar"===e.coordinate)if(e.type===tq.pie){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToCentralPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}else{const t=e;if(p){const c=t.getViewData()?.latestData.filter(yq(i,l)),p=c.find((t=>t[s]===r));a.forEach((r=>{if(d=mq(n,p),!_q(d))return;const a=t.dataToPosition(p);h(a)||isNaN(a.x)||isNaN(a.y)||o.push({pos:a,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}))}else{const a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}else if("geo"===e.coordinate){const t=e,a=t.getViewData()?.latestData.find(yq(i,l));if(!u&&(d=mq(n,a),!_q(d)))return;const c=t.dataToPosition(a);if(h(c)||isNaN(c.x)||isNaN(c.y))return;o.push({pos:c,data:{dimensionFields:i,dimensionData:l,measureFields:n,measureData:d,hasMeasureData:u,groupField:s,groupData:r},series:e})}}));const l=s.activeType??(o.length>1?"dimension":"mark"),d=r.getLayoutStartPoint(),u=r.getLayoutRect(),p=n.globalInstance.getContainer(),g={x:0,y:0,...p?nn(p):{}},f=t=>{const{dimensionFields:e,dimensionData:i,measureFields:n,measureData:s,groupField:r,groupData:a}=t.data,o=t.series.getViewData()?.latestData.find((t=>yq(e,i)(t)&&yq(n,s)(t)&&(h(r)||yq([r],[a])(t))));return o},m=t=>{const e=(t=>({x:Math.min(Math.max(t.x,0),u.width),y:Math.min(Math.max(t.y,0),u.height)}))(t),i=s.x??d.x+e.x,n=s.y??d.y+e.y;return{canvasX:i,canvasY:n,clientX:g.x+i,clientY:g.y+n}};if("dimension"===l){const e=o[0];if(!e)return"none";const s=new Map;o.forEach((t=>{s.has(t.series)||s.set(t.series,[]),s.get(t.series)?.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>({series:t,datum:s.get(t)?.map((t=>f(t)))??[]})))}],a={changePositionOnly:!1,dimensionInfo:r,chart:n.globalInstance.getChart()??void 0,datum:void 0,model:void 0,source:WX.chart,event:m({x:o.reduce(((t,e)=>t+e.pos.x),0)/o.length,y:o.reduce(((t,e)=>t+e.pos.y),0)/o.length}),item:void 0,itemMap:new Map};i?.showTooltip?.(l,r,a);const h=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(h.id),l}if("mark"===l){const e=o[0];if(!e)return"none";const s={...f(e),...t},r={changePositionOnly:!1,chart:n.globalInstance.getChart()??void 0,datum:s,model:e.series,source:WX.chart,event:m(e.pos),item:void 0,itemMap:new Map};i?.showTooltip?.(l,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),l}return"none"}const bq=t=>{if(!1===t?.visible)return[];const e={mark:!1!==t?.mark?.visible,dimension:!1!==t?.dimension?.visible};return c(t?.activeType)&&Object.keys(e).forEach((i=>{e[i]=t?.activeType?.includes(i)})),Object.keys(e).filter((t=>e[t]))};function xq(t){return h(t.mark)&&h(t.model)&&h(t.datum)}class Sq extends fq{series;_seriesCacheInfo;constructor(t){super(),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){const t=this.series.getSpec()?.tooltip??{},e={...this.series.getChart().getSpec()?.tooltip??{},...t};["mark","dimension"].forEach((t=>{const i=e[t];c(i)&&(e[t]={...i,title:c(i.title)?l(i.title)?i.title:{...i.title,seriesId:this.series.id}:void 0,content:c(i.content)?l(i.content)?i.content:N(i.content).map((t=>l(t)?t:{...t,seriesId:this.series.id})):void 0})})),this.spec=e,this.activeType=bq(e),this._seriesCacheInfo=this._getSeriesCacheInfo()}_getSeriesCacheInfo=()=>{const{series:t}=this,e=t.getSeriesField();return{seriesFields:c(e)?N(e):t.getSeriesKeys()??[],dimensionFields:t.getDimensionField()??[],measureFields:t.getMeasureField()??[],type:t.type}};_getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&t?.[e[0]]};_getSeriesStyle=(t,e,i)=>{for(const i of N(e)){const e=this.series.getSeriesStyle(t)?.(i);if(c(e))return e}return i};contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])&&t?.[n[0]]?t?.[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),t?.[s])};contentValueCallback=(t,e)=>this._getMeasureData(t);contentShapeTypeCallback=(t,e)=>this._getSeriesStyle(t,"shape",this.getDefaultShapeType());contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]);titleValueCallback=(t,e)=>this._getDimensionData(t);getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}getDefaultShapeType(){return this.series.getDefaultShapeType()}}const wq={min:()=>Number.MAX_VALUE,max:()=>Number.MIN_VALUE,values:()=>new Set,"array-min":()=>Number.MAX_VALUE,"array-max":()=>Number.MIN_VALUE},Aq={min:t=>t===wq.min()?0:t,max:t=>t===wq.max()?0:t,values:t=>Array.from(t),"array-min":t=>t===wq.min()?0:t,"array-max":t=>t===wq.max()?0:t};const kq={min:function(t,e){return il(e)?Math.min(t,e):t},max:function(t,e){return il(e)?Math.max(t,e):t},values:function(t,e){return void 0===e||t.has(e)||t.add(e),t},"array-min":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.min(t,...i)},"array-max":function(t,e){const i=(e??[]).filter((t=>il(t)));return 0===i.length?t:Math.max(t,...i)}},Mq=(t,e)=>{const i={};let n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;n=S$([],n);const s="parser"===e.target?"parserData":"latestData",r=t[0][s]?t[0][s]:t||[],a=t[0].getFields?.();return n.forEach((t=>{i[t.key]={};const e=a?.[t.key];t.operations.forEach((n=>{if(t.customize)i[t.key][n]=t.customize;else{if(e&&e.lockStatisticsByDomain&&!h(e.domain)){if("min"===n)return void(i[t.key][n]=Math.min(...e.domain));if("max"===n)return void(i[t.key][n]=Math.max(...e.domain));if("values"===n)return void(i[t.key][n]=[...e.domain])}i[t.key][n]=wq[n](),r.forEach((e=>{const s=e?.[t.key];i[t.key][n]=kq[n](i[t.key][n],s)})),i[t.key][n]=Aq[n](i[t.key][n]),"array-max"===n&&(i[t.key].max=i[t.key][n]),"array-min"===n&&(i[t.key].min=i[t.key][n])}}))})),i},Cq=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();if("link"===n)t=t.filter((t=>il(t[s])));else if("zero"===n)return t.forEach((t=>{il(t[s])||(t[s]=0)})),t;return t};class Tq extends YK{_compileProduct(){const t=this._data?.latestData;h(t)||c(this.getProduct())||this._initProduct([])}generateProductId(){return this._data?.name}}const Eq=`${Kj}_HIERARCHY_DEPTH`,Pq=`${Kj}_HIERARCHY_ROOT`,Rq=`${Kj}_HIERARCHY_ROOT_INDEX`,Bq=()=>({keyMap:new Map});function Iq(t,e,i){t&&(this._seriesField||(t[$X]=this.getSeriesKeys()[0]),t[YX]=e,t[XX]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function Dq(t,e,i,n=0,s,r){void 0===r&&(r=e),Iq.bind(this)(t,e,i),t[Eq]=n,t[Pq]=s||t[this.getCategoryField()],t[Rq]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>Dq.bind(this)(e,n,i,t[Eq]+1,t[Pq],r)))}class Lq extends IK{type="series";layoutType="absolute";modelType="series";name=void 0;static mark={[QK.label]:{name:QK.label,type:R$.text}};_trigger;getTrigger(){return this._trigger}coordinate="none";_region=null;getRegion(){return this._region}_rootMark=null;getRootMark(){return this._rootMark}_seriesMark=null;_layoutLevel;_rawData;getRawData(){return this._rawData}_rawDataStatistics;getRawDataStatistics(){return this._rawDataStatistics}_viewDataMap=new Map;_viewDataFilter=null;getViewDataFilter(){return this._viewDataFilter}_data=null;getViewData(){return this._data?.getDataView()}getViewDataProductId(){return this._data?.getProductId()}_viewDataStatistics;getViewDataStatistics(){return this._viewDataStatistics}_viewStackData;getViewStackData(){return this._viewStackData}_seriesField;getSeriesField(){return this._seriesField}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}_groups;getGroups(){return this._groups}_stackValue;_stack=!1;getStack(){return this._stack}_percent=!1;getPercent(){return this._percent}_stackOffsetSilhouette=!1;getStackOffsetSilhouette(){return this._stackOffsetSilhouette}_dataSet;get tooltipHelper(){return this._tooltipHelper}_invalidType;getInvalidType(){return this._invalidType}setInvalidType(t){this._invalidType=t,this.getViewData()?.reRunAllTransform()}_markAttributeContext;constructor(t,e){super(t,{...e}),this._region=e.region,this._dataSet=e.dataSet,this._spec?.name&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(VX.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&c(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(VX.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={globalScale:(t,e)=>this._option.globalScale.getScale(t)?.scale(e),seriesColor:t=>(h(t)&&(t=this.getSeriesKeys()[0]),this._option.globalScale.getScale("color")?.scale(t))}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),o(this._spec.stack)&&(this._stack=this._spec.stack),o(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.stack||this._spec.percent),o(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stack||this._spec.stackOffsetSilhouette),c(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),this._tooltipHelper?.updateTooltipSpec()}initData(){if(this._rawData=this._spec.data,this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=uK(this._rawData,this._dataSet,{name:`${Kj}_series_${this.id}_viewDataFilter`});const t=uK(this._viewDataFilter,this._dataSet,{name:`${Kj}_series_${this.id}_viewData`});this._data=new Tq(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"link"!==this._invalidType&&"zero"!==this._invalidType||(rK(this._option.dataSet,"invalidTravel",Cq),this.getViewData()?.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new dq(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this.createStatisticalData(t,this._rawData,this._option.globalScale.getStatisticalFields),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_statisticViewData(){const t=`${Kj}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=this.createStatisticalData(t,this._data.getDataView()),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){rK(this._dataSet,"dimensionStatistics",Mq);const n=new Vo(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{const t=S$(this.getStatisticFields(),i?.(e.name)??[]);return this._seriesField&&S$(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),n}createdStackData(){const t=this._rawData?.name??`${Kj}_series_${this.id}_viewStackData`;this._viewStackData=new Vo(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=t,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}generateDefaultDataKey(t,e,i,n){if(h(t)){const{keyMap:t}=n,i=this._getSeriesDataKey(e);return void 0===t.get(i)?t.set(i,0):t.set(i,t.get(i)+1),`${i}_${t.get(i)}`}if(f(t))return e[t];if(m(t)&&t.every((t=>f(t))))return t.map((t=>e[t])).join("-");if(l(t))return t(e,i);throw new Error(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){this.event.emit(VX.rawDataUpdate,{model:this}),this._rawDataStatistics?.reRunAllTransform()}rawDataStatisticsUpdate(t){this.event.emit(VX.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(VX.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(VX.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(VX.viewDataStatisticsUpdate,{model:this})}getDatumPositionValues(t,e){return!t||h(e)?[]:f(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){this._rootMark=this._createMark({type:R$.group,name:`seriesGroup_${this.type}_${this.id}`},{parent:this._region.getGroupMark?.(),dataView:!1}),this._rootMark.setZIndex(this.layoutZIndex)}_initExtensionMark(){this._spec.extensionMark&&this._spec.extensionMark?.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`},{markSpec:t,parent:e,dataView:!1});if(s)if("group"===t.type)i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}));else if(!(e||h(t.dataId)&&h(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?s.setDataView(this.getViewData(),this.getViewDataProductId()):s.setDataView(e)}}getStackData(){return this._viewStackData?.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e={...this._option,model:this,interaction:this._region.interaction};this._trigger=new gq(t,e)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){const t=this._spec.seriesStyle;if(!t||!t.length)return;const e=this._seriesField??$X;this.getMarksWithoutRoot().forEach((i=>{const n={},s={},r={};t.forEach((t=>{const e=t[i.name]?.style;e&&(n[t.name]=!0,r[t.name]=r[t.name]||{},Object.keys(e).forEach((i=>{s[i]=!0,r[t.name][i]=e[i]})))})),i.state.addStateInfo({stateValue:KX,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][e]]:!0===n[t[e]]});const a={};Object.keys(s).forEach((t=>{a[t]=n=>{let s;if(Array.isArray(n)){if(0===n.length)return;s=r[n[0][e]]?.[t]}return s=r[n[e]]?.[t],s||i.getAttribute(t,n)}})),this.setMarkStyle(i,a,KX)}))}afterInitMark(){this.event.emit(VX.afterInitMark,{model:this}),this._rawDataStatistics?.reRunAllTransform(),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{t.stateStyle?.normal?.lineWidth&&t.setAttribute("stroke",this.getColorAttribute(),"normal",qX.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){this._trigger.init(),this._rawData?.target.addListener("change",this.rawDataUpdate.bind(this)),this._data?.getDataView()?.target.addListener("change",this.viewDataUpdate.bind(this)),this._viewDataStatistics?.target.addListener("change",this.viewDataStatisticsUpdate.bind(this)),this._rawDataStatistics?.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new Sq(this)}updateSpec(t){const e=super.updateSpec(t);t.type!==this.type&&(e.reMake=!0);const{invalidType:i}=this._originalSpec;return t.invalidType!==i&&(e.change=!0,e.reRender=!0),e}reInit(t){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){super.release(),this._viewDataMap.clear(),this._data?.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){return this._seriesField?this._rawDataStatistics?.latestData[this._seriesField]?.values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>this._seriesMark?.getAttribute(e,t)??null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){const e=this._rawDataStatistics.latestData[t]?.values;return this._getSeriesInfo(t,e)}getSeriesInfoList(){return this._getSeriesInfo(this._seriesField??$X,this.getSeriesKeys())}getDefaultColorScale(){const t=this.getDefaultColorDomain(),e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range?.(e)}getDefaultColorDomain(){return this._seriesField?this._viewDataStatistics?.latestData[this._seriesField]?.values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesField??$X}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(e.series[this.type]??{}),this._mergeThemeToSpec(),this._preprocessSpec()}_mergeThemeToSpec(){const t=this.getChart().getSpec();this._spec=L({},this._theme,this._getDefaultSpecFromChart(t),this._originalSpec)}_getDefaultSpecFromChart(t){return{}}_createMark(t,e={}){const{key:i,groupKey:n,skipBeforeLayouted:s,themeSpec:r={},markSpec:a,dataView:l,dataProductId:d,parent:u,isSeriesMark:p,dataStatistics:g,depend:f,label:m,progressive:y,support3d:_=this._spec.support3d||!!this._spec.zField,morph:v=!1}=e,b=super._createMark(t,{key:i??this._getDataIdKey(),support3d:_,dataStatistics:g??this._rawDataStatistics,attributeContext:this._markAttributeContext});if(c(b)){this._marks.addMark(b),p&&(this._seriesMark=b),h(u)?this._rootMark?.addMark(b):!1!==u&&u.addMark(b),h(l)?(b.setDataView(this.getViewData(),this.getViewDataProductId()),b.setSkipBeforeLayouted(!0)):!1!==l&&b.setDataView(l,d),o(s)&&b.setSkipBeforeLayouted(s),c(f)&&b.setDepend(...N(f)),c(m)&&b.setLabelSpec(m);const t=this.getSpec()||{};b.setMorph(v),b.setMorphKey(t.morph?.morphKey||`${this._specIndex}`),b.setMorphElementKey(t.morph?.morphElementKey??e.defaultMorphElementKey),h(y)||b.setProgressiveConfig(y),h(n)||b.setGroupKey(n),this.initMarkStyleWithSpec(b,L({},r,a||t[b.name]))}return b}_getDataIdKey(){return super._getDataIdKey()??XX}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){this._viewDataFilter.transform(t,!1)}reFilterViewData(){this._viewDataFilter?.reRunAllTransform()}reTransformViewData(){this._data?.getDataView()?.reRunAllTransform()}fillData(){this.getRawData()?.reRunAllTransform()}compile(){this.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){return t!==JX&&t!==t$&&t!==ZX&&t!==QX||(t=this.getStackValueField()),A$(this.getRawData(),t)??t}getMarkInfoList(){const t=super.getMarkInfoList();if(!t.length){const t=B$.getSeries(this.type);return Object.values(t.mark??{})}return t}}class Oq extends Lq{coordinate="cartesian";_bandPosition=.5;_fieldX;get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=N(t)}_fieldY;get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=N(t)}_fieldZ;get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&N(t)}_fieldX2;get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}_fieldY2;get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}_direction=Gh.vertical;get direction(){return this._direction}_scaleX;get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}_scaleY;get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}_scaleZ;get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}_xAxisHelper;getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}_yAxisHelper;getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}_zAxisHelper;getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}getStatisticFields(){const t=[];return this.getXAxisHelper()?.getScale&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((e=>{const i={key:e,operations:[]};zl(this.getXAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.getYAxisHelper()?.getScale&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((e=>{const i={key:e,operations:[]};zl(this.getYAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this._fieldZ&&this.getZAxisHelper()?.getScale&&this._fieldZ.forEach((e=>{const i={key:e,operations:[]};zl(this.getZAxisHelper().getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===Gh.vertical?N(this._spec.yField)[0]:N(this._spec.xField)[0]}setValueFieldToStack(){this.direction===Gh.vertical?(this.setFieldY(JX),this.setFieldY2(ZX)):(this.setFieldX(JX),this.setFieldX2(ZX))}setValueFieldToPercent(){this.direction===Gh.vertical?(this.setFieldY(t$),this.setFieldY2(QX)):(this.setFieldX(t$),this.setFieldX2(QX))}setValueFieldToStackOffsetSilhouette(){this.direction===Gh.vertical?(this.setFieldY(i$),this.setFieldY2(e$)):(this.setFieldX(i$),this.setFieldX2(e$))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return Go(t.xField,i)&&Go(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),c(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(this._spec?.x2Field),this.setFieldY2(this._spec?.y2Field),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette()}dataToPosition(t){return t?{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)=>this.getXAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.yBandwidth=(t=0)=>this.getYAxisHelper().getBandwidth?.(t)??0,this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}valueToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}valueToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(N(t),{bandPosition:this._bandPosition})}dataToPositionX(t){return this._xAxisHelper?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX)):Number.NaN}dataToPositionY(t){return this._yAxisHelper?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY)):Number.NaN}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._xAxisHelper.getScale?.(0).range()[0]:Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this._yAxisHelper.getScale?.(0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY])}getDimensionField(){return this._direction===Gh.vertical?this.fieldX:this.fieldY}getMeasureField(){return this._direction===Gh.vertical?N(this._spec.yField??this.fieldY):N(this._spec.xField??this.fieldX)}}const Fq=(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};const zq={type:"clipIn"},Hq={type:"fadeIn"};function jq(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return Hq;default:return zq}}function Nq(t,e=!0){return(i,n,s)=>{const r="vertical"===t.direction?t.yField:t.xField,a=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 Vq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:Nq(t,e)}),Wq=(t,e=!0)=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:Nq(t,e)}),Gq={type:"fadeIn"},Uq={type:"growCenterIn"};function Yq(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Gq;case"scaleIn":return Uq;default:return Vq(t)}}const Xq={type:"clipIn"},$q={type:"fadeIn"};function Kq(t,e){switch(e){case"grow":return(t=>({type:t.direction===Gh.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===Gh.horizontal?"positive":"negative"}}))(t);case"fadeIn":return $q;default:return Xq}}function qq(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const Zq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:qq(t,!0,fK.appear)}),Jq={type:"fadeIn"},Qq=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:qq(t,!0,fK.enter)}),tZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:qq(t,!0,fK.exit)}),eZ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:qq(t,!0,fK.exit)});function iZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return Jq;case"growRadius":return Zq({...t,growField:"radius"});default:return Zq({...t,growField:"angle"})}}const nZ={type:"fadeIn"};function sZ(t,e){return"fadeIn"===e?nZ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function rZ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aZ=t=>({type:t.direction===Gh.horizontal?"growWidthOut":"growHeightOut",options:rZ(t)}),oZ={type:"fadeIn"};function lZ(t,e){return!1===e?{}:"fadeIn"===e?oZ:(t=>({type:t.direction===Gh.horizontal?"growWidthIn":"growHeightIn",options:rZ(t)}))(t)}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=()=>t.center()?.x,n=(t,e)=>e.getGraphicAttribute("x"),s=()=>t.center()?.y,r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const uZ=(t,e)=>({custom:BC,customParameters:(i,n)=>({group:n.getGraphicItem(),startAngle:t.startAngle??Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e})});class pZ extends lC{_fromAngle;_fromRadius;_toAngle;_toRadius;_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;l(r)&&l(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);b(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);b(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class gZ extends PC{_pointToCoord;_coordToPoint;constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Ht(d,u,p,g);return f.defined=e.defined,f}}const fZ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},mZ={type:"fadeIn"},yZ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),_Z=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),vZ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function bZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mZ;case"growAngle":return fZ({...t,growField:"angle"});default:return fZ({...t,growField:"radius"})}}const xZ={type:"fadeIn"},SZ={type:"growCenterIn"};function wZ(t,e){switch(e){case"fadeIn":return xZ;case"scaleIn":return SZ;default:return Vq(t,!1)}}const AZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},kZ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),MZ={type:"fadeIn"},CZ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function TZ(t,e){return"fadeIn"===e?MZ:kZ(t)}const EZ=t=>({custom:DC,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),PZ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},RZ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BZ=t=>{const e=t.mark.elements.filter((t=>t.diffState===QN.update)),i=Math.min(...e.map((t=>t?.data?.[0].depth)));return e.filter((t=>t?.data?.[0].depth===i))},IZ=(t,e,i)=>{if(M(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},DZ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=IZ(r,n,s);return RZ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),LZ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},OZ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=BZ(i),a=LZ(r);return RZ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),FZ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},zZ={type:"fadeIn"};function HZ(t){return!1===t?{}:zZ}const jZ={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"}},NZ={bar:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),bar3d:(t,e)=>({appear:Yq(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t)}),line:(t,e)=>({appear:Kq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:PC,duration:jZ.update.duration,easing:jZ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:jq(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),pie3d:(t,e)=>({appear:iZ(t,e),enter:Qq(t),exit:tZ(t),disappear:eZ(t)}),rose:(t,e)=>({appear:bZ(t,e),enter:yZ(t),exit:_Z(t),disappear:vZ(t)}),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:cZ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:gZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:dZ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:dZ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:pZ,customParameters:t,duration:jZ.update.duration,easing:jZ.update.easing}]}),radarGroup:(t,e)=>({appear:uZ(t,"in"),disappear:uZ(t,"out")}),circularProgress:(t,e)=>({appear:sZ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:AZ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:lZ(t,e),enter:{type:"grow"},disappear:aZ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:IC,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:IC,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:EZ(t)}),rangeColumn:(t,e)=>({appear:TZ(t,e),enter:kZ(t),exit:CZ(t),disappear:CZ(t)}),waterfall:(t,e)=>({appear:wZ(t,e),enter:Vq(t,!1),exit:Wq(t,!1),disappear:Wq(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:PZ(0,e),enter:DZ(t),exit:OZ(t),disappear:OZ(t)}),circlePacking:(t,e)=>({appear:FZ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:HZ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:wU},update:{custom:SU},exit:{custom:LC}})},VZ=["appear","enter","update","exit","disappear","normal"];function WZ(t,e,i){const n={};for(let s=0;s{const a=e(t),o=l(n)?n(t,s,r):b(n)?n:0;let h=l(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(o+h))},delete t.oneByOne,t}function YZ(t){return t?.[YX]}function XZ(t,e,i){return!1!==t&&(!1!==i?.appear&&!1!==i?.update&&!1!==e?.enable)}function $Z(t){return!function(t){return c(t.timeSlices)}(t)&&c(t.channel)}class KZ extends KK{static type=R$.rect;type=KZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,lineWidth:0}}}class qZ extends KK{static type=R$.text;type=qZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),angle:0,textAlign:"center",lineWidth:0}}}wK.useMark([KZ,qZ]);class ZZ extends Oq{static type=tq.bar;type=tq.bar;_barMarkName=QK.bar;_barMarkType=R$.rect;static mark={...Lq.mark,[QK.bar]:{name:QK.bar,type:R$.rect}};_stack=!0;_bandPosition=0;_rectMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark({...ZZ.mark.bar,name:this._barMarkName,type:this._barMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)})}init(t){super.init(t),"vertical"===this.direction?"band"===this._xAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===this._yAxisHelper?.getScale(0).type?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initLinearRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0);this.setMarkStyle(this._rectMark,{x:e=>Vh(this.dataToPositionX(e),t),x1:e=>Vh(this.dataToPositionX1(e),t),y:t=>Vh(this.dataToPositionY(t),e),y1:t=>Vh(this.dataToPositionY1(t),e)},"normal",qX.Series)}initAnimation(){const t={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.bar(t,e),GZ(this._barMarkName,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getBarWidth(t){const e=void 0!==this._spec.barWidth,i=t.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6;if(e)return Fq(this._spec.barWidth,i);const n=void 0!==this._spec.barMinWidth,s=void 0!==this._spec.barMaxWidth;let r=i;return n&&(r=Math.max(r,Fq(this._spec.barMinWidth,i))),s&&(r=Math.min(r,Fq(this._spec.barMaxWidth,i))),r}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}class JZ extends KK{static type=R$.rule;type=JZ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x1:0,y1:0}}}wK.useMark([JZ]);class QZ extends ZZ{static type=tq.waterfall;type=tq.waterfall;static mark={...ZZ.mark,[QK.leaderLine]:{name:QK.leaderLine,type:R$.rule},[QK.stackLabel]:{name:QK.stackLabel,type:R$.text}};_stack=!0;_totalData;_leaderLineMark=null;_stackLabelMark=null;_labelMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],h(this._seriesField)&&(this._seriesField=UX)}getSeriesKeys(){return this._seriesField===UX?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){super.initData(),rK(this._dataSet,"waterfallFillTotal",lq),rK(this._dataSet,"waterfall",oq),(h(this._spec.total)||"end"===this._spec.total.type)&&this._rawData?.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1);const t=uK(this.getViewData(),this._dataSet,{name:`${Kj}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",t.reRunAllTransform),this._totalData=new Tq(this._option,t),t.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:ZX,endAs:JX,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){const t={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset,i=t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0};this._rectMark.setAnimationConfig(WZ(NZ.waterfall(t,e),GZ(QK.bar,this._spec),{dataIndex:i})),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:i}))}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(QZ.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(QZ.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===Gh.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):Vh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===Gh.vertical?Vh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===Gh.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",qX.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!h(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",qX.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{const e="absolute"===this._spec.stackLabel?.valueType?t.end:t.end-t.start;return this._spec.stackLabel?.formatMethod?this._spec.stackLabel.formatMethod(e,t):e}});const t=this._spec.stackLabel?.position||"withChange",e=this._spec.stackLabel?.offset||0;this._direction===Gh.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:i=>"middle"===t?.5*(this._totalPositionY(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionY(i,i.end>=i.start?"end":"start")-e:"min"===t?this._totalPositionY(i,i.end>=i.start?"start":"end")+e:this._totalPositionY(i,"end")+(i.end>=i.start?-e:e),textBaseline:e=>"middle"===t?"middle":"withChange"===t&&e.end-e.start>=0||"max"===t?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:i=>"middle"===t?.5*(this._totalPositionX(i,"end")+this._totalPositionY(i,"start")):"max"===t?this._totalPositionX(i,i.end>=i.start?"end":"start")+e:"min"===t?this._totalPositionX(i,i.end>=i.start?"start":"end")-e:this._totalPositionX(i,"end")+(i.end>=i.start?e:-e),y:t=>this._totalPositionY(t,"index",.5),textAlign:e=>"middle"===t?"center":"withChange"===t&&e.end-e.start>=0||"max"===t?"left":"right"})}}}const tJ=`${Kj}_BOX_PLOT_OUTLIER_VALUE`;var eJ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(eJ||(eJ={}));const iJ=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];m(e)||(e=[e]),i.push(...e.map((e=>{const i={[tJ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class nJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(eJ.OUTLIER),value:this.getContentValue(eJ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(eJ.MAX),value:this.getContentValue(eJ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q3),value:this.getContentValue(eJ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MEDIAN),value:this.getContentValue(eJ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.Q1),value:this.getContentValue(eJ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.MIN),value:this.getContentValue(eJ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(eJ.SERIES_FIELD),value:this.getContentValue(eJ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return this.series.getOutliersField();if(t===eJ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case eJ.MIN:return this.series.getMinField();case eJ.MAX:return this.series.getMaxField();case eJ.MEDIAN:return this.series.getMedianField();case eJ.Q1:return this.series.getQ1Field();case eJ.Q3:return this.series.getQ3Field();case eJ.SERIES_FIELD:return this.series.getSeriesField()}return null};getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===eJ.OUTLIER)return e[tJ];if(t===eJ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case eJ.MIN:return e[this.series.getMinField()];case eJ.MAX:return e[this.series.getMaxField()];case eJ.MEDIAN:return e[this.series.getMedianField()];case eJ.Q1:return e[this.series.getQ1Field()];case eJ.Q3:return e[this.series.getQ3Field()];case eJ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null};contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t);getOutlierFillColor=t=>{const e=this.series.getOutliersStyle();return e?.fill??this.series.getMarkInName("outlier").getAttribute("fill",t)};isOutlierMark=t=>c(t[tJ])}class sJ extends KK{static type=R$.boxPlot;type=sJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"}}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?($N("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerFunctionEncoder(iW).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),qV("barBoxplotScaleIn",ZV(eW)),qV("barBoxplotScaleOut",JV(eW))):($N("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerFunctionEncoder(tW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),qV("boxplotScaleIn",ZV(QV)),qV("boxplotScaleOut",JV(QV)));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,t??i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}class rJ extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),size:1,shape:z$.circle,fill:void 0,lineWidth:0}}}class aJ extends rJ{static type=R$.symbol;type=aJ.type}wK.useMark([sJ,aJ]);class oJ extends Oq{static type=tq.boxPlot;type=tq.boxPlot;static mark={...Lq.mark,[QK.boxPlot]:{name:QK.boxPlot,type:R$.boxPlot},[QK.outlier]:{name:QK.outlier,type:R$.symbol}};_minField;getMinField(){return this._minField}_maxField;getMaxField(){return this._maxField}_q1Field;getQ1Field(){return this._q1Field}_medianField;getMedianField(){return this._medianField}_q3Field;getQ3Field(){return this._q3Field}_outliersField;getOutliersField(){return this._outliersField}_lineWidth;_boxWidth;_shaftShape;getShaftShape(){return this._shaftShape}_shaftWidth;_boxFillColor;getBoxFillColor(){return this._boxFillColor}_strokeColor;getStrokeColor(){return this._strokeColor}_shaftFillOpacity;_outliersStyle;getOutliersStyle(){return this._outliersStyle}_outlierDataView;_autoBoxWidth;setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec.boxPlot?.style??{};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=t.lineWidth??2,this._boxWidth=t.boxWidth,this._shaftShape=t.shaftShape??"line",this._shaftWidth=t.shaftWidth,this._boxFillColor=t.boxFill,this._strokeColor=t.stroke,this._shaftFillOpacity="bar"===this._shaftShape?t.shaftFillOpacity??.5:void 0,this._outliersStyle=this._spec.outliersStyle}_boxPlotMark;_outlierMark;initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(oJ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(oJ.mark.outlier,{progressive:t,key:YX,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){const t=this._boxPlotMark;if(t){const e={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:this._boxFillColor??("line"===this._shaftShape?"#FFF":this.getColorAttribute()),minMaxFillOpacity:this._shaftFillOpacity,stroke:this._strokeColor??("line"===this._shaftShape?this.getColorAttribute():"#000")},i=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),...e,boxWidth:()=>this._boxWidth??this._getMarkWidth(),ruleWidth:()=>this._shaftWidth??this._getMarkWidth(),q1q3Width:()=>this._boxWidth??this._getMarkWidth(),minMaxWidth:()=>this._shaftWidth??this._getMarkWidth()}:{y:this.dataToPositionY.bind(this),...e,boxHeight:()=>this._boxWidth??this._getMarkWidth(),ruleHeight:()=>this._shaftWidth??this._getMarkWidth(),q1q3Height:()=>this._boxWidth??this._getMarkWidth(),minMaxHeight:()=>this._shaftWidth??this._getMarkWidth()};this.setMarkStyle(t,i,yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._outlierMark;e&&(this.setMarkStyle(e,{fill:this._outliersStyle?.fill??this.getColorAttribute(),size:v(this._outliersStyle?.size)?this._outliersStyle.size:10,shape:"circle"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e))}initBoxPlotMarkStyle(){const t=this._boxPlotMark,e=this._direction===Gh.vertical?this._yAxisHelper:this._xAxisHelper;if(t&&e){const{dataToPosition:i}=e,n=e?.getScale?.(0);this.setMarkStyle(t,{min:t=>Vh(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>Vh(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>Vh(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>Vh(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>Vh(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},yK.STATE_NORMAL,qX.Series)}const i=this._outlierMark;if(i&&e){const{dataToPosition:t}=e,n=e?.getScale?.(0),s=this._direction===Gh.vertical?{x:this.dataToPositionX.bind(this),y:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)}:{y:this.dataToPositionY.bind(this),x:e=>Vh(t(this.getDatumPositionValues(e,tJ),{bandPosition:this._bandPosition}),n)};this.setMarkStyle(i,s,yK.STATE_NORMAL,qX.Series)}}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"foldOutlierData",iJ),rK(this._dataSet,"addVChartProperty",uq);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===Gh.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._outlierDataView=new Tq(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===Gh.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===Gh.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){const t=t=>{const e=this._direction===Gh.vertical?this._fieldX[0]:this._fieldY[0],i=t?.[e],n=this._viewDataStatistics?.latestData?.[e]?.values.indexOf(i);return n||0};if(this._boxPlotMark){const e=this._initAnimationSpec(NZ.boxPlot()),i=this._initAnimationSpec(GZ(QK.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(WZ(e,i,{dataIndex:t}))}if(this._outlierMark){const e={appear:this._spec.animationAppear?.symbol,disappear:this._spec.animationDisappear?.symbol,enter:this._spec.animationEnter?.symbol,exit:this._spec.animationExit?.symbol,update:this._spec.animationUpdate?.symbol};this._outlierMark.setAnimationConfig(WZ(NZ.symbol(),e,{dataIndex:t}))}}initTooltip(){this._tooltipHelper=new nJ(this)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}}class lJ{setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}initLineMark(t,e){return this._lineMark=this._createMark(hJ.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:e??!0,progressive:t}),this._lineMark}initLineMarkStyle(t,e){const i=this._lineMark;if(i){if(this.setMarkStyle(i,{stroke:this.getColorAttribute()},"normal",qX.Series),"polar"===this.coordinate)this.setMarkStyle(i,{lineJoin:"bevel",curveType:F$},"normal",qX.Series);else{const n=e??this.getSpec().line?.style?.curveType,s=n===O$?t===Gh.vertical?"monotoneX":"monotoneY":n;this.setMarkStyle(i,{curveType:s},"normal",qX.Built_In)}this._invalidType&&this.setMarkStyle(i,{defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.dimension.add(i)}return i}initSymbolMark(t){return this._symbolMark=this._createMark(hJ.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;return t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)),t}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this.dataToPositionZ.bind(this)}),this._invalidType&&this.setMarkStyle(t,{visible:t=>"break"===this._invalidType?il(t[this.getStackValueField()]):"link"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series))}}const hJ={[QK.point]:{name:QK.point,type:R$.symbol},[QK.line]:{name:QK.line,type:R$.line}};class cJ extends KK{setStyle(t,e="normal",i=0,n=this.stateStyle){if(h(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((c=>{const d=t[c];if(h(d)||s.includes(c))return;a&&r.includes(c)&&(Hl(d?.type)||d?.scale||l(d))&&(o=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),o&&this.setAttribute("enableSegments",!0,e,i,n)}}class dJ extends cJ{static type=R$.line;type=dJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:1}}_getIgnoreAttributes(){return this.model?.type===tq.radar&&"polar"===this.model?.coordinate?[]:["fill","fillOpacity"]}}wK.useMark([dJ,aJ,qZ]);class uJ extends Oq{static type=tq.line;type=tq.line;_invalidType="break";static mark={...Lq.mark,...hJ};initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this.initLineMark(t),this.initSymbolMark(t)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}getSeriesStyle(t){return e=>("fill"===e&&(e="stroke"),this._seriesMark?.getAttribute(e,t)??null)}}j(uJ,lJ);class pJ extends KK{static type=R$.rect3d;type=pJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),width:void 0,height:void 0,length:3}}}wK.useMark([pJ,qZ]);class gJ extends ZZ{static type=tq.bar3d;type=tq.bar3d;static mark={...Lq.mark,[QK.bar3d]:{name:QK.bar3d,type:R$.rect3d}};_barMarkName=QK.bar3d;_barMarkType=R$.rect3d}function fJ(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===Gh.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===Gh.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===Gh.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===Gh.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",qX.Series)}class mJ extends Sq{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class yJ extends ZZ{static type=tq.rangeColumn;type=tq.rangeColumn;_barMarkType=R$.rect;_barName=tq.bar;static mark={...ZZ.mark,[QK.minLabel]:{name:QK.minLabel,type:R$.text},[QK.maxLabel]:{name:QK.maxLabel,type:R$.text}};_stack=!1;_minLabelMark;_maxLabelMark;initMark(){const t=this._spec.label?.position;this._rectMark=this._createMark(yJ.mark.bar,{morph:XZ(this._spec.animation,this._spec.morph,GZ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:t===c$.bothEnd?void 0:L({},this._spec.label),isSeriesMark:!0}),!1!==this._spec.label?.visible&&t===c$.bothEnd&&(!1!==this._spec.label?.minLabel?.visible&&(this._minLabelMark=this._createMark(yJ.mark.minLabel,{markSpec:this._spec.label?.minLabel})),!1!==this._spec.label?.maxLabel?.visible&&(this._maxLabelMark=this._createMark(yJ.mark.maxLabel,{markSpec:this._spec.label?.maxLabel})))}initMarkStyle(){const t=this._rectMark;t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._minLabelMark,i=this._spec.label?.minLabel;if(e){this.setMarkStyle(e,{fill:i?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return i?.formatMethod?i.formatMethod(e,t):e}});fJ(this,e,i?.position??"end",i?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(e)}const n=this._maxLabelMark,s=this._spec.label?.maxLabel;if(n){this.setMarkStyle(n,{fill:s?.style?.fill??this.getColorAttribute(),text:t=>{const e=this._spec.direction===Gh.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return s?.formatMethod?s.formatMethod(e,t):e}});fJ(this,n,s?.position??"start",s?.offset??("vertical"===this._direction?-20:-25),(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),this._tooltipHelper?.ignoreTriggerSet.mark.add(n)}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===Gh.horizontal?(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.dataToPositionZ.bind(this)}),this._tooltipHelper?.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){const t=this._xAxisHelper?.getScale?.(0),e=this._yAxisHelper?.getScale?.(0),{dataToPosition:i}=this.direction===Gh.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===Gh.horizontal?this.setMarkStyle(this._rectMark,{x:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[0]),{bandPosition:this._bandPosition}),t),x1:e=>Vh(i(this.getDatumPositionValues(e,this._spec.xField[1]),{bandPosition:this._bandPosition}),t),y:t=>{const i=this.getYAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,n=zl(e.type||"band");return this.dataToPositionY(t)+.5*(i-this._rectMark.getAttribute("height",t))+(n?-i/2:0)},height:()=>this.getBarWidth(this._yAxisHelper)},"normal",qX.Series):this.setMarkStyle(this._rectMark,{x:t=>{const e=this.getXAxisHelper().getBandwidth?.(this._groups?this._groups.fields.length-1:0)??6,i=this._rectMark.getAttribute("width",t),n=zl(this.getXAxisHelper().getScale?.(0).type||"band");return this.dataToPositionX(t)+(e-i)/2+(n?-e/2:0)},y:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),e),y1:t=>Vh(i(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),e),width:()=>this.getBarWidth(this._xAxisHelper)},"normal",qX.Series)}initAnimation(){const t=t=>{const e=t?.[this._fieldX[0]],i=this._viewDataStatistics?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0},e=this._spec?.animationAppear?.preset;this._rectMark.setAnimationConfig(WZ(NZ.rangeColumn({direction:this.direction},e),GZ(QK.bar,this._spec),{dataIndex:t})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec),{dataIndex:t}))}initTooltip(){this._tooltipHelper=new mJ(this)}}wK.useMark([pJ]);class _J extends yJ{static type=tq.rangeColumn3d;type=tq.rangeColumn3d;_barMarkType=R$.rect3d;_barName=tq.bar3d}class vJ extends cJ{static type=R$.area;type=vJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}_getIgnoreAttributes(){return[]}}wK.useMark([dJ,vJ,qZ,aJ]);class bJ extends Oq{static type=tq.area;type=tq.area;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;_stack=!0;_invalidType="break";initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this._areaMark=this._createMark(bJ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:t,isSeriesMark:e}),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>Vh(this.dataToPositionY1(t),this._yAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>Vh(this.dataToPositionX1(t),this._xAxisHelper?.getScale?.(0)),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i)),this.initLineMarkStyle(this._direction,t),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._lineMark&&this._lineMark.setAnimationConfig(WZ(NZ.line(t,e),GZ(QK.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(WZ(NZ.area(t,e),GZ(QK.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(WZ(NZ.symbol(),GZ(QK.point,this._spec)))}}j(bJ,lJ);class xJ extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===Gh.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class SJ extends bJ{static type=tq.rangeArea;type=tq.rangeArea;static mark={...bJ.mark};initMark(){this._areaMark=this._createMark(SJ.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){const t=this.getSpec().area?.style?.curveType??this.getSpec().line?.style?.curveType,e=t===O$?this._direction===Gh.vertical?"monotoneX":"monotoneY":t,i=this._areaMark;i&&(this._direction===Gh.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",qX.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",qX.Series),this.setMarkStyle(i,{fill:this.getColorAttribute(),defined:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])},"normal",qX.Series),this.setMarkStyle(i,{curveType:e},"normal",qX.Built_In),this._trigger.registerMark(i),this._tooltipHelper.activeTriggerSet.dimension.add(i))}initTooltip(){this._tooltipHelper=new xJ(this)}}Ar();const wJ={},AJ=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function kJ(t,e){t&&f(t)||al("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(wJ[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Ar().projection(n),n.copy=n.copy||function(){const t=i();return AJ.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),wJ[i]||null}const MJ={albers:Wr,albersusa:function(){var t,e,i,n,s,r,a=Wr(),o=Vr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Vr().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(MJ).forEach((t=>{kJ(t,MJ[t])}));const CJ="Feature",TJ="FeatureCollection";function EJ(t){const e=N(t);return 1===e.length?e[0]:{type:TJ,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===TJ?t.features:N(t).filter((t=>!h(t))).map((t=>t.type===CJ?t:{type:CJ,geometry:t}))}(e))),[])}}const PJ=AJ.concat(["pointRadius","fit","extent","size"]);function RJ(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{PJ.includes(n)&&(i=i.concat(LN(t[n],e)))})),i):i}const BJ=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(s){const t=s.length;l=function(e){const i=o.get(e[n]);if(h(i))for(let i=0;i(l(t),t)))};class IJ extends Lq{type=tq.geo;coordinate="geo";_mapViewData;getMapViewData(){return this._mapViewData.getDataView()}_mapViewDataStatistics;_nameField;get nameField(){return this._nameField}set nameField(t){this._nameField=t}_valueField;get valueField(){return this._valueField}set valueField(t){this._valueField=t}_coordinateHelper;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){let e=null;if(!t)return e;const{dataToPosition:i,latitudeField:n,longitudeField:s}=this._coordinateHelper;if(e=this.nameToPosition(t),null===e){const r=s?t?.[s]:Number.NaN,a=n?t?.[n]:Number.NaN;e=i?.([r,a])??null}return e}nameToPosition(t){const e=this._getDatumName(t);if(h(e))return null;const i=this.getMapViewData()?.latestData?.filter((t=>this._getDatumName(t)===e))[0];if(h(i))return null;const{dataToPosition:n}=this._coordinateHelper,s=this._getDatumCenter(i),r=n?.(s);return h(r)||isNaN(r.x)||isNaN(r.y)?null:r}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){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}dataToPositionZ(t){throw new Error("Method not implemented.")}release(){super.release(),this._mapViewData.release(),this._mapViewData=this._mapViewDataStatistics=null}getStackGroupFields(){return[this._nameField]}getStackValueField(){return this._spec.valueField}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){this._mapViewData?.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${Kj}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){return this._seriesField?this._mapViewDataStatistics?.latestData[this._seriesField]?.values??this._rawDataStatistics?.latestData[this._seriesField].values??[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){super.fillData(),this._mapViewData.getDataView()?.reRunAllTransform(),this._mapViewDataStatistics?.reRunAllTransform()}}const DJ=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{t[YX]=i,e.nameMap?t.name=e.nameMap[t.properties?.[e.nameProperty]]:t.name=t.properties?.[e.nameProperty]})),t.features);class LJ extends Sq{titleValueCallback=t=>{const e=this.series;return this._getDimensionData(t)??t.properties?.[`${e.getNameProperty()}`]}}class OJ extends KK{static type=R$.path;type=OJ.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0,path:""}}}var FJ,zJ,HJ;wK.useMark([OJ,qZ]),FJ="projection",zJ=class extends CW{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return h(this.spec.pointRadius)||this.detach(LN(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(LN(t,this.view)),this.commit(),this}size(t){return h(this.spec.size)||this.detach(LN(this.spec.size,this.view)),this.spec.size=t,this.attach(LN(t,this.view)),this.commit(),this}extent(t){return h(this.spec.extent)||this.detach(LN(this.spec.extent,this.view)),this.spec.extent=t,this.attach(LN(t,this.view)),this.commit(),this}fit(t){return h(this.spec.fit)||this.detach(LN(this.spec.fit,this.view)),this.spec.fit=t,this.attach(LN(t,this.view)),this.commit(),this}configure(t){return this.detach(RJ(this.spec,this.view)),h(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(RJ(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=kJ((t||"mercator").toLowerCase());return e||al("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),AJ.forEach((t=>{var i,n,s;h(this.spec[t])||(i=this.projection,n=t,s=FN(this.spec[t],e,kJ),l(i[n])&&i[n](s))})),h(this.spec.pointRadius)||this.projection.path.pointRadius(FN(this.spec.pointRadius,e,kJ)),!(h(this.spec.fit)||h(this.spec.extent)&&h(this.spec.size))){const t=EJ(FN(this.spec.fit,e,kJ));this.spec.extent?this.projection.fitExtent(FN(this.spec.extent,e,kJ),t):this.spec.size&&this.projection.fitSize(FN(this.spec.size,e,kJ),t)}return this.projection}output(){return this.projection}},HJ="projections",yX[FJ]={grammarClass:zJ,specKey:null!=HJ?HJ:FJ};class jJ extends IJ{static type=tq.map;type=tq.map;static mark={...Lq.mark,[QK.area]:{name:QK.area,type:R$.path}};map;_nameMap;getNameMap(){return this._nameMap}_nameProperty="name";getNameProperty(){return this._nameProperty}_areaCache=new Map;_pathMark;_labelMark;setAttrFromSpec(){if(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.map)throw new Error(`map type '${this.map}' is not specified !`);if(!oK.get(this.map))throw new Error(`'${this.map}' data is not registered !`)}initData(){super.initData(),rK(this._dataSet,"copyDataView",dK),rK(this._dataSet,"map",DJ),rK(this._dataSet,"lookup",BJ);const t=oK.get(this.map);if(!t)throw Error("no valid map data found!");const e=new Vo(this._dataSet);e.parse([t],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>this._data?.getLatestData(),key:"name",fields:this._nameField,values:[this.nameField,this.valueField,this._seriesField??$X,XX],as:[this.nameField,this.valueField,this._seriesField??$X,XX]}}),this._data?.getDataView().target.addListener("change",e.reRunAllTransform),this._mapViewData=new Tq(this._option,e)}initMark(){this._pathMark=this._createMark(jJ.mark.area,{morph:XZ(this._spec.animation,this._spec.morph,GZ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),this._spec.label?.visible&&(this._labelMark=this._createMark(jJ.mark.label,{parent:this.getRegion().getGroupMark(),skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>c(t[this._seriesField??$X])?(this._option.globalScale.getScale("color")??this.getDefaultColorScale()).scale(t[this._seriesField??$X]):this._spec?.defaultFillColor,path:this.getPath.bind(this)},"normal",qX.Series),t.setPostProcess("fill",(t=>c(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",qX.Built_In),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._labelMark;e&&this.setMarkStyle(e,{text:t=>this._getDatumName(t),x:t=>this.dataToPosition(t)?.x,y:t=>this.dataToPosition(t)?.y})}initAnimation(){this._pathMark.setAnimationConfig(WZ(NZ.path(),GZ(QK.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initTooltip(){this._tooltipHelper=new LJ(this)}getPath(t){const e=this._areaCache.get(t[YX]);if(e)return e.shape;const i=this._coordinateHelper?.shape(t);return this._areaCache.set(t[YX],{shape:i}),i}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return t?.map===i&&t?.nameMap===n&&t?.valueField===s&&t?.nameProperty===r||(a.reRender=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===R$.path?n.group.getGroupGraphicItem().scale(e,e,i):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===R$.path?i.group.getGroupGraphicItem().translate(e[0],e[1]):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){return b(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:t.properties?.center?t.properties.center:t.properties?.centroid?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){return t[this.nameField]?t[this.nameField]:t.properties?.[this._nameProperty]?this._spec.nameMap?this._spec.nameMap[t.properties[this._nameProperty]]??"":t.properties[this._nameProperty]??"":""}dataToPositionX(t){throw new Error("Method not implemented.")}dataToPositionY(t){throw new Error("Method not implemented.")}viewDataUpdate(t){super.viewDataUpdate(t),this._mapViewData?.getDataView()?.reRunAllTransform(),this._mapViewData?.updateData()}_getDataIdKey(){return YX}}class NJ extends Lq{coordinate="polar";_outerRadius=kN;get outerRadius(){return this._outerRadius}_innerRadius=0;get innerRadius(){return this._innerRadius}_angleField=[];getAngleField(){return this._angleField}setAngleField(t){return this._angleField=c(t)?N(t):[],this._angleField}_radiusField=[];getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=c(t)?N(t):[],this._radiusField}_innerRadiusField;get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=N(t),this._innerRadiusField}_radiusScale;get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}_angleScale;get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}_angleAxisHelper;get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}_radiusAxisHelper;get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){if(h(t)||h(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(N(t)),n=this.radiusAxisHelper.dataToPosition(N(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){const t=[];return this.radiusAxisHelper?.getScale&&this._radiusField.forEach((e=>{const i={key:e,operations:[]};zl(this.radiusAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),this.angleAxisHelper?.getScale&&this._angleField.forEach((e=>{const i={key:e,operations:[]};zl(this.angleAxisHelper.getScale(0).type)?i.operations=["max","min"]:i.operations=["values"],t.push(i)})),t}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),c(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),c(this._spec.radius)&&(this._outerRadius=this._spec.radius),c(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return Go(t.angleField,i)&&Go(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}}const VJ=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e,p=i.reduce(((t,e)=>Number.parseFloat(e[n])+t),0),g=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n]))),-1/0),f=r-s;let m=s;return i.forEach((t=>{const e=Number.parseFloat(t[n])/p,i=e*f;c&&(t[c]=e),a&&(t[a]=m),o&&(t[o]=m+i),l&&(t[l]=m+i/2),h&&(t[h]=i),d&&(t[d]=function(t){return(t=xl(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}(m+i/2)),u&&(t[u]=Number.parseFloat(t[n])/g),m=t[o]})),i[i.length-1][o]=r,i},WJ=(t,e)=>{const i=t[0].latestData;return new UJ(e.series,i).updateLabels()};class GJ{key;refDatum;center;outerCenter;labelSize;labelPosition;labelLimit;labelVisible;lastLabelY;labelYRange;labelText;pointB;pointC;quadrant;radian;middleAngle;k;constructor(t,e,i,n,s,r,a){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.k=a,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class UJ{_series;_data;_ellipsisWidth=0;_arcLeft=new Map;_arcRight=new Map;_textMeasure;constructor(t,e){this._series=t,this._data=e,this._textMeasure=b$(this._getMeasureSpec())}updateLabels(){const t=this._series.getLabelConfig();return t?.visible?(this._setArcs(),this._layoutLabels(),this._setLabelData()):null}_setArcs(){const t=this._series.getRadiusField()[0],e=this._series.getRadius(),i=this._series.getLabelConfig(),n=i.line.line1MinLength;if(i?.visible){this._clearArcs();const r=this._series.computeRadius(e),a=this._series.center,o=this._series.getViewData?.()?.latestData;let l;if(o.length<=1)l=o.slice();else switch(i?.showRule){case"headAndTail":l=[o[0],o[o.length-1]];break;case"max":l=[o.reduce(((e,i)=>e[t]>i[t]?e:i),o[0])];break;case"min":l=[o.reduce(((e,i)=>e[t]e[t]>i[t]?e:i),o[0]),o.reduce(((e,i)=>e[t]{const n=this._getArc(i),s={...i};if(!n)return s[eN]=!1,s;const{labelPosition:r,labelLimit:a,labelSize:o,pointB:l,pointC:c}=n;if("inside"!==t?.position){const t=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_HOVER),n.middleAngle),i=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_SELECTED),n.middleAngle),a=kl(e.x,e.y,this._series.computeDatumRadius(s,yK.STATE_NORMAL),n.middleAngle);s[cN]=a.x,s[dN]=a.y,s[lN]=t.x,s[hN]=t.y,s[mN]=i.x,s[yN]=i.y,s[uN]=l.x,s[pN]=l.y,s[gN]=c.x,s[fN]=c.y,s[nN]=r.y-o.height/2}else s[nN]=r.y;return s[Qj]=this._computeAlign(n),s[Jj]=Math.max(a,0),s[eN]=n.labelVisible&&!h(n.labelText),s[iN]=r.x,s[tN]=n.labelText,s}))}_layoutLabels(){const t=this._series.getLabelConfig(),e=Array.from(this._arcLeft.values()),i=Array.from(this._arcRight.values());"inside"===t?.position?(this._layoutInsideLabels(i),this._layoutInsideLabels(e)):(this._layoutOutsideLabels(i),this._layoutOutsideLabels(e))}_layoutInsideLabels(t){const e=this._series.center,i=this._series.getInnerRadius(),n=this._series.getRadius(),s=this._series.getLabelConfig(),r=s.spaceWidth;t.forEach((t=>{const{labelSize:a,radian:o}=t,l=this._series.computeRadius(i,1),h=this._series.computeRadius(n),c=function(t,e){return e>2*t?NaN:2*Math.asin(e/2/t)}(h,a.height);let d;if(o=Math.PI?l:Math.max(l,a.height/2/Math.tan(o/2)),d=h-t-r}!0!==s?.rotate&&(d=h-r);const u=this._getFormatLabelText(t.refDatum,d);t.labelText=u;const p=Math.min(d,this._measureTextSize(u).width),g=this._computeAlign(t),f=h-r-("left"===g?p:"right"===g?0:p/2);t.labelPosition=kl(e.x,e.y,f,t.middleAngle),t.labelLimit=p,at(p,0)||(t.labelVisible=!1)}))}_layoutOutsideLabels(t){const{height:e}=this._getPlotLayout(),i=this._series.getLabelConfig(),n=i.line.line2MinLength,s=i.layout,r=i.spaceWidth;if(t.forEach((t=>{const e=Ml(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+n+r),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==i.coverEnable||"none"===s.strategy){for(const e of t){const{labelPosition:t,labelSize:i}=e;e.labelLimit=i.width,e.pointB=Ml(e.quadrant)?{x:t.x+i.width/2+n+r,y:t.y}:{x:t.x-i.width/2-n-r,y:t.y},this._computeX(e)}!1===i.coverEnable&&"none"===s.strategy&&this._coverLabels(t)}else{const n=e/(i.style?.fontSize||16);this._adjustY(t,n);const{minY:s,maxY:r}=t.reduce(((t,i)=>{const{y1:n,y2:s}=i.getLabelBounds();return t.minY=Math.max(0,Math.min(n,t.minY)),t.maxY=Math.min(e,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(e/2-s),Math.abs(r-e/2)),o=this._computeLayoutRadius(a);for(const e of t)this._computePointB(e,o),this._computeX(e)}const{width:a}=this._getPlotLayout();t.forEach((t=>{t.labelVisible&&(ot(t.pointB.x,n+r)||at(t.pointB.x,a-n-r))&&(t.labelVisible=!1)}))}_coverLabels(t){if(t.length<=1)return;let e=t[0].getLabelBounds();for(let i=1;i0?i.width-u.x:u.x)-a-l;"labelLine"===o&&(f=(p+r+a)*g+e.x,m=(g>0?i.width-f:f)-l);const y=this._getFormatLabelText(t.refDatum,m);t.labelText=y;let _=Math.min(m,this._measureTextSize(y).width);switch(o){case"labelLine":break;case"edge":f=g>0?i.width-_-l:_+l;break;default:f=u.x+g*a}if(_=Math.max(this._ellipsisWidth,_),t.pointC={x:f,y:c.y},"edge"===o){const t=this._computeAlignOffset(h,_,-g);c.x=g>0?i.width+t:t}else{const t=this._computeAlignOffset(h,_,g);c.x=f+t+g*l}t.labelLimit=_}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_adjustY(t,e){const i=this._getPlotLayout(),n=this._series.getLabelConfig().layout;if("vertical"===n.strategy){let e,n=0;const s=t.length;if(s<=0)return;for(let i=0;i=0&&t[e].getLabelBounds().y2>i.height;e--)t[e].labelVisible=!1}else if("none"!==n.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 r=1/0,a=-1/0;for(let o=0;oi?e.labelPosition.y=i-u.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,u,c)}else if(-1!==h&&-1===c){const i=d.labelPosition.y;ln?(e.labelPosition.y=n-u.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,d,e,s[o].originIndex)):lp[1].x&&p.reverse(),p[0].x<0?bl(p[0].y,p[1].y)?Math.abs(t.middleAngle)=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e=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}_computeAlign(t){const e=this._series.getLabelConfig(),i=e.style?.textAlign??e.style?.align,n=e.layout?.textAlign??e.layout?.align;return"inside"!==e.position?h(i)||"auto"===i?"edge"===n?Ml(t.quadrant)?"left":"right":Ml(t.quadrant)?"right":"left":i:h(i)||"auto"===i?"center":i}_getFormatLabelText(t,e){const i=this._series.getLabelConfig().style?.text,n=this._series.getSeriesField(),s=this._series.getAngleField()[0],r=h(n)||h(t[n])||h(t[s]);return l(i)?r?null:i.call(null,t,{}):r?null:t[n]}_getMeasureSpec(){return{...this._series.getLabelConfig().style,textAlign:"center"}}_measureTextSize(t){const e=this._textMeasure.quickMeasure(t);return{width:Math.ceil(e.width)+1,height:e.height}}_getPlotLayout(){return this._series.getRegion().getLayoutRect()}}class YJ extends KK{type=XJ.type;_unCompileChannel={centerOffset:!0,radiusOffset:!0};constructor(t,e){super(t,e),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{...super._getDefaultStyle(),startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0}}computeOuterRadius=(t,e,i="normal",n,s)=>s+(this._computeAttribute("radiusOffset",e,i,n)??0);computeCenter=(t,e,i="normal",n,s)=>s+Al({angle:e[_N],radius:this._computeAttribute("centerOffset",e,i,n)})[t]}class XJ extends YJ{static type=R$.arc;type=XJ.type}wK.useMark([OJ,qZ,XJ]);class $J extends NJ{_pieMarkName=QK.pie;_pieMarkType=R$.arc;static mark={...Lq.mark,[QK.pie]:{name:QK.pie,type:R$.arc},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_viewDataLabel;_center;get center(){return{x:this._spec?.centerX??this._region.getLayoutRect().width/2,y:this._spec?.centerY??this._region.getLayoutRect().height/2}}_centerOffset;_cornerRadius;_startAngle=xN;_endAngle=SN;_padAngle;_pieMark=null;_labelMark=null;_labelLineMark=null;setAttrFromSpec(){super.setAttrFromSpec(),this._centerOffset=this._spec?.centerOffset??0,this._cornerRadius=this._spec?.cornerRadius??0;const t=function(t,e){let i=0,n=2*Math.PI;const s=c(t),r=c(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}}(c(this._spec?.startAngle)?Sl(this._spec.startAngle):this._startAngle,c(this._spec?.endAngle)?Sl(this._spec.endAngle):this._endAngle);this._startAngle=t.startAngle,this._endAngle=t.endAngle,this._padAngle=c(this._spec?.padAngle)?Sl(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;rK(this._dataSet,"pie",VJ),rK(this._dataSet,"arcLabel",WJ),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:rN,asEndAngle:aN,asRatio:sN,asMiddleAngle:_N,asRadian:bN,asQuadrant:vN,asK:oN}},!1);const e=new Vo(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${Kj}_series_${this.id}_viewDataLabel`,e.transform({type:"arcLabel",options:{series:this}},!1),this._viewDataLabel=new Tq(this._option,e)}initMark(){if(this._pieMark=this._createMark({...$J.mark.pie,name:this._pieMarkName,type:this._pieMarkType},{morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0}),this._spec?.label?.visible){const t=this.getSpec();this._labelMark=this._createMark($J.mark.label,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label}}),this._labelLineMark=this._createMark($J.mark.labelLine,{dataView:this._viewDataLabel.getDataView(),dataProductId:this._viewDataLabel.getProductId(),skipBeforeLayouted:!0,themeSpec:this._theme?.label?.line,support3d:t?.label?.support3d,markSpec:{visible:!0,...this.getSpec()?.label?.line}})}}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,fill:this.getColorAttribute(),outerRadius:Wh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:Wh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark;e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this)},void 0,qX.User_Mark),this._trigger.registerMark(e));const i=this._labelLineMark;i&&(this.setMarkStyle(i,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal")}),this.setMarkStyle(i,this.generateLinePath("hover"),"hover"),this.setMarkStyle(i,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(i))}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){super.initEvent(),this._viewDataLabel.getDataView()?.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(VX.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){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}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${Kj}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${Kj}_ARC_LABEL_${e}_AY`])} L${Math.round(t[uN])},${Math.round(t[pN])} L${Math.round(t[gN])},${Math.round(t[fN])}`}}getRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.outerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.outerRadius)??this._outerRadius}getInnerRadius(t="normal"){return("normal"===t?this.getSpec()[this._pieMark?.name||"pie"]?.style?.innerRadius:this.getSpec()[this._pieMark?.name||"pie"]?.state?.[t]?.innerRadius)??this._innerRadius}getLabelConfig(){return{visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6,...this._spec.label,style:{visible:!0,...this._spec.label?.style},line:{visible:!0,line1MinLength:this._spec.label?.line?.line1MinLength??20,line2MinLength:this._spec.label?.line?.line2MinLength??10,...this._spec.label?.line},layout:{align:"arc",strategy:"priority",tangentConstraint:!0,...this._spec.label?.layout}}}computeRadius(t,e){return this.computeLayoutRadius()*t*(h(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return t?.centerX===i&&t?.centerY===n&&t?.centerOffset===s&&t?.radius===r&&t?.innerRadius===a&&t?.cornerRadius===o&&t?.startAngle===l&&t?.endAngle===h&&t?.padAngle===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=Al({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}dataToCentralPosition=t=>{const e=t[_N];if(h(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=Al({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}};initAnimation(){const t={growFrom:(t,e,i)=>{if(i===fK.appear)return this._startAngle;if(i===fK.disappear)return this._endAngle;const n=[fK.disappear,fK.exit],s=e.mark.elements,r=t,a=r?.[YX];if(void 0===s.find((t=>t.data[0]?.[YX]t.data[0]?.[YX]>a)))return this._endAngle;const o=s.findLast((t=>t.data[0]?.[YX]t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}},{duration:n,effects:{easing:s,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Al({angle:e[_N],radius:i}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Al({angle:e[_N],radius:i}).y}}}}]}}(this._pieMark,i.normal)),this._pieMark.setAnimationConfig(i)}this._labelMark&&(this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec))),this._labelLineMark&&this._labelLineMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.labelLine,this._spec))))}getDefaultShapeType(){return"square"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class KJ extends $J{static type=tq.pie;type=tq.pie}class qJ extends YJ{static type=R$.arc3d;type=qJ.type}wK.useMark([OJ,qZ,qJ]);class ZJ extends $J{static type=tq.pie3d;type=tq.pie3d;_pieMarkName=QK.pie3d;_pieMarkType=R$.arc3d;static mark={...Lq.mark,[QK.pie3d]:{name:QK.pie3d,type:R$.arc3d},[QK.labelLine]:{name:QK.labelLine,type:R$.path}};_angle3d;setAttrFromSpec(){super.setAttrFromSpec(),this._angle3d=this._spec?.angle3d??-Math.PI/3}initMarkStyle(){const t=this._pieMark;if(t){this.setMarkStyle(t,{x:()=>this._center?.x??this._region.getLayoutRect().width/2,y:()=>this._center?.y??this._region.getLayoutRect().height/2,beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:Ol(rN).bind(this),endAngle:Ol(aN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",qX.Series);const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,qX.User_Mark);this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}const e=this._labelMark,i=this.getSpec(),n={};i?.label?.support3d&&(n.beta=-Math.PI/3,n.anchor3d=t=>[(this._center?.x??this._region.getLayoutRect().width/2)-Ol(iN).bind(this)(t),(this._center?.y??this._region.getLayoutRect().height/2)-Ol(nN).bind(this)(t)]),e&&(this.setMarkStyle(e,{visible:Ol(eN).bind(this),x:Ol(iN).bind(this),y:Ol(nN).bind(this),text:Ol(tN).bind(this),fill:this._spec.label?.style?.fill||this.getColorAttribute(),textAlign:Ol(Qj).bind(this),textBaseline:"inside"===this._spec.label?.position?"middle":"top",angle:t=>{const e=t[_N];return"inside"===this._spec.label?.position?wl(e):0},limit:Ol(Jj).bind(this),...n},void 0,qX.User_Mark),this._trigger.registerMark(e));const s=this._labelLineMark;s&&(this.setMarkStyle(s,{visible:Ol(eN).bind(this),stroke:this._spec.label?.line?.style?.stroke||this.getColorAttribute(),lineWidth:1,...this.generateLinePath("normal"),...n,anchor3d:()=>[this._center?.x??this._region.getLayoutRect().width/2,this._center?.y??this._region.getLayoutRect().height/2]}),this.setMarkStyle(s,this.generateLinePath("hover"),"hover"),this.setMarkStyle(s,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(s))}}const JJ=[10,20],QJ=Fl.Linear,tQ="circle",eQ=Fl.Ordinal,iQ=["circle","square","triangle","diamond","star"];wK.useMark([aJ,qZ]);class nQ extends Oq{static type=tq.scatter;type=tq.scatter;static mark={...Lq.mark,[QK.point]:{name:QK.point,type:R$.symbol}};_invalidType="break";_symbolMark;_size;_sizeField;_shape;_shapeField;setAttrFromSpec(){super.setAttrFromSpec(),this._size=this._spec.size,this._sizeField=this._spec.sizeField,this._shape=this._spec.shape,this._shapeField=this._spec.shapeField}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t)}_getSeriesAttribute(t,e,{defaultScaleType:i,defaultRange:n},s){if(l(e))return e;if(m(e)){if(h(t))throw new Error(`${s}Field is required.`);if(e.length>2)throw new Error(`${s} length is invalid, specify up to 2 ${s}s.`);const n=`${Kj}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(d(e)){if(h(t))throw new Error(`${s}Field is required.`);const r={id:`${Kj}_series_scatter_${this.id}_scale_${s}`,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n,...e};return this._option.globalScale.registerModelScale(r),{scale:r.id,field:t}}throw new Error(`${s} attribute is invalid.`)}getSizeAttribute(t,e){return h(e)?10:v(e)?e:!f(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:QJ,defaultRange:JJ},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return h(e)?tQ:f(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:eQ,defaultRange:iQ},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(nQ.mark.point,{morph:XZ(this._spec.animation,this._spec.morph,GZ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:L({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._symbolMark.setAnimationConfig(WZ(NZ.scatter({},t),GZ(QK.point,this._spec)))}initSymbolMarkStyle(){const t=this._symbolMark;t&&(this.setMarkStyle(t,{visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()])}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this.dataToPositionZ.bind(this),fill:this.getColorAttribute(),size:v(this._size)||l(this._size)?this._size:10,shape:f(this._shape)||l(this._shape)?this._shape:tQ},yK.STATE_NORMAL,qX.Series),(c(this._sizeField)||c(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},yK.STATE_NORMAL,qX.User_Mark),(c(this._shapeField)||c(this._shape))&&this.setMarkStyle(t,{shape:this.getShapeAttribute(this._shapeField,this._shape)},yK.STATE_NORMAL,qX.User_Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],visible:t=>"break"!==this._invalidType||il(t[this.getStackValueField()]),z:this.dataToPositionZ.bind(this)},yK.STATE_NORMAL,qX.Series)}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}}class sQ extends NJ{getStackGroupFields(){return this._angleField}getStackValueField(){return N(this._spec.valueField)[0]||N(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(JX),this.setInnerRadiusField(ZX)}setValueFieldToPercent(){this.setRadiusField(t$),this.setInnerRadiusField(QX)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}wK.useMark([XJ,qZ]);class rQ extends sQ{static type=tq.rose;type=tq.rose;static mark={...ZZ.mark,[QK.rose]:{name:QK.rose,type:R$.arc}};_stack=!0;_roseMark=null;_labelMark=null;initMark(){this.initRoseMark(),this.initLabelMark()}initMarkStyle(){this.initRoseMarkStyle(),this.initLabelMarkStyle()}initRoseMark(){this._roseMark=this._createMark(rQ.mark.rose,{morph:XZ(this._spec.animation,this._spec.morph,GZ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initLabelMark(){this._spec?.label?.visible&&(this._labelMark=this._createMark(rQ.mark.label,{themeSpec:this._theme?.label,markSpec:{visible:!0,...this.getSpec()?.label}}))}getRoseAngle(){return this.angleAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0)??.5}initRoseMarkStyle(){const t=this._roseMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{if(!this._stack)return 0;const e=Vh(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return e<=Number.MIN_VALUE?this._computeLayoutRadius()*(this._spec.innerRadius??0):e}}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initLabelMarkStyle(){const t=this._labelMark;if(t){let e=0,i=0;this.setMarkStyle(t,{visible:!0,x:t=>{const n=this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields())),s=.5*this.angleAxisHelper.getBandwidth(0),r=n-s,a=n+this.getRoseAngle()-s;return e=(r+a)/2,i=Vh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0))-(this._spec.label?.style?.size||10)/2,this.angleAxisHelper.center().x+i*Math.cos(e)},y:()=>this.angleAxisHelper.center().y+i*Math.sin(e),text:t=>t[this._radiusField[0]],stroke:this._spec.label?.style?.stroke||this.getColorAttribute(),angle:()=>this._spec.label?.style?.angle||(wl(e)??0)+90},void 0,qX.User_Mark),this._trigger.registerMark(t)}}initAnimation(){const t=this._spec?.animationAppear?.preset;if(this._roseMark){const e={innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0)};this._roseMark.setAnimationConfig(WZ(NZ.rose(e,t),GZ(QK.rose,this._spec)))}}}wK.useMark([vJ,dJ,aJ,qZ]);class aQ extends sQ{static type=tq.radar;type=tq.radar;static mark={...Lq.mark,...hJ,[QK.area]:{name:QK.area,type:R$.area}};_areaMark;initGroups(){}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},e=!1!==this._spec.area?.visible&&!1!==this._spec.area?.style?.visible;this.initAreaMark(t,e),this.initLineMark(t,!e),this.initSymbolMark(t)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(aQ.mark.area,{progressive:t,isSeriesMark:e})}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._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):0).y},fill:this.getColorAttribute(),curveType:F$},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.dimension.add(t))}initAnimation(){const t={center:()=>this.angleAxisHelper?.center(),radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:Sl(this._spec.startAngle)??xN,pointToCoord:t=>this.angleAxisHelper?.pointToCoord(t),coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},e=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===e&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.radarGroup(t,e),GZ(QK.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([i,n])=>{if(c(i)){const s=NZ[n];i.setAnimationConfig(WZ(s(t,e),GZ(i.name,this._spec)))}}))}}j(aQ,lJ);class oQ extends Sq{updateTooltipSpec(){super.updateTooltipSpec(),c(this.spec?.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>Wo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const lQ=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];s?.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},hQ={fill:"#bbb",fillOpacity:.2};wK.useMark([aJ,qZ,JZ,KZ]);class cQ extends Oq{static type=tq.dot;type=tq.dot;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.grid]:{name:QK.grid,type:R$.rule},[QK.gridBackground]:{name:QK.gridBackground,type:R$.rect},[QK.dot]:{name:QK.dot,type:R$.symbol},[QK.title]:{name:QK.title,type:R$.text},[QK.subTitle]:{name:QK.subTitle,type:R$.text},[QK.symbol]:{name:QK.symbol,type:R$.symbol}};_xDimensionStatisticsDomain;_seriesGroupField;getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){c(t)&&(this._seriesGroupField=t)}_titleField;getTitleField(){return this._titleField}setTitleField(t){c(t)&&(this._titleField=t)}_subTitleField;getSubTitleField(){return this._subTitleField}setSubTitleField(t){c(t)&&(this._subTitleField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_highLightSeriesGroup;getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){c(t)&&(this._highLightSeriesGroup=t)}_gridBackground;setGridBackground(t){c(t)&&(this._gridBackground=t)}initData(){super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),rK(this._option.dataSet,"objFlat",lQ),rK(this._option.dataSet,"copyDataView",dK),aK(this._option.dataSet,"dataview",Fo),this.getViewDataFilter()?.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){c(t)&&(this._seriesField=t,this.getMarksInType([R$.line,R$.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){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(L(hQ,this._spec?.grid?.background||{}))}_clipMark;_containerMark;_gridBackgroundMark;_gridMark;_dotMark;_titleMark;_subTitleMark;_symbolMark;initMark(){this._clipMark=this._createMark(cQ.mark.group),this._containerMark=this._createMark(cQ.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(cQ.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(cQ.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(cQ.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(cQ.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(cQ.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(cQ.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",qX.Series),e.setInteractive(!1));const i=this._gridBackgroundMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i));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",qX.Series),this._trigger.registerMark(n));const s=this._dotMark;s&&(this.setMarkStyle(s,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",qX.Series),this._trigger.registerMark(s),this._tooltipHelper?.activeTriggerSet.mark.add(s));const r=this._titleMark;r&&(this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(r));const a=this._subTitleMark;a&&(this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",qX.Series),this._trigger.registerMark(a));const o=this._symbolMark;o&&(this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(o))}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){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e,getScale:i}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})i(0).range()[1]?0:this._theme?.dot?.style?.fillOpacity??1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){return this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._seriesGroupField??this._seriesField??$X}}getDotColorScale(){const t=this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesGroupField?this._viewDataStatistics?.latestData[this._seriesGroupField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[],e=Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(t).range(e)}getDotColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDotColorScale(),field:this._dotTypeField??this._seriesGroupField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new oQ(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){return this._dotMark?.getData()}_getDataIdKey(){}}class dQ extends Sq{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>Wo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}wK.useMark([JZ,aJ]);class uQ extends Oq{static type=tq.link;type=tq.link;static mark={...Lq.mark,[QK.group]:{name:QK.group,type:R$.group},[QK.link]:{name:QK.link,type:R$.rule},[QK.arrow]:{name:QK.arrow,type:R$.symbol}};_fromField;getFromField(){return this._fromField}setFromField(t){c(t)&&(this._fromField=t)}_toField;getToField(){return this._toField}setToField(t){c(t)&&(this._toField=t)}_dotTypeField;getDotTypeField(){return this._dotTypeField}setDotTypeField(t){c(t)&&(this._dotTypeField=t)}_dotSeriesSpec;getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){c(t)&&(this._dotSeriesSpec=t)}initData(){super.initData();rK(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];n?.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{t[this._fromField+"_xField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=s?.[t[this._fromField]]?.[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=s?.[t[this._toField]]?.[this._dotSeriesSpec.yField]})),i})),this.getViewDataFilter()?.transform({type:"linkDotInfo",options:"dots"},!1)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFromField(this._spec.fromField),this.setToField(this._spec.toField),this.setDotTypeField(this._spec.dotTypeField),this.setDotSeriesSpec(this._spec.dotSeriesSpec)}_clipMark;_containerMark;_linkMark;_arrowMark;initMark(){this._clipMark=this._createMark(uQ.mark.group),this._containerMark=this._createMark(uQ.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(uQ.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(uQ.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",qX.Series),t.setInteractive(!1));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",qX.Series),e.setInteractive(!1));const i=this._linkMark;i&&(this.setMarkStyle(i,{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",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._arrowMark;if(n){const t=this._theme?.arrow?.style?.size??10;this.setMarkStyle(n,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,shape:t=>this.isPositionYFromHigher(t)?z$.triangleDown:z$.triangleUp},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){return this._dotTypeField?this._viewDataStatistics?.latestData[this._dotTypeField].values:this._seriesField?this._viewDataStatistics?.latestData[this._seriesField].values:[]}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this._dotTypeField??this._seriesField??$X}}initTooltip(){this._tooltipHelper=new dQ(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){return(this._linkMark??this._arrowMark)?.getData()}}class pQ extends NJ{_stack=!0;_startAngle;_endAngle;setAttrFromSpec(){super.setAttrFromSpec();const t=this._option.globalInstance.getChart()?.getSpec();this._startAngle=Sl(this._spec.startAngle)??Sl(t?.startAngle)??xN,this._endAngle=Sl(this._spec.endAngle)??Sl(t?.endAngle)??SN,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){return this._angleField?.[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==n?.gradient||c(n?.startAngle)||c(n?.endAngle)||(e[i]={...n,startAngle:this._startAngle,endAngle:this._endAngle})}return e}_getAngleValueStart(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[ZX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=Vh(this.angleAxisHelper.dataToPosition([t[JX]]),this.angleAxisHelper.getScale(0));if(b(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class gQ extends YJ{static type=R$.arc;static constructorType=R$.progressArc;_cacheStateStyle={};_getDefaultStyle(){return{...super._getDefaultStyle(),innerPadding:0,outerPadding:0}}_filterStyle(t,e,i,n=this.stateStyle){c(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),c(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const s=t.innerPadding??n[e].innerPadding.style,r=t.outerPadding??n[e].outerPadding.style,a=t.innerRadius??this._cacheStateStyle[e].innerRadius.style??n[e].innerRadius.style,o=t.outerRadius??this._cacheStateStyle[e].outerRadius.style??n[e].outerRadius.style;if(0===a&&0===o)return t;const h=c(t.innerPadding)&&c(a)||c(t.outerPadding)&&c(o),d=c(t.innerRadius)&&s||c(t.outerRadius)&&r;if(h||d){const e=Object.assign({},t);return s&&c(a)&&(l(a)?e.innerRadius=(t,e,i,n)=>a(t,e,i,n)+(l(s)?s(t,e,i,n):s):l(s)?e.innerRadius=(t,e,i,n)=>{const r=s(t,e,i,n);return a+r}:e.innerRadius=a+s),r&&c(o)&&(l(o)?e.outerRadius=(t,e,i,n)=>o(t,e,i,n)-(l(r)?r(t,e,i,n):r):l(r)?e.outerRadius=(t,e,i,n)=>{const s=r(t,e,i,n);return o-s}:e.outerRadius=o-r),e}return t}}wK.useMark([XJ,gQ]);class fQ extends pQ{static type=tq.circularProgress;type=tq.circularProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.progressArc},[QK.progress]:{name:QK.progress,type:R$.progressArc}};_progressMark=null;_trackMark=null;getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(fQ.mark.track),this._progressMark=this._createMark(fQ.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){const t=this._progressMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.radiusAxisHelper.getBandwidth?.(this._groups?this._groups.fields.length-1:0);if(b(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){const t=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}}class mQ extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}wK.useMark([KZ]);class yQ extends Oq{static type=tq.linearProgress;type=tq.linearProgress;static mark={...Lq.mark,[QK.track]:{name:QK.track,type:R$.rect},[QK.progress]:{name:QK.progress,type:R$.rect},[QK.group]:{name:QK.group,type:R$.group}};_progressMark=null;_trackMark=null;_progressGroupMark=null;initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(yQ.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){const t=this._progressMark;if(t){if("vertical"===this._spec.direction){const e=this._spec.progress?.leftPadding??0,i=this._spec.progress?.rightPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0)),height:()=>this._yAxisHelper?.dataToPosition([0],{bandPosition:this._bandPosition}),width:this._spec.bandWidth-e-i,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const e=this._spec.progress?.topPadding??0,i=this._spec.progress?.bottomPadding??0;this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition}),y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2+e,height:this._spec.bandWidth-e-i,width:()=>this._xAxisHelper?.dataToPosition([1],{bandPosition:this._bandPosition}),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}}initTrackMark(){return this._trackMark=this._createMark(yQ.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>Vh(this.dataToPositionX(t),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}):this.setMarkStyle(t,{x:0,y:t=>Vh(this.dataToPositionY(t),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:this._spec.track?.style?.fill}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(yQ.mark.group),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{const t=[];return this._rawData?.rawData.forEach(((e,i)=>{if("vertical"===this._spec.direction){const i=Vh(this.dataToPositionX(e),this._xAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleY.range()[0];t.push(hB({x:i,y:0,height:n,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=Vh(this.dataToPositionY(e),this._yAxisHelper?.getScale?.(0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];t.push(hB({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),t}},"normal",qX.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){const t={direction:this.direction},e=this._spec?.animationAppear?.preset;this._progressMark.setAnimationConfig(WZ(NZ.linearProgress(t,e),GZ(QK.progress,this._spec))),this._trackMark.setAnimationConfig(WZ(NZ.progressBackground(),GZ(QK.track,this._spec)))}initTooltip(){this._tooltipHelper=new mQ(this)}}const _Q=[0],vQ=[20,40],bQ=[200,500],xQ={shrink:!1,enlarge:!1,fontSizeLimitMin:0},SQ=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],wQ={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:AQ,triangle:AQ,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 AQ(){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 kQ(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const MQ=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function CQ(t){return l(t)?t:function(){return t}}class TQ{constructor(t){var e,i;switch(this.options=Object.assign({},TQ.defaultOptions,t),l(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>wQ[t]?wQ[t]():wQ.circle())(this.options.shape),this.getText=null!==(e=CQ(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=CQ(this.options.fontWeight),this.getTextFontSize=CQ(this.options.fontSize),this.getTextFontStyle=CQ(this.options.fontStyle),this.getTextFontFamily=CQ(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=CQ(this.options.color)}if(h(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=l(this.options.rotate)?t=>{var e;return Gt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Gt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!h(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class PQ extends TQ{constructor(t){var e;super(Object.assign({},PQ.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.spiral=f(this.options.spiral)?null!==(e=EQ[this.options.spiral])&&void 0!==e?e:EQ.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=CQ(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:n}=kQ(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,m;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 y=a.getImageData(0,0,(s<<5)/o,r/o).data,_=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=y[(h+m)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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*(this._originSize[0]/this._size[0])>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));for(this.data=r;s>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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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>=n)s&&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(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(IQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}DQ(p,this._size)&&(p=LQ(p,this._size))}else if(DQ(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||BQ(p,i))&&(!i||!RQ(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function RQ(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function BQ(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,DQ=(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 LQ(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const m=Math.ceil(g/this.gridSize),y=Math.ceil(f/this.gridSize);g=m*this.gridSize,f=y*this.gridSize;const _=-u/2,v=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,_,v);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:_,fillTextOffsetY:v,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),U(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!1)}};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:n}=kQ(this.options.shape,[e.width,e.height]);this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}FQ.defaultOptions={enlarge:!1};const HQ={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jQ=(t,e)=>{var i,n,s,r,a,o,l;if(t.size&&(!t.size[0]||!t.size[1]))return e;const h=e,c=null!==(i=t.size)&&void 0!==i?i:[500,500],d=t.fontFamily?NQ(t.fontFamily):"sans-serif",u=t.fontStyle?NQ(t.fontStyle):"normal",p=t.fontWeight?NQ(t.fontWeight):"normal",g=t.rotate?NQ(t.rotate):0,f=NQ(t.text),m=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",y=t.padding?NQ(t.padding):1,_=null!==(s=t.shape)&&void 0!==s?s:"square",b=null!==(r=t.shrink)&&void 0!==r&&r,x=null!==(a=t.enlarge)&&void 0!==a&&a,S=null!==(o=t.clip)&&void 0!==o&&o,w=null!==(l=t.minFontSize)&&void 0!==l?l:0,A=t.randomVisible,k=t.as||HQ,M=t.depth_3d,C=t.postProjection;let T=t.fontSize?NQ(t.fontSize):14;const E=t.fontSizeRange;if(E&&!v(T)){const t=T;T=e=>VQ(t(e),WQ(t,h),E)}let P=PQ;"fast"===t.layoutType?P=FQ:"grid"===t.layoutType&&(P=OQ);const R=new P({text:f,padding:y,spiral:m,shape:_,rotate:g,fontFamily:d,fontStyle:u,fontWeight:p,fontSize:T,shrink:b,clip:S,enlarge:x,minFontSize:w,random:A,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:R}:R.output()},NQ=t=>f(t)||v(t)||l(t)?t:e=>e[t.field],VQ=(t,e,i)=>(Math.sqrt(t)-Math.sqrt(e[0]))/(Math.sqrt(e[1])-Math.sqrt(e[0]))*(i[1]-i[0])+i[0],WQ=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function GQ(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),XQ=(t,e)=>{let i=0;for(const e of t)YQ(e)?i+=1:i+=.53;return i};function $Q(t){return x(t)?new Promise(((e,i)=>{const n=pB({image:t});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(t);r&&"success"===r.state&&r.data?e(r.data):i(new Error("image load failed"+t))}else i(new Error("image load failed"+t))},n.failCallback=()=>{We.getInstance().error("image 加载失败!",t)}})):null}var KQ=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 qQ(t){return KQ(this,void 0,void 0,(function*(){const{shapeUrl:e,size:i,tempCanvas:n,tempCtx:s,removeWhiteBorder:r}=t;let a=yield $Q(e);r&&(a=yield function(t,e,i){return KQ(this,void 0,void 0,(function*(){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&JQ(s,n,a-1);)--a;for(;oo&&QQ(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),yield $Q(e.toDataURL("imgage/png"))}))}(a,n,s));const o=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(a,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(a,o.x,o.y,o.width,o.height);const l=s.getImageData(0,0,i[0],i[1]),h=new Array(i[0]*i[1]).fill(0);let c=1;const d=[[0,1],[1,0],[-1,0],[0,-1]];let u=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==h[n*i[0]+s]||ZQ(l,n,s)||(h[n*i[0]+s]=c,u.push([n,s]))}c++,u=[]}const p={},g={},f={},m={},y={},_={},v={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tm[n][1]&&(m[n][1]=t),em[n][3]&&(m[n][3]=e),ev.x2&&(v.x2=e),tv.y2&&(v.y2=t)),g[n]=g[n]||0,g[n]++)}const b=[];for(const t in p){const e=p[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);f[t]=[i,n],b.push(...e);const[s,r,a,o]=m[t];y[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),_[t]=(o-a)/(r-s)}const x=Object.keys(f).map((t=>({label:t-1,boundary:p[t],area:g[t],center:f[t],maxPoint:m[t],maxR:y[t],ratio:_[t]})));v.width=v.x2-v.x1+1,v.height=v.y2-v.y1+1;const S=~~(b.reduce(((t,e)=>t+e[0]),0)/b.length),w=~~(b.reduce(((t,e)=>t+e[1]),0)/b.length),A=~~Math.max(Math.sqrt((S-v.x1)**2+(w-v.y1)**2),Math.sqrt((S-v.x2)**2+(w-v.y2)**2),Math.sqrt((S-v.x1)**2+(w-v.y2)**2),Math.sqrt((S-v.x2)**2+(w-v.y1)**2)),k=v.width/v.height,M=Object.keys(g).reduce(((t,e)=>t+g[e]),0),C={regions:x,labels:h,labelNumber:c-1};return Object.assign(t,{segmentation:C,shapeConfig:o,shapeBounds:v,shapeMaxR:A,shapeRatio:k,shapeCenter:[S,w],shapeArea:M});function T(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===h[r*i[0]+a])return!0}return!1}}))}function ZQ(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function JQ(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&v>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==y&&(y=e,_=v),v*=m,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*m})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===y){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/v})),i.skip=!0,v=_,y=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||n0(e,t,r)))return i0(e,t,r),!0}return!1}function i0(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function n0(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function s0(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,m;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(m=0;m0){const e=1<<31-f%32;o[a*m+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(md&&(d=m))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function r0(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?t0(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=r0(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,m=Math.min(r,t.length);let y=0;t.length>m&&(y=t.sort(((t,e)=>e.weight-t.weight))[m-1].weight);let _=0,v=1,b=!1;for(let r=0;r=y&&_++,_>=m&&!b){v*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,_=0;break}}else{if(a.weight>=y&&v>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),v/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=y)return t0(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=v,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){s0(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,m&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!n0(i,y,_)&&(i0(i,y,_),k.push(Object.assign({},i)),++c===s.length&&(c=0,m&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}))}var l0=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())}))};const h0={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},c0=(t,e,i,n)=>l0(void 0,void 0,void 0,(function*(){var i,s,r;if(t.size&&(!t.size[0]||!t.size[1]))return e;t.shape||al("WordcloudShape shape must be specified."),t.text||al("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(UQ.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||h0;if(!a||0===a.length)return[];const l={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},h=gj.createCanvas({width:t.size[0],height:t.size[1]}),c=h.getContext("2d");c.textAlign="center",c.textBaseline="middle",l.tempCanvas=h,l.tempCtx=c;const d=t.size[0]+31>>5<<5;l.boardSize=[d,t.size[1]],l.random?l.randomGenerator=Math.random:l.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const u=yield qQ(l),p=t.colorMode||"ordinal",g={getText:f0(t.text),getFontSize:f0(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:p,getColor:t.colorField?f0(t.colorField):f0(t.text),getFillingColor:f0(t.fillingColorField),colorList:t.colorList||("ordinal"===p?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:f0(t.colorHexField),getFontFamily:f0(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:f0(t.padding||1),getFontStyle:f0(t.fontStyle||"normal"),getFontWeight:f0(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?f0(t.fontOpacity):()=>1};u0(a,g,u);const f={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:f0(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:f0(t.fillingFontStyle||"normal"),getFillingFontWeight:f0(t.fillingFontWeight||"normal"),getFillingPadding:f0(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},m=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=XQ(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,g,f,u);const{getText:y,getFontFamily:_,getFontStyle:v,getFontWeight:b,getPadding:x,getColor:S,getFillingColor:w,getColorHex:A,fontSizeScale:k,colorScale:M,fillingColorScale:C,getFontOpacity:T,rotateList:E}=g,P=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:y(e),fontFamily:_(e),fontWeight:b(e),fontStyle:v(e),rotate:E[~~(l.randomGenerator()*E.length)],fontSize:~~k(e),opacity:T(e),padding:x(e),color:A&&A(e)||M&&M(S(e))||"black",fillingColor:!w||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&m?void 0:A&&A(e)||C&&C(w(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),R=Math.max(...P.map((t=>t.fontSize)));P.forEach((t=>t.weight=t.fontSize/R)),P.sort(((t,e)=>e.weight-t.weight));const{fillingWords:B,successedWords:I,failedWords:D}=yield o0(P,f,u);let L,O;const F=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=e.rotate,r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=w?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&m?e.color:e.fillingColor:f.fillingColorList[~~(l.randomGenerator()*f.fillingColorList.length)],r[z]=e.text,r[H]=`${e.text}_${i}_fillingWords`,j.push(r)})),(null==n?void 0:n.emit)&&n.emit(UQ.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:I,failedWords:D}),F.concat(j)})),d0=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new Wl).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new Wl).domain(e).range(f).scale(t)}}else(new _h).domain(g0(h,t)).range([0,1]),1===g.length&&(g=[g[0],g[0]]),u=t=>"black",!c||(null===(a=n.colorField)||void 0===a?void 0:a.field)===(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)&&d||((new _h).domain(g0(c,t)).range([0,1]),1===f.length&&(f=[f[0],f[0]]),p=t=>"black");Object.assign(e,{colorScale:u,fillingColorScale:p})},u0=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new Mh).domain(g0(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&l(s)&&!n){const e=.5,[o,l]=(i.shapeArea,g0(s,t)),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=p0(h,i,!0);n=[~~(e*c),~~c];const d=(new Mh).domain(g0(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=p0(e,i,!1);a="function"==typeof(o=n)?o:function(){return o}}var o;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},p0=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=XQ(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},f0=t=>t?"string"==typeof t||"number"==typeof t?()=>t:l(t)?t:e=>e[t.field]:null,m0=`${Kj}_WORD_CLOUD_ANGLE`,y0=`${Kj}_WORD_CLOUD_FILLING_ANGLE`,_0=`${Kj}_WORD_CLOUD_WEIGHT`,v0=`${Kj}_WORD_CLOUD_TEXT`;wK.useMark([qZ]),TN("wordcloud",{transform:jQ,markPhase:"beforeJoin"},!0),TN("wordcloudShape",{transform:c0,markPhase:"beforeJoin"},!0);class b0 extends Lq{static mark={...Lq.mark,[QK.word]:{name:QK.word,type:R$.text},[QK.fillingWord]:{name:QK.fillingWord,type:R$.text}};_nameField;_valueField;setValueField(t){c(t)&&(this._valueField=t,this.setFontSizeRange(vQ))}_fontFamilyField;_fontWeightField;_fontStyleField;_colorHexField;_colorMode;_colorList;_rotateAngles;_fontWeightRange;_fontSizeRange=[10,10];setFontSizeRange(t){c(t)&&c(this._spec.valueField)&&(this._fontSizeRange=t)}_maskShape;_isWordCloudShape=!1;_keepAspect;_random;_fontPadding;_fillingFontPadding;_wordCloudConfig;_wordCloudShapeConfig;_padding;setAttrFromSpec(){super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=this._spec.colorMode??"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=this._spec.fontWeightRange??bQ,this._rotateAngles=this._spec.rotateAngles??_Q,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=this._spec.maskShape??"circle",this._keepAspect=this._spec.keepAspect,this._random=this._spec.random??true,this._fontPadding=this._spec?.word?.padding??this._theme?.wordCloud?.word?.padding??1,this._wordCloudConfig={drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:xQ,...this._spec.wordCloudConfig},this._wordCloudShapeConfig={fillingSeriesField:this.getSeriesField(),fillingRotateAngles:_Q,layoutMode:"default",...this._spec?.wordCloudShapeConfig},this._fillingFontPadding=this._spec?.fillingWord?.padding??this._theme?.wordCloud?.fillingWord?.padding??1,this._isWordCloudShape=!SQ.includes(this._maskShape)}_wordMark;_fillingWordMark;initMark(){this._wordMark=this._createMark(b0.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark,i=this._spec.word?.formatMethod?v0:this._nameField;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[i],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud(),GZ(QK.word,this._spec)))}getWordOrdinalColorScale(t,e){const i=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,n=t?this.getViewData()?.latestData.map((e=>e[t])):[],s=i??this._option.globalScale.getScale("color")?.range()??Ih(this._option.getTheme().colorScheme,this.type);return(new Hh).domain(n).range?.(s)}getWordColorAttribute(t,e){if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:this._seriesField??$X};let i=(e?this._colorList:this._wordCloudShapeConfig.fillingColorList)??this._option.globalScale.getScale("color").range();return 1===i.length&&(i=[i[0],i[0]]),t=>i[0]}compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",dataIndexKey:XX,size:[l.width(),l.height()],shape:this._maskShape,text:{field:this._spec.word?.formatMethod?v0:this._nameField},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:Zo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}}class x0 extends b0{static type=tq.wordCloud;type=tq.wordCloud}class S0 extends b0{static type=tq.wordCloud3d;type=tq.wordCloud3d;compile(){super.compile();const t=[],e=this._valueField,i=new _h,n=this._fontWeightRange,s=this._rotateAngles,r=this._fontWeightField,a=this._wordCloudShapeConfig.fillingRotateAngles;if(e){const[s,r]=gl(this.getViewData()?.latestData.map((t=>t[e])));i.domain([s,r],!0).range(n),t.push({type:"map",as:_0,callback:t=>s===r?i.scale(r):i.scale(t[e])})}t.push({type:"map",as:m0,callback:()=>s[Math.floor(Math.random()*s.length)]}),t.push({type:"map",as:y0,callback:()=>a[Math.floor(Math.random()*a.length)]}),this._spec.word?.formatMethod&&t.push({type:"map",as:v0,callback:this._spec.word.formatMethod});const o=this._spec.word?.formatMethod?v0:this._nameField,l=this.getCompiler().getVGrammarView();this._isWordCloudShape?t.push({type:"wordcloudShape",size:[l.width(),l.height()],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:s,fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:this._wordCloudShapeConfig?.fillingFontFamilyField??this._spec.word?.style?.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:this._wordCloudShapeConfig?.fillingFontStyleField??this._spec.word?.style?.fontStyle,fillingFontWeight:this._wordCloudShapeConfig?.fillingFontWeightField??this._spec.word?.style?.fontWeight,fillingRotateList:a,fillingTimes:this._wordCloudShapeConfig?.fillingTimes,fillingXStep:this._wordCloudShapeConfig?.fillingXStep,fillingYStep:this._wordCloudShapeConfig?.fillingYStep,fillingXRatioStep:this._wordCloudShapeConfig?.fillingXRatioStep,fillingYRatioStep:this._wordCloudShapeConfig?.fillingYRatioStep,fillingInitialOpacity:this._wordCloudShapeConfig?.fillingInitialOpacity,fillingDeltaOpacity:this._wordCloudShapeConfig?.fillingDeltaOpacity,fillingInitialFontSize:this._wordCloudShapeConfig?.fillingInitialFontSize,fillingDeltaFontSize:this._wordCloudShapeConfig?.fillingDeltaFontSize,ratio:this._wordCloudShapeConfig?.ratio,fillingRatio:this._wordCloudShapeConfig?.fillingRatio,removeWhiteBorder:this._wordCloudShapeConfig?.removeWhiteBorder,textLayoutTimes:this._wordCloudShapeConfig?.textLayoutTimes,fontSizeShrinkFactor:this._wordCloudShapeConfig?.fontSizeShrinkFactor,stepFactor:this._wordCloudShapeConfig?.stepFactor,layoutMode:this._wordCloudShapeConfig?.layoutMode,importantWordCount:this._wordCloudShapeConfig?.importantWordCount,globalShinkLimit:this._wordCloudShapeConfig?.globalShinkLimit,fontSizeEnlargeFactor:this._wordCloudShapeConfig?.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:this._wordCloudShapeConfig?.fillingDeltaFontSizeFactor}):(t.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[l.width()-this._padding?.left||0-this._padding?.right||0,l.height()-this._padding?.top||0-this._padding?.bottom||0],shape:this._maskShape,postProjection:this._spec.postProjection??"StereographicProjection",dataIndexKey:XX,text:{field:o},fontSize:e?{field:e}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:m0},fontFamily:this._fontFamilyField??this._spec.word?.style?.fontFamily,fontWeight:r?{field:r}:e?{field:_0}:null,fontStyle:this._fontStyleField??this._spec.word?.style?.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep}),this._wordMark.getProduct().transform(t)),this._data.getProduct().transform(t)}initMark(){this._wordMark=this._createMark(b0.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(b0.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){const t=this._wordMark,e=this._fillingWordMark;t&&this.setMarkStyle(t,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",qX.Series),e&&this.setMarkStyle(e,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>t.z??0,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(WZ(NZ.wordCloud3d((()=>{const t=this.getCompiler().getVGrammarView(),e=t.width()-this._padding?.left||0-this._padding?.right||0,i=t.height()-this._padding?.top||0-this._padding?.bottom||0,n=Math.max(e,i)/2;return{center:{x:n,y:n,z:this._spec.depth_3d??n},r:n}})),GZ(QK.fillingWord,this._spec)))}}const w0=(t,e)=>{const i=t.map((t=>({...t})));if(!i||0===i.length)return i;const{valueField:n,asTransformRatio:s,asReachRatio:r,asHeightRatio:a,asValueRatio:o,asNextValueRatio:l,asLastValueRatio:h,asLastValue:c,asCurrentValue:d,asNextValue:u,heightVisual:p=!1,isCone:g=!0,range:f}=e,m=i.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[n])||-1/0)),-1/0),y=i.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[n])||1/0)),1/0),_=[f?.min??y,f?.max??m];return i.forEach(((t,e)=>{const f=Number.parseFloat(t[n]),m=Number.parseFloat(i[e-1]?.[n]),y=Number.parseFloat(i[e+1]?.[n]),v=b(y*f)?y/f:null,x=b(f*f)?f/m:null;c&&(t[c]=m),u&&(t[u]=y),s&&(t[s]=v),r&&(t[r]=0===e?1:x),a&&(t[a]=!0===p?v:1/i.length),o&&(t[o]=f/_[1]),l&&(t[l]=e===i.length-1?g?0:t[o]:y/_[1]),h&&(t[h]=0===e?1:m/_[1]),d&&(t[d]=f)})),i},A0=(t,e)=>{const i=t[0]?.latestData?.map((t=>({...t})));return i&&0!==i.length?(i.shift(),i.forEach((t=>{t[e.asIsTransformLevel]=!0})),i):i},k0=`${Kj}_FUNNEL_TRANSFORM_RATIO`,M0=`${Kj}_FUNNEL_REACH_RATIO`,C0=`${Kj}_FUNNEL_HEIGHT_RATIO`,T0=`${Kj}_FUNNEL_VALUE_RATIO`,E0=`${Kj}_FUNNEL_LAST_VALUE_RATIO`,P0=`${Kj}_FUNNEL_NEXT_VALUE_RATIO`,R0=`${Kj}_FUNNEL_LAST_VALUE`,B0=`${Kj}_FUNNEL_CURRENT_VALUE`,I0=`${Kj}_FUNNEL_NEXT_VALUE`,D0=`${Kj}_FUNNEL_TRANSFORM_LEVEL`,L0=20;class O0 extends Sq{titleValueCallback=(t,e)=>{const i=this.series;return e?.mark?.name===QK.transform?"转化率":this._getDimensionData(t)??t.properties?.[`${i.getCategoryField()}`]};contentValueCallback=(t,e)=>{if(e?.mark?.name===QK.transform){const e=t?.[M0];return`${(100*e).toFixed(1)}%`}return this._getMeasureData(t)};contentKeyCallback=(t,e)=>{if(e?.mark?.name===QK.transform)return"转化率";const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return c(n[0])?t?.[n[0]]:t?.[s]}}class F0 extends KK{_getDefaultStyle(){return{...super._getDefaultStyle(),points:[]}}}class z0 extends F0{static type=R$.polygon;type=z0.type;_getDefaultStyle(){return{...super._getDefaultStyle(),lineWidth:0}}}wK.useMark([z0,qZ,JZ]);class H0 extends Lq{static type=tq.funnel;type=tq.funnel;_funnelMarkName=QK.funnel;_funnelMarkType=R$.polygon;_transformMarkName=QK.transform;_transformMarkType=R$.polygon;static mark={...Lq.mark,[QK.funnel]:{name:QK.funnel,type:R$.polygon},[QK.transform]:{name:QK.transform,type:R$.polygon},[QK.transformLabel]:{name:QK.transformLabel,type:R$.text},[QK.outerLabel]:{name:QK.outerLabel,type:R$.text},[QK.outerLabelLine]:{name:QK.outerLabelLine,type:R$.rule}};_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_viewDataTransform;_funnelAlign;_funnelOrient;_shape;_funnelMark=null;_funnelTransformMark=null;_labelMark=null;_transformLabelMark=null;_funnelOuterLabelMark={};setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=this._spec.funnelOrient??"top",this._shape=this._spec.shape??"trapezoid",this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;rK(this._dataSet,"funnel",w0),rK(this._dataSet,"funnelTransform",A0);const t=new Vo(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${Kj}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new Tq(this._option,t)}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:B0,asTransformRatio:k0,asReachRatio:M0,asHeightRatio:C0,asValueRatio:T0,asNextValueRatio:P0,asLastValueRatio:E0,asLastValue:R0,asNextValue:I0,range:{min:this._spec.range?.min??this.getViewDataStatistics().latestData?.[this.getValueField()]?.min,max:this._spec.range?.max??this.getViewDataStatistics().latestData?.[this.getValueField()]?.max}}}),this._viewDataTransform.getDataView()?.transform({type:"funnelTransform",options:{asIsTransformLevel:D0}})}initMark(){if(this._funnelMark=this._createMark({...H0.mark.funnel,name:this._funnelMarkName,type:this._funnelMarkType},{themeSpec:this._theme?.funnel,morph:XZ(this._spec.animation,this._spec.morph,GZ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark({...H0.mark.transform,name:this._transformMarkName,type:this._transformMarkType},{themeSpec:this._theme?.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.label?.visible&&(this._labelMark=this._createMark(H0.mark.label,{themeSpec:this._theme?.label,key:this._seriesField})),this._spec?.transformLabel?.visible&&(this._transformLabelMark=this._createMark(H0.mark.transformLabel,{themeSpec:this._theme?.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),this._spec?.outerLabel?.visible){const{line:t}=this._spec.outerLabel??{},{line:e}=this._theme?.outerLabel??{};this._funnelOuterLabelMark.label=this._createMark(H0.mark.outerLabel,{themeSpec:this._theme?.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(H0.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new O0(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){const t=this._funnelMark;t&&(this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>c(t[this._valueField]),fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._funnelTransformMark;e&&(this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",qX.Series),this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(i),this._tooltipHelper?.activeTriggerSet.mark.add(i));const n=this._transformLabelMark;n&&(this.setMarkStyle(n,{text:t=>`${(100*Ol(M0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",qX.Series),this._trigger.registerMark(n),this._tooltipHelper?.activeTriggerSet.mark.add(n));const s=this._funnelOuterLabelMark.label;s&&this.setMarkStyle(s,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",qX.Series);const r=this._funnelOuterLabelMark.line;r&&s&&this.setMarkStyle(r,{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",qX.Series)}initAnimation(){const t=this._spec?.animationAppear?.preset??"clipIn";"clipIn"===t&&this._rootMark&&this._rootMark.setAnimationConfig(WZ(NZ.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},t),GZ(QK.group,this._spec))),[this._labelMark,this._funnelOuterLabelMark?.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((e=>{e&&e.setAnimationConfig(WZ(NZ.funnel({},t),GZ(e.name,this._spec)))})),this._funnelOuterLabelMark?.line&&this._funnelOuterLabelMark.line.setAnimationConfig(WZ(NZ.label(),GZ(QK.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}initEvent(){super.initEvent(),this._viewDataTransform.getDataView()?.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[E0])/2:this._getSecondaryAxisLength(t[T0])/2,s=this._getSecondaryAxisLength(t[T0])/2):(n=this._getSecondaryAxisLength(t[T0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[P0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!t?.[D0]}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){const e=this.getViewData()?.latestData?.find?.((e=>e[this._categoryField]===t));return c(e)?this._getPolygonCenter(this.getPoints(e)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){const e=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,i=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,s=n?0:this._spec.gap??0,r=n?Math.max(0,e-1):0,a=(i-s*Math.max(0,e-1))/(e+.5*r);return t?n?.5*a:0:a}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){const e=this.getViewData().latestData?.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!c(e)||e<0)return{};const i=this.isTransformLevel(t),n=this._isHorizontal(),s=n?this.getLayoutRect().height:this.getLayoutRect().width,r=n?this.getLayoutRect().width:this.getLayoutRect().height,a=s/2;let o=0;const l=this._getMainAxisLength(),h=this._getMainAxisLength(!0);return o+=e*(l+h),o+=i?-h/2:l/2,!this._spec.isTransform&&this._spec.gap&&(o+=this._spec.gap*e),this._isReverse()&&(o=r-o),this._isHorizontal()?{x:o,y:a}:{x:a,y:o}}_getPolygonPoints(t,e,i,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=e?.limit;if(v(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){let e,i,n=this._spec.outerLabel?.position,s="center",r="middle";if(n=this._isHorizontal()?["top","bottom"].includes(n)?n:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(n)?n:"left"===this._funnelAlign?"right":"left",!1!==this._spec.outerLabel?.alignLabel)({x:e,y:i}=this._getPositionByData(t)),"left"===n?(e=0,s="left"):"right"===n?(e=this.getLayoutRect().width,s="right"):"top"===n?(i=0,r="top"):"bottom"===n&&(i=this.getLayoutRect().height,r="bottom");else{const{x2:a,y2:o}=this._computeOuterLabelLinePosition(t);e=a,i=o,"left"===n?(e-=5,s="right"):"right"===n?(e+=5,s="left"):"top"===n?(i-=5,r="bottom"):"bottom"===n&&(i+=5,r="top")}return{x:e,y:i,align:s,textBaseline:r}}_computeOuterLabelLimit(t){if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const e=this.getPoints(t),i=(Math.abs(e[0].x-e[1].x)+Math.abs(e[2].x-e[3].x))/2,n=this._labelMark?.getProduct()?.elements?.find((e=>e.data[0]?.[this.getCategoryField()]===t[this.getCategoryField()]))?.getBounds(),s=n?n.x2-n.x1:0;return this.getLayoutRect().width/2-Math.max(i/2,s/2)-L0-2*(this._spec.outerLabel?.spaceWidth??5)}_computeOuterLabelLinePosition(t){const e=this.getCategoryField(),i=this._funnelOuterLabelMark?.label?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds(),n=this._labelMark?.getProduct()?.elements?.find((i=>i.data[0]?.[e]===t[e]))?.getBounds();let s,r,a,o;if(this._isHorizontal()){const e=this._spec.outerLabel?.spaceWidth??5,n=this.getPoints(t),l=(Math.abs(n[0].y-n[1].y)+Math.abs(n[2].y-n[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(a=this._getPolygonCenter(n).y-l/2-e,o=!1!==this._spec.outerLabel?.alignLabel?i?.y2+e:a-e,s=this._getPolygonCenter(n).x,a-o{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",qX.Series)}}function V0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,m,y,_,v,b,x,S=e.value;for(;cy&&(y=h),x=f*f*b,_=Math.max(y/x,x/m),_>v){f-=h;break}v=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,l=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=U0(t.children,u.children,i+1,o,u,r);u.value=h(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,l=Math.max(e.maxDepth,l)}else u.isLeaf=!0,u.value=h(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:l,flattenIndex:o}},Y0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=Y0(t.children,e,t,s))})),n},X0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=X0(t.children,e,t,s)),s=e(t,n,i,s)})),s},$0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:V0,slice:W0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?W0:V0)(t,e,i,n,s)}};class K0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=m(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=m(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=m(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=m(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},K0.defaultOpionts,t);const i=this.options.nodeKey,n=l(i)?i:i?ll(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?G0(this.options.aspectRatio):null!==(e=$0[this.options.splitType])&&void 0!==e?e:$0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=U0(t,s,0,-1,null,this._getNodeKey);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(v(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(v(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)}))}}K0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const q0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class Z0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];V0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),q0);const n=m(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],n)return this._layoutLabel(t,o(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},Z0.defaultOpionts,t):Object.assign({},Z0.defaultOpionts);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+ml(this.options.center[0],t.width),n=t.y0+ml(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=m(r),l=o?r.map((t=>ml(t,s))):ml(r,s),c=m(a),d=this.options.gapRadius,u=c?a.map((t=>ml(t,s))):ml(a,s),p=Y(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return h(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:ih(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(m(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=ml(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(m(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=U0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("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=$t({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}Z0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const J0=4294967296;function Q0(t,e){let i,n;if(i1(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function i1(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function a1(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function o1(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function l1(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function h1(t){return{_:t,next:null,prev:null}}function c1(t,e){const i=(t=N(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];a1(s,n,r);let a,o,l,h,c,d,u,p=h1(n),g=h1(s),f=h1(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:m(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i,n,s,r,a;const o="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 h=[],c=U0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%J0)/J0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:o.x0+o.width/2,y:o.y0+o.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=l(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:g1.defaultOpionts.nodeSort;Y0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)Y0([u],d1(this.options.setRadius)),X0([u],u1(this._getPadding,.5,d)),Y0([u],p1(1,this._maxDepth));else{const t=Math.min(o.width,o.height);Y0([u],d1(g1.defaultOpionts.setRadius)),X0([u],u1(cl,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&X0([u],u1(this._getPadding,u.radius/t,d)),Y0([u],p1(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}g1.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const f1=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):f1(t.children,e,i)))})),e},m1=(t,e={})=>{if(!t)return[];const i=[];return f1(t,i,e),i},y1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new Z0(i).layout(t,{width:n,height:s})};class _1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}var v1;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(v1||(v1={}));const b1=(t,e)=>{const i=e.info(),n=e.keyField(),s=i?.key;if(h(s))return t;if(i.type===v1.DrillDown){return N(k$(t,s,n,"children"))}if(i.type===v1.DrillUp){const e=M$(t,s,n,"children");if(e)return N(e)}return t};class x1{pointerId;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(){}parserDragEvent(){return!0}}class S1{_lastScale=0;pointerId;clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const w1={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:x1},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:S1}};class A1{_drillParams;_drillInfo;_getTriggerEvent(t){const{mode:e}=this._drillParams;return w1[e]?.[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===un.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;rK(t,"drillFilter",b1),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{if(h(t.datum)||h(t.datum?.[n]))return void this.drillUp();this._hideTooltip();const i=t.datum[n],s=this._drillInfo?.path??[],r=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,i,n,"children");s[s.length-1]===r[r.length-1]?this.drillUp():this.drillDown(r)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!m(t)||M(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:v1.DrillDown},e().reRunAllTransform(),i.emit(VX.drill,{value:{path:t,type:v1.DrillDown},model:this}),t}drillUp(){const{getRawData:t,event:e}=this._drillParams,i=this._drillInfo?.path??[];if(!m(i)||M(i))return i;const n=i.pop();return this._drillInfo={key:n,path:i,type:v1.DrillUp},t().reRunAllTransform(),e.emit(VX.drill,{value:{path:i,type:v1.DrillUp},model:this}),i}}wK.useMark([XJ,qZ]);class k1 extends NJ{static type=tq.sunburst;type=tq.sunburst;static mark={...Lq.mark,[QK.sunburst]:{name:QK.sunburst,type:R$.arc}};_sunburstMark;_labelMark;_categoryField;_valueField;_centerX;_centerY;_offsetX;_offsetY;_startAngle;_endAngle;__innerRadius;__outerRadius;_gap;_labelLayout;_labelAutoVisible;_label;_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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),this._startAngle=Gt(this._spec.startAngle),this._endAngle=Gt(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),rK(this._dataSet,"sunburstLayout",y1),rK(this._dataSet,"flatten",m1),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[c(this._centerX)?this._centerX:this.getLayoutRect().width/2,c(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(k1.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t,this._trigger.registerMark(this._sunburstMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){h(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.y+(c(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(k1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{const e=this._labelAutoVisible;return d(e)&&!0===e.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(e?.circumference??10):this._spec.label.visible},x:t=>t.label?.x+(c(this._offsetX)?this._offsetX:0),y:t=>t.label?.y+(c(this._offsetY)?this._offsetY:0),textBaseline:t=>t.label?.textBaseline,textAlign:t=>t.label?.textAlign,angle:t=>t.label?.angle??0,fontSize:10,text:t=>t.name},yK.STATE_NORMAL,qX.Series)}initTooltip(){this._tooltipHelper=new _1(this)}initAnimation(){const t={animationInfo:()=>({innerRadius:this._computeRadius(N(this.__innerRadius))[0],outerRadius:this._computeRadius(N(this.__outerRadius))[0],startAngle:N(this._startAngle)[0],endAngle:N(this._endAngle)[0]})},e=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((i=>{i.setAnimationConfig(WZ(NZ.sunburst(t,e),GZ(i.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(m(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}}j(k1,A1);const M1=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new g1(i).layout(t,{width:n,height:s})};class C1 extends Sq{contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}wK.useMark([XJ,qZ]);class T1 extends Oq{static type=tq.circlePacking;type=tq.circlePacking;static mark={...Lq.mark,[QK.circlePacking]:{name:QK.circlePacking,type:R$.arc}};_categoryField;_valueField;_layoutPadding;_circlePacking;_label;_circlePackingMark;_labelMark;_drill;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(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,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();h(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"circlePackingLayout",M1),rK(this._dataSet,"flatten",m1),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();h(t?.dataSet)||(rK(t.dataSet,"addVChartProperty",uq),t.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){if(!1===this._circlePacking?.visible)return;const t=this._createMark(T1.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initCirclePackingMarkStyle(){h(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},yK.STATE_NORMAL,qX.Series)}_initLabelMark(){if(!1===this._label?.visible)return;const t=this._createMark(T1.mark.label,{isSeriesMark:!1});this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t)}_initLabelMarkStyle(){h(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},yK.STATE_NORMAL,qX.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initTooltip(){this._tooltipHelper=new C1(this)}initAnimation(){const t=this._spec?.animationAppear?.preset;this.getMarksInType(R$.arc).forEach((e=>{e.setAnimationConfig(WZ(NZ.circlePacking({},t),GZ(e.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}}j(T1,A1);const E1=t=>{let e=0;return t.forEach(((t,i)=>{var n;h(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=E1(t.children):t.value=0),e+=Math.abs(t.value)})),e};function P1(t){return t.depth}function R1(t,e){return e-1-t.endDepth}const B1=(t,e)=>t.y0-e.y0,I1={left:P1,right:R1,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?W(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:P1,end:R1};class D1{constructor(t){this._ascendingSourceBreadth=(t,e)=>B1(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B1(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D1.defaultOptions,t);const e=this.options.nodeKey,i=l(e)?e:e?ll(e):null;this._getNodeKey=i,this._alignFunc=l(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I1[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}))),r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];E1(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(h(s.source)||h(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&al("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,o=!1;if(f(e)){const t=ct(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),o=!0}else if(v(e)){if(r=e,v(i))a=i;else if(h(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}o=!0}else l(e)&&v(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}h(this.options.nodeSortBy)&&s.sort(B1),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B1),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D1(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},O1=(t,e)=>{if(!t||!e?.view||!m(t))return t;const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return t;t=t[0]?.latestData?t[0].latestData[0]:t[0];const n=new D1(e),s=[];return s.push(n.layout(t,i)),s},F1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].nodes??[]:[],z1=t=>t&&m(t)&&t[0]?.latestData&&t[0].latestData.length&&t[0].latestData[0]?t[0].latestData[0].links??[]:[];class H1 extends Sq{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(v(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class j1 extends KK{static type=R$.linkPath;type=j1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0}}_initProduct(t){$N("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rW).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),qV("linkPathGrowIn",aW),qV("linkPathGrowOut",oW),qV("linkPathUpdate",lW);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",t??e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}wK.useMark([KZ,j1,qZ]),TN("sankey",{transform:L1,markPhase:"beforeJoin"},!0);class N1 extends Oq{static type=tq.sankey;type=tq.sankey;static mark={...ZZ.mark,[QK.node]:{name:QK.node,type:R$.rect},[QK.link]:{name:QK.link,type:R$.linkPath}};_nodeMark;_linkMark;_labelMark;_nodeLayoutZIndex=r$.Node;_labelLayoutZIndex=r$.Label;_labelLimit;_nodesSeriesData;_linksSeriesData;_viewBox=new Vt;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??this._spec.categoryField),this._labelLimit=this._spec.label?.limit??100}initData(){if(super.initData(),this._viewDataFilter){rK(this._dataSet,"sankey",O1),this.addViewDataFilter({type:"sankey",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),direction:this._spec.direction,nodeAlign:this._spec.nodeAlign,nodeGap:this._spec.nodeGap,nodeWidth:this._spec.nodeWidth,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:this._spec.minNodeHeight,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const t=new jo;aK(t,"dataview",Fo),rK(t,"sankeyNodes",F1),rK(t,"addVChartProperty",uq);const e=new Vo(t);e.parse([this.getViewData()],{type:"dataview"}),e.transform({type:"sankeyNodes"}),e.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._nodesSeriesData=new Tq(this._option,e);const i=new jo;aK(i,"dataview",Fo),rK(i,"sankeyLinks",z1),rK(i,"addVChartProperty",uq);const n=new Vo(i);n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"sankeyLinks"}),n.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Iq.bind(this)}},!1),this._linksSeriesData=new Tq(this._option,n)}}initMark(){const t=this._createMark(N1.mark.node,{isSeriesMark:!0,key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(t.setZIndex(this._nodeLayoutZIndex),this._nodeMark=t);const e=this._createMark(N1.mark.link,{key:YX,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(e&&(this._linkMark=e),this._spec.label?.visible){const t=this._createMark(N1.mark.label,{key:YX,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){const t=this._nodeMark;t&&(this.setMarkStyle(t,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key)},yK.STATE_NORMAL,qX.Mark),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLinkMarkStyle(){const t=this._linkMark;t&&(this.setMarkStyle(t,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>this._spec.link?.style?.fill??this.getNodeOrdinalColorScale(t.source),direction:this._spec.direction??"horizontal"},yK.STATE_NORMAL,qX.Series),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_initLabelMarkStyle(){this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},yK.STATE_NORMAL,qX.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"center",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:t=>this._spec.label.limit??t.x1-t.x0,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>this._spec.node?.style?.fill??this.getNodeOrdinalColorScale(t.key),text:t=>t?.datum?t.datum[this._spec.categoryField]:"",limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},yK.STATE_NORMAL,qX.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._labelMark))}initAnimation(){const t={direction:this.direction,growFrom:()=>"horizontal"===this.direction?this._xAxisHelper?.getScale(0).scale(0):this._yAxisHelper?.getScale(0).scale(0)},e=this._spec?.animationAppear?.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(WZ(NZ.sankeyNode(t,e),GZ(QK.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(WZ(NZ.sankeyLinkPath(),GZ(QK.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(WZ(NZ.label(),GZ(QK.label,this._spec)))}initEvent(){super.initEvent(),this._spec.emphasis?.enable&&"adjacency"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:GX.mark},this._handleAdjacencyClick)),this._spec.emphasis?.enable&&"related"===this._spec.emphasis?.effect&&("hover"===this._spec.emphasis?.trigger?this.event.on("pointerover",{level:GX.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:GX.mark},this._handleRelatedClick))}_handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")&&this._handleLinkAdjacencyClick(e)};_handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")&&this._handleLinkRelatedClick(e)};_handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=s?.parents?"parents":"source";if(N(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=s?.parents?"parents":"source";if(s.source===e.target||N(s[r]).includes(e.source)&&N(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum.filter((t=>t.parents.some(((i,n)=>i.key===e.source&&t.parents[n+1]?.key===e.target)))).reduce(((t,e)=>t+e.value),0);t=i/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleNodeRelatedClick=t=>{const e=t.getDatum(),i=[e.key],n=[],s=this._nodeMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements,a=this._linkMark.getProduct();if(!a||!a.elements||!a.elements.length)return;a.elements.forEach(((t,s)=>{t.clearStates();const a=t.getDatum();if(N(a[a?.parents?"parents":"source"]).includes(e.key)){if(n.includes(a.key??a.index)||n.push(a.key??a.index),i.includes(a.source)||i.push(a.source),!i.includes(a.target)){i.push(a.target);let t=r.find((t=>t.data[0].key===a.target)).data[0].sourceLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.target))){i.push(t.target);const n=r.find((e=>e.data[0].key===t.target));e.push(n.data[0].targetLinks)}})),void(t=e)}}}else if(a.target===e.key&&(n.includes(a.key??a.index)||n.push(a.key??a.index),!i.includes(a.source))){i.push(a.source);let t=r.find((t=>t.data[0].key===a.source)).data[0].targetLinks;for(;t?.length>0;){const e=[];return t.forEach((t=>{if(!n.includes(t.key??t.index)&&(n.push(t.key??t.index),!i.includes(t.source))){i.push(t.source);const n=r.find((e=>e.data[0].key===t.source));e.push(n.data[0].targetLinks)}})),void(t=e)}}})),[this._linkMark].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{if(t.clearStates(),n.includes(t.getDatum().key??t.getDatum().index)){const i=t.getDatum();let n;if("parents"===(i?.parents?"parents":"source")){const t=i.datum.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0);n=t/i.value}t.addState("selected",{ratio:n})}else t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))};_handleLinkRelatedClick=t=>{[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}))};initTooltip(){this._tooltipHelper=new H1(this)}getNodeOrdinalColorScale(t){const e=this._nodesSeriesData.getDataView().latestData.map((t=>t.key)),i=this._option.globalScale.color?.range()??Ih(this._option.getTheme().colorScheme,this.type),n=new Hh;return n.domain(e).range?.(i),n.scale(t)}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){if(this._seriesField){const t=[];return this._nodesSeriesData?.getDataView().latestData.forEach((e=>{t.push(e[this._seriesField]??e.datum[this._seriesField])})),t}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}}const V1=(t,e)=>{if(!t||!e?.range)return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new K0(e).layout(t,i)},W1=(t,e)=>{let i={},n=e.fields;if(l(n)&&(n=n()),!n?.length||!t?.length)return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=m1(s);return i=Mq([{latestData:r}],e),i};class G1 extends Sq{get defaultShapeType(){return"square"}contentKeyCallback=t=>t?.[this.series.getDimensionField()[0]]}class U1{_clickEnable;_zoomableTrigger;_eventObj;_renderMode;initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,w1[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return w1[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;h(s)||Yh({x:r,y:a},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){w1[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){w1[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:GX.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:GX.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;h(s)&&h(r)||Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:GX.chart},(t=>{if(!t.event)return;const{event:n}=t;Yh({x:n.canvasX,y:n.canvasY},{...e.getLayoutRect(),...e.getLayoutStartPoint()})&&this._handleDrag(t,i)})),t.on("click",{level:GX.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){w1[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){w1[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:GX.model,filter:({model:e})=>e?.id===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:GX.model,filter:({model:e})=>e?.id===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:GX.chart,source:WX.chart},l),this._eventObj.off(n,{level:GX.chart,source:WX.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:GX.chart,source:WX.chart},l),this._eventObj.on(n,{level:GX.chart,source:WX.chart},o)}}wK.useMark([KZ,qZ]);class Y1 extends Oq{static type=tq.treemap;type=tq.treemap;static mark={...Lq.mark,[QK.nonLeaf]:{name:QK.nonLeaf,type:R$.rect},[QK.leaf]:{name:QK.leaf,type:R$.rect},[QK.nonLeafLabel]:{name:QK.nonLeafLabel,type:R$.text}};_leafMark;_nonLeafMark;_labelMark;_nonLeafLabelMark;_categoryField;getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}_valueField;getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}_maxDepth;_matrix;_viewBox=new Vt;_clickEnable=!0;_enableAnimationHook=this.enableMarkAnimation.bind(this);setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField??Pq),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new qt),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>this._spec.drillField??XX,getRawData:()=>this.getRawData()}),b(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),rK(this._dataSet,"treemap",V1),rK(this._dataSet,"flatten",m1),this.addViewDataFilter({type:"treemap",options:{range:()=>({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:this._spec.nonLeafLabel?.visible?this._spec.nonLeafLabel?.padding:0,labelPosition:this._spec.nonLeafLabel?.position,minVisibleArea:this._spec.minVisibleArea??10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return{...t,...e}}return t}}}))}_addDataIndexAndKey(){this._rawData?.dataSet&&(rK(this._rawData.dataSet,"addVChartProperty",uq),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:Bq,call:Dq.bind(this)}}))}_statisticRawData(){const t=`${Kj}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){rK(this._dataSet,"hierarchyDimensionStatistics",W1),rK(this._dataSet,"flatten",m1);const i=new Vo(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:Eq,operations:["max","min","values"]},{key:Pq,operations:["values"]}])}initMark(){const t=this._createMark(Y1.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(t),this._nonLeafMark=t,this._tooltipHelper?.activeTriggerSet.mark.add(t));const e=this._createMark(Y1.mark.leaf,{isSeriesMark:!0});if(e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e,this._trigger.registerMark(e),this._tooltipHelper?.activeTriggerSet.mark.add(e)),this._spec.label?.visible){const t=this._createMark(Y1.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}if(this._spec.nonLeafLabel?.visible){const t=this._createMark(Y1.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},yK.STATE_NORMAL,qX.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()},yK.STATE_NORMAL,qX.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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=>t.datum[t.depth]?.[this.getDimensionField()[0]],limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},yK.STATE_NORMAL,qX.Series)}initAnimation(){this.getMarksInType(R$.rect).forEach((t=>{t.setAnimationConfig(WZ(NZ.treemap(),GZ(t.name,this._spec)))})),this.getMarksInType(R$.text).forEach((t=>{t.setAnimationConfig(WZ(NZ.label(),GZ(t.name,this._spec)))}))}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 G1(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(hV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.enable()})),this.event.off(hV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{t.getProduct().animate?.disable()}))}getDefaultShapeType(){return"square"}}j(Y1,U1),j(Y1,A1),wK.useMark([OJ,KZ]);class X1 extends pQ{static type=tq.gaugePointer;type=tq.gaugePointer;static mark={...Lq.mark,[QK.pin]:{name:QK.pin,type:R$.path},[QK.pinBackground]:{name:QK.pinBackground,type:R$.path},[QK.pointer]:{name:QK.pointer,type:[R$.path,R$.rect]}};_pinMark=null;_pointerMark=null;_pinBackgroundMark=null;_pointerType;setAttrFromSpec(){super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===this._spec.pointer?.type?R$.rect:R$.path}initMark(){this._pinBackgroundMark=this._createMark(X1.mark.pinBackground),this._pointerMark=this._createMark({...X1.mark.pointer,type:this._pointerType},{isSeriesMark:!0}),this._pinMark=this._createMark(X1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:()=>{const{x:t}=this.angleAxisHelper.center();return t-this._getPointerWidth()*(e?.center?.[0]??0)},y:t=>{const{y:i}=this.angleAxisHelper.center();return i-this._getPointerHeight(t)*(e?.center?.[1]??0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===R$.path?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}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){const e=this._spec.pointer,i=this._radiusField[0];return c(this.radiusAxisHelper)&&c(i)?this.radiusAxisHelper.dataToPosition([t[i]])-(e?.innerPadding??0)-(e?.outerPadding??10):e.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){const e=this._spec.pointer,i=this._getPointerWidth()*(e?.center?.[0]??0),n=-this._getPointerHeight(t)*(e?.center?.[1]??0),s=this._getPointerAngle(t)-Math.PI/2,r=Math.cos(s),a=Math.sin(s);return{x:i*r+n*a,y:-(n*r-i*a)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){const t=this._spec?.animationAppear?.preset;this._pointerMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.pointer,this._spec)))}}wK.useMark([gQ]);class $1 extends pQ{static type=tq.gauge;type=tq.gauge;static mark={...Lq.mark,[QK.segment]:{name:QK.segment,type:R$.progressArc},[QK.track]:{name:QK.track,type:R$.progressArc}};_segmentMark=null;_trackMark=null;_stack=!1;_padAngle=0;setAttrFromSpec(){super.setAttrFromSpec(),this._padAngle=Sl(this._spec.padAngle??0)}initData(){super.initData();rK(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[s$]=t[this._angleField[0]],t[n$]=e>0?i[e-1][s$]:void 0})),i})),this.getViewDataFilter()?.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark($1.mark.track),this._segmentMark=this._createMark($1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){const t=this._segmentMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>this._computeLayoutRadius()*(this._spec.innerRadius??0),outerRadius:()=>this._computeLayoutRadius()*(this._spec.radius??this._spec.outerRadius??1),cap:this._spec.roundCap??!1,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(t),this._tooltipHelper?.activeTriggerSet.mark.add(t))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){return(c(t[n$])?this.angleAxisHelper.dataToPosition([t[n$]]):this._startAngle)+(this._spec.padAngle??0)/2}_getAngleValueEnd(t){return this.angleAxisHelper.dataToPosition([t[s$]])-(this._spec.padAngle??0)/2}initAnimation(){const t=this._spec?.animationAppear?.preset;this._segmentMark.setAnimationConfig(WZ(NZ.circularProgress({startAngle:this._startAngle},t),GZ(QK.segment,this._spec)))}}class K1 extends Sq{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return c(i)&&"dimension"===t&&(i.visible=!1),i}}class q1 extends rJ{static type=R$.cell;type=q1.type;_getDefaultStyle(){return{...super._getDefaultStyle(),padding:0}}}wK.useMark([q1,qZ]);class Z1 extends Oq{static type=tq.heatmap;type=tq.heatmap;static mark={...Lq.mark,[QK.cell]:{name:QK.cell,type:R$.cell},[QK.cellBackground]:{name:QK.cellBackground,type:R$.cell}};_cellMark;_backgroundMark;_fieldValue;getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=N(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(Z1.mark.cell,{morph:XZ(this._spec.animation,this._spec.morph,GZ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:L({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(Z1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",qX.Series),this._trigger.registerMark(this._cellMark),this._tooltipHelper?.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){const t=Ge(this._spec.cellBackground?.style?.padding??0);this.setMarkStyle(this._backgroundMark,{x:e=>{const i=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(e)-i/2+t[3]},y:e=>{const i=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(e)-i/2+t[0]},width:()=>this.getCellSize(this._xAxisHelper)-t[1]-t[3],height:()=>this.getCellSize(this._yAxisHelper)-t[0]-t[2]},"normal",qX.Series)}getColorAttribute(){return{scale:this._option.globalScale.getScale("color")??this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){const t=this._spec?.animationAppear?.preset;this._cellMark.setAnimationConfig(WZ(NZ.heatmap(t),GZ(QK.cell,this._spec),{dataIndex:t=>{const e=t?.[this._fieldX[0]],i=this.getViewDataStatistics()?.latestData?.[this._fieldX[0]]?.values.indexOf(e);return i||0}}))}getCellSize(t){return t.getBandwidth?.(0)??6}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new K1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}wK.useSeries([bJ]);class J1 extends rq{static type=eq.area;static view="singleDefault";type=eq.area;seriesType=tq.area;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line,area:t.area}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([ZZ]);class Q1 extends rq{static type=eq.bar;static view="singleDefault";type=eq.bar;seriesType=tq.bar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class t2 extends rq{static type=eq.bar3d;static view="singleDefault";type=eq.bar3d;seriesType=tq.bar3d}wK.useSeries([oJ]);class e2 extends rq{static type=eq.boxPlot;static view="singleDefault";type=eq.boxPlot;seriesType=tq.boxPlot;_getDefaultSeriesSpec(t){const e=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],i={...super._getDefaultSeriesSpec(t),boxPlot:t.boxPlot,direction:t.direction??Gh.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle};return i[i.direction===Gh.vertical?"yField":"xField"]=e,i}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),aq(t)}}wK.useSeries([T1]);class i2 extends sq{static type=eq.circlePacking;static view="singleDefault";type=eq.circlePacking;seriesType=tq.circlePacking;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField},i=tq.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class n2 extends sq{static type=eq.common;static view="singleDefault";type=eq.common}class s2 extends sq{seriesType;needAxes(){return!1}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([H0]);class r2 extends s2{static type=eq.funnel;static view="singleDefault";type=eq.funnel;seriesType=tq.funnel}wK.useSeries([N0]);class a2 extends s2{static type=eq.funnel3d;static view="singleDefault";type=eq.funnel3d;seriesType=tq.funnel3d}const o2={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function l2(t){let e=0;return C(t,"tick.visible")&&(e+=C(t,"tick.tickSize")),C(t,"label.visible")&&(e+=C(t,"label.space")),e}function h2(t,e){return{min:t.min??t.range?.min??e?.min,max:t.max??t.range?.max??e?.max}}function c2(t){const e=t?.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function d2(t){const e=t?.orient;return"angle"===e||"radius"===e}const u2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisX:r,axisY:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},j$(t)?r:a)},p2=(t,e,i)=>{const{axisBand:n,axisLinear:s,axisAngle:r,axisRadius:a,axis:o}=i.component??{};return L({},o,("band"===e?n:"linear"===e?s:{})??{},"angle"===t?r:a)};class g2 extends sq{seriesType;isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){const e=N(t.indicator),i=t.innerRadius??t.series?.[0]?.innerRadius;return c(i)&&e.forEach((t=>{h(t.limitRatio)&&(t.limitRatio=i)})),e}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")}));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],c(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class f2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY}}_transformProgressAxisSpec(t,e,i){t.axes||(t.axes=[]);const n={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(n.radius=t),"angle"===e&&(n.angle=t)})),n.angle||(n.angle=e,t.axes.push(n.angle)),n.radius||(n.radius=i,t.axes.push(n.radius)),h(n.angle.type)&&(n.angle.type="linear"),h(n.radius.type)&&(n.radius.type="band");const s=h2(n.angle,{min:0,max:1});h(n.angle.min)&&(n.angle.min=s.min),h(n.angle.max)&&(n.angle.max=s.max)}}wK.useSeries([X1,$1]);class m2 extends f2{static type=eq.gauge;static view="singleDefault";type=eq.gauge;seriesType=tq.gaugePointer;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer}}_getDefaultCircularProgressSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:tq.circularProgress}}transformSpec(t){super.transformSpec(t);let e=t.series?.find((t=>t.type===tq.gauge||t.type===tq.circularProgress));h(e)&&(e=t.gauge??this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===e.type&&h(e.radiusField)&&h(e.categoryField)&&(e.radiusField=t.radiusField??t.categoryField??t.seriesField),1===t.series.length?t.series.push(e):t.series.forEach((t=>{t.type===e.type&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))),e.type===tq.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){t.axes||(t.axes=[]);const e={radius:null,angle:null};(t.axes??[]).forEach((t=>{const{orient:i}=t;"radius"===i&&(e.radius=t),"angle"===i&&(e.angle=t)})),e.angle||(e.angle={orient:"angle",visible:!0},t.axes.push(e.angle)),e.radius||(e.radius={orient:"radius",visible:!1},t.axes.push(e.radius)),h(e.angle.type)&&(e.angle.type="linear"),h(e.radius.type)&&(e.radius.type="linear")}}wK.useSeries([Z1]);class y2 extends rq{static type=eq.heatmap;static view="singleDefault";type=eq.heatmap;seriesType=tq.heatmap;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),valueField:t.valueField,cell:t.cell}}}class _2 extends rq{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),x2Field:t?.x2Field,y2Field:t?.y2Field}}}wK.useSeries([ZZ]);class v2 extends _2{static type=eq.histogram;static view="singleDefault";type=eq.histogram;seriesType=tq.bar;transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([gJ]);class b2 extends _2{static type=eq.histogram3d;static view="singleDefault";type=eq.histogram3d;seriesType=tq.bar3d}wK.useSeries([uJ]);class x2 extends rq{static type=eq.line;static view="singleDefault";type=eq.line;seriesType=tq.line;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),invalidType:t.invalidType||"break",point:t.point,line:t.line}}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([jJ]);class S2 extends sq{static type=eq.map;static view="singleDefault";type=eq.map;seriesType=tq.map;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor}}isValidSeries(t){return t===tq.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class w2 extends g2{needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle}}}wK.useSeries([KJ]);class A2 extends w2{static type=eq.pie;static view="singleDefault";type=eq.pie;seriesType=tq.pie}wK.useSeries([ZJ]);class k2 extends w2{static type=eq.pie3d;static view="singleDefault";type=eq.pie3d;seriesType=tq.pie3d;transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}wK.useSeries([fQ]);class M2 extends f2{static type=eq.circularProgress;static view="singleDefault";type=eq.circularProgress;seriesType=tq.circularProgress;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),cornerRadius:t.cornerRadius??0,roundCap:t.roundCap??!1,progress:t.progress,background:t.background}}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}wK.useSeries([yQ]);class C2 extends rq{static type=eq.linearProgress;static view="singleDefault";type=eq.linearProgress;seriesType=tq.linearProgress;needAxes(){return!1}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),direction:t.direction??"horizontal",cornerRadius:t.cornerRadius??0,bandWidth:t.bandWidth,progress:t.progress,track:t.track}}transformSpec(t){if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="band"),h(e.type)&&(e.type="linear");const n=h2(e,{min:0,max:1});h(e.min)&&(e.min=n.min),h(e.max)&&(e.max=n.max)}else{let e=null,i=null;(t.axes??[]).forEach((t=>{const{orient:n}=t;"left"===n&&(e=t),"bottom"===n&&(i=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),i||(i={orient:"bottom",visible:!1},t.axes.push(i)),h(i.type)&&(i.type="linear"),h(e.type)&&(e.type="band");const n=h2(i,{min:0,max:1});h(i.min)&&(i.min=n.min),h(i.max)&&(i.max=n.max)}}}class T2 extends g2{needAxes(){return!0}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField}}transformSpec(t){if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const e={radius:!1,angle:!1};(t.axes??[]).forEach((t=>{const i=t.orient;"radius"===i&&(e.radius=!0),"angle"===i&&(e.angle=!0)})),e.angle||t.axes.push({orient:"angle"}),e.radius||t.axes.push({orient:"radius"})}}}wK.useSeries([aQ]);class E2 extends T2{static type=eq.radar;static view="singleDefault";type=eq.radar;seriesType=tq.radar;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),seriesField:t.seriesField,invalidType:t.invalidType||"break",line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:L({visible:!1},t.area)}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0,smooth:!0}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}wK.useSeries([SJ]);class P2 extends rq{static type=eq.rangeArea;static view="singleDefault";type=eq.rangeArea;seriesType=tq.rangeArea;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.area=t.area,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e.stack=!1,e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([yJ]);class R2 extends rq{static type=eq.rangeColumn;static view="singleDefault";type=eq.rangeColumn;seriesType=tq.rangeColumn;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar=t.bar,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}transformSpec(t){super.transformSpec(t),aq(t)}}wK.useSeries([_J]);class B2 extends rq{static type=eq.rangeColumn3d;static view="singleDefault";type=eq.rangeColumn3d;seriesType=tq.rangeColumn3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t)};return e.bar3d=t.bar3d,t.direction===Gh.horizontal?e.xField=t.xField??[t.minField,t.maxField]:e.yField=t.yField??[t.minField,t.maxField],e}}wK.useSeries([rQ]);class I2 extends T2{static type=eq.rose;static view="singleDefault";type=eq.rose;seriesType=tq.rose;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),radius:t.radius??kN,outerRadius:t.outerRadius??kN,innerRadius:t.innerRadius??0,seriesField:t.seriesField,stack:t.stack,percent:t.percent}}transformSpec(t){super.transformSpec(t),(t.axes??[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=N(t.crosshair||{}).map((t=>L({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}wK.useSeries([N1]);class D2 extends sq{static type=eq.sankey;static view="singleDefault";type=eq.sankey;seriesType=tq.sankey;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([nQ]);class L2 extends rq{static type=eq.scatter;static view="singleDefault";type=eq.scatter;seriesType=tq.scatter;_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField}}}wK.useSeries([cQ,uQ]);class O2 extends sq{static type=eq.sequence;static view="singleDefault";type=eq.sequence;transformSpec(t){super.transformSpec(t);let e=0;const i=[],n=[],s=[],r=[],a=t.series.filter((t=>t.type!==tq.link)).length,o=(this._layoutRect.height-20*(a-1))/a,l=t?.appendPadding?.left||0,h=t?.appendPadding?.right||0;t?.legends&&(i.push({modelId:`legendRow${e}`,col:1,row:e}),t.legends[0].id=`legendRow${e}`,r.push({index:e,size:20}),e++),t?.dataZoom&&(i.push({modelId:`dataZoomRow${e}`,col:1,row:e}),t.dataZoom[0].id=`dataZoomRow${e}`,e++,r.push({index:e,size:10}),e++),n.push({id:`regionAxesRow${e}`}),i.push({modelId:`axesRow${e}`,col:1,row:e}),t.axes[0].id=`axesRow${e}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),e++,t?.series?.forEach((t=>{[tq.bar,tq.line,tq.area,tq.dot].includes(t.type)&&(i.push({modelId:`${t.type}Row${e}`,col:1,row:e}),i.push({modelId:`axesLeftRow${e}`,col:0,row:e}),n.push({id:`${t.type}Row${e}`,clip:!1}),r.push({index:e,size:t?.height||o}),s.push({orient:"left",id:`axesLeftRow${e}`,type:t.type===tq.dot?"band":"linear",visible:t.type!==tq.dot,title:{visible:!0,autoRotate:!1,style:{text:t?.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof t?.grid?.visible||t?.grid?.visible,style:(e,i)=>{let n=0;if(0===i){const e=t?.grid?.style;n=e?.lineWidth??e?.strokeWidth??1}return{lineWidth:n,stroke:t?.grid?.style?.stroke||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:n.length-1}),t.regionIndex=n.length-1,e++,r.push({index:e,size:t?.padding||20}),e++,t.leftAppendPadding=l,t.type===tq.dot&&(t.title.style.dx=-l,t.subTitle.style.dx=-l))})),t?.series?.forEach((e=>{if(e.type===tq.link){const n=e.dotSeriesIndex+1;i.push({modelId:`${e.type}Row${n}`,col:1,row:n-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=l,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),t?.legends&&(t.legends[0].regionIndex=[n.length-1]);const c={type:"grid",col:3,row:e,colWidth:[{index:0,size:l},{index:2,size:h}],rowHeight:r,elements:i};t.layout=c,t.region=n,t.axes?.push(...s)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=pK(t.data,this._dataSet,this._spec.data),t.type===tq.link&&(t.dataDot=pK(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===tq.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===tq.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=B$.createSeries(t.type,t,{...this._modelOption,region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale});n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}wK.useSeries([k1]);class F2 extends sq{static type=eq.sunburst;static view="singleDefault";type=eq.sunburst;seriesType=tq.sunburst;getDefaultSeriesSpec(t){const e=c(t.startAngle)?t.startAngle:wN,i=c(t.endAngle)?t.endAngle:e+Ut(2*Math.PI),n={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField},s=tq.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([Y1]);class z2 extends sq{static type=eq.treemap;static view="singleDefault";type=eq.treemap;seriesType=tq.treemap;getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}wK.useSeries([QZ]);class H2 extends Q1{static type=eq.waterfall;static view="singleDefault";type=eq.waterfall;seriesType=tq.waterfall;transformSpec(t){super.transformSpec(t),t.legends&&N(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),aq(t)}_getDefaultSeriesSpec(t){return{...super._getDefaultSeriesSpec(t),stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total}}}class j2 extends sq{type=eq.wordCloud;seriesType=tq.wordCloud;transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}wK.useSeries([x0]);class N2 extends j2{static type=eq.wordCloud;static view="singleDefault";type=eq.wordCloud;seriesType=tq.wordCloud;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}wK.useSeries([S0]);class V2 extends j2{static type=eq.wordCloud3d;static view="singleDefault";type=eq.wordCloud3d;seriesType=tq.wordCloud3d;_getDefaultSeriesSpec(t){const e={...super._getDefaultSeriesSpec(t),nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord},i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class W2{plugins;id=el();component;constructor(t){this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?Yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function G2(t){const e={...t};return M(t.style)||(e.textStyle=P$(t.style)),M(t.textStyle)||L(e.textStyle,P$(t.textStyle)),t.shape?.style&&P$(e.shape.style),t.background?.style&&P$(e.background.style),e}function U2(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}class Y2 extends IK{name="component";modelType="component";pluginService;_regions=[];getRegions(){return this._regions}_container;created(){super.created(),this.pluginService=new W2(this)}animate;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new jK({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}async setCurrentTheme(t,e){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():await this._option.globalInstance.updateCustomConfigAndRerender(i)}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(function(t,e,i){switch(t){case un.cartesianBandAxis:return u2(W$(i),"band",e);case un.cartesianLinearAxis:return u2(W$(i),"linear",e);case un.cartesianAxis:case un.cartesianTimeAxis:return u2(W$(i),void 0,e);case un.polarBandAxis:return p2(i.orient,"band",e);case un.polarLinearAxis:return p2(i.orient,"linear",e);case un.polarAxis:return p2(i.orient,void 0,e);case un.cartesianCrosshair:case un.polarCrosshair:return e.component?.crosshair;case un.colorLegend:return e.component?.colorLegend[U2(i)];case un.sizeLegend:return e.component?.sizeLegend[U2(i)];default:return e.component?.[t]}}(this.type,e,this._originalSpec)),m(this._originalSpec)?this._spec=this._originalSpec.map((t=>L({},this._theme,t))):this._spec=L({},this._theme,this._originalSpec),this._preprocessSpec()}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}release(){super.release(),this.clear()}clear(){this._container=null,this.pluginService?.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t}),e.getProduct()?.configure({context:{model:this}})}))}_delegateEvent=(t,e,i)=>{this.event.emit(i,{model:this,node:t,event:e,item:null,datum:null,source:WX.chart,chart:this._option?.globalInstance?.getChart()},"model")}}const X2=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(h(a)||h(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},$2=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return s.forEach(((t,e)=>{h(i[e])||t.latestData.forEach((t=>{N(i[e]).forEach((i=>{h(t[i])||(h(o[t[i]])&&(o[t[i]]=0),h(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class K2 extends Y2{layoutType="region-relative";_orient="left";_isHorizontal;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_stateScale;_relatedAxisComponent;_originalStateFields;_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_newDomain;_startValue;_endValue;_start;_end;_field;_stateField="x";_valueField;_width;_height;setStartAndEnd(t,e){this._handleChange(t,e,!0)}effect={onZoomChange:()=>{if(this._relatedAxisComponent&&"axis"===this._spec.filterMode){this._relatedAxisComponent.getScale().rangeFactor(this._isHorizontal?[this._start,this._end]:[1-this._end,1-this._start]),this._relatedAxisComponent.effect.scaleUpdate()}else Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_visible=!0;get visible(){return this._visible}constructor(t,e){var i;super(t,{...e}),this._orient=W$(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?Gh.horizontal:Gh.vertical)===Gh.horizontal,c(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(c(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):c(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),h(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!zl(t.getScale().type)));this._relatedAxisComponent=e}}}_setRegionsFromSpec(){this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const t=this._relatedAxisComponent?this._relatedAxisComponent.getBindSeriesFilter?.():null;if(c(t)&&(c(t.userId)&&(this._seriesUserId=N(t.userId)),c(t.specIndex)&&(this._seriesIndex=N(t.specIndex))),c(this._spec.seriesId)){const t=N(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(c(this._spec.seriesIndex)){const t=N(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(c(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(N(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(c(this._spec.regionId)){const t=N(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(zl(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};Ll(this._regions,(s=>{const r="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,a="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!r||!a)return;const o=r.getAxisId()===this._relatedAxisComponent.id?r:a.getAxisId()===this._relatedAxisComponent.id?a:this._isHorizontal?r:a,l=o===r?a:r,h=zl(l.getScale(0).type);t.push(s.getRawData());const c=s.getSpec(),d=N(c.xField),u=N(c.yField),p="cartesian"===s.coordinate?d[0]:c.angleField??c.categoryField,g="cartesian"===s.coordinate?u[0]:c.radiusField??c.valueField;if(n[s.id]="link"===s.type?"from_xField":o===r?p:g,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":l===r?p:g;i.push(h?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else h(this._spec.valueField),Ll(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;aK(n,"dataview",Fo),rK(n,"dataFilterComputeDomain",$2);const s=new Vo(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new YK(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=this._spec.visible??!0}_statePointToData(t){const e=this._stateScale;let i=e.range();!this._isHorizontal&&zl(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&zl(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&"axis"===this._spec.filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){return this._originalStateFields?.[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=zl(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new ah,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._spec.filterMode||(rK(this._option.dataSet,"dataFilterWithNewDomain",X2),Ll(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>this._field??this._parseFieldOfSeries(t),isContinuous:()=>zl(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(zl(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_handleStateChange=(t,e)=>(t!==this._startValue||e!==this._endValue)&&(this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),this.effect.onZoomChange?.(),!0);_handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)};_handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ct(this._start-s,0,1),a=ct(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)};_handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}};_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return!1===this._visible||(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}clear(){super.clear(),this._stateScale=null,this._relatedAxisComponent=null,this._seriesIndex=null,this._seriesUserId=null,this._regionUserId=null,this._regionIndex=null,this._newDomain=null,this._startValue=null,this._endValue=null,this._stateField=null,this._width=null,this._height=null}}j(K2,U1);class q2 extends K2{static type=un.scrollBar;type=un.scrollBar;name=un.scrollBar;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(h(i))return;if(!m(i))return new q2(i,{...e,specKey:"scrollBar"});const n=[];return i.forEach(((t,i)=>{n.push(new q2(t,{...e,specIndex:i,specKey:"scrollBar"}))})),n}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new JW({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",...this._getComponentAttrs()}),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.scrollBarChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return h(i)||(n.padding=i),M(t?.style)||(n.railStyle=P$(t.style)),M(e?.style)||(n.sliderStyle=P$(e.style)),n}}class Z2 extends K2{static type=un.dataZoom;type=un.dataZoom;name=un.dataZoom;layoutZIndex=r$.DataZoom;layoutLevel=a$.DataZoom;_component;_valueScale;_backgroundSize;_middleHandlerSize;_startHandlerSize;_endHandlerSize;static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(h(i))return;if(!m(i))return new Z2(i,{...e,specKey:"dataZoom"});const n=[];return i.forEach(((t,i)=>{n.push(new Z2(t,{...e,specIndex:i,specKey:"dataZoom"}))})),n}constructor(t,e){super(t,{...e}),this._valueField="y"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){super.setAttrFromSpec(),this._backgroundSize=this._spec.background?.size??30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),(this._originalSpec.startHandler?.style?.size??1)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),(this._originalSpec.endHandler?.style?.size??1)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const t=this._spec.startHandler.style.visible??!0,e=this._spec.endHandler.style.visible??!0;this._startHandlerSize=t?this._spec.startHandler.style.size:0,this._endHandlerSize=e?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new _h;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){let t=0;if(this._spec?.middleHandler?.visible){const e=this._spec.middleHandler.icon.style.size??8,i=this._spec.middleHandler.background.size??40;t+=Math.max(e,i)}return t}_computeWidth(){return v(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return v(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0;return(this._isHorizontal?this._stateScale:this._valueScale).scale(t[this._stateField])+this.getLayoutStartPoint().x+e+i};_dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i};_dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2;return(this._isHorizontal?this._valueScale:this._stateScale).scale(t[this._valueField])+this.getLayoutStartPoint().y+e+i};_dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i};_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new kU({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:this._spec?.showDetail,brushSelect:this._spec?.brushSelect??!0,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY,...this._getComponentAttrs()}),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),t.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(VX.dataZoomChange,{model:this,value:{filterData:"axis"!==this._spec.filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){const t=this._data.getDataView();if(t.reRunAllTransform(),this._component?.setPreviewData(t.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_initEvent(){}_getComponentAttrs(){return{backgroundStyle:P$(this._spec.background?.style),startHandlerStyle:P$(this._spec.startHandler?.style),middleHandlerStyle:{visible:this._spec.middleHandler?.visible??!1,icon:P$(this._spec.middleHandler?.icon?.style),background:{size:this._spec.middleHandler?.background?.size,style:P$(this._spec.middleHandler.background?.style)}},endHandlerStyle:P$(this._spec.endHandler?.style),startTextStyle:{padding:this._spec.startText?.padding,formatMethod:this._spec.startText?.formatMethod,textStyle:P$(this._spec.startText?.style)},endTextStyle:{padding:this._spec.endText?.padding,formatMethod:this._spec.endText?.formatMethod,textStyle:P$(this._spec.endText?.style)},selectedBackgroundStyle:P$(this._spec.selectedBackground.style),dragMaskStyle:P$(this._spec.dragMask?.style),backgroundChartStyle:{line:L(P$(this._spec.backgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.backgroundChart?.area?.style)}},selectedBackgroundChartStyle:{line:L(P$(this._spec.selectedBackgroundChart?.line?.style),{fill:!1}),area:{curveType:"basis",visible:!0,...P$(this._spec.selectedBackgroundChart?.area?.style)}}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}class J2 extends Y2{static type=un.customMark;type=un.customMark;layoutType="absolute";layoutZIndex=r$.CustomMark;layoutLevel=a$.CustomMark;static createComponent(t,e){return t.customMark?[new J2(t.customMark,{...e,specIndex:0,specKey:"CustomMark"})]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${Kj}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){const s=this._createMark({type:t.type,name:`${Kj}_${n}`});if(s&&(h(e)?this._marks.addMark(s):e&&e.addMark(s),this.initMarkStyleWithSpec(s,t),"group"===t.type&&(i=`${i}_${n}`,t.children?.forEach(((t,e)=>{this._createExtensionMark(t,s,i,e)}))),c(t.dataId)||b(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{s.getData().updateData()})),s.setDataView(e))}}initEvent(){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}onRender(t){}}class Q2 extends Y2{layoutType="absolute";static type=un.brush;type=un.brush;name=un.brush;layoutZIndex=r$.Brush;static speckey="inBrush";_brushComponents=[];_relativeRegions;_linkedSeries=[];_itemMap={};_linkedItemMap={};_inBrushElementsMap={};_outOfBrushElementsMap={};_linkedInBrushElementsMap={};_linkedOutOfBrushElementsMap={};_isFristState=!0;static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!h(i)&&!1!==i.visible)return[new Q2(i,{...e,specKey:Q2.speckey})]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_createBrushComponent(t,e){const i=t.getLayoutStartPoint().x,n=i+t.getLayoutRect().width,s=t.getLayoutStartPoint().y,r=s+t.getLayoutRect().height,a=new SY({zIndex:this.layoutZIndex,brushStyle:P$(this._spec?.style),interactiveRange:{minY:s,maxY:r,minX:i,maxX:n},xRange:[i,n],yRange:[s,r],...this._spec});a.id=this._spec.id??`brush-${this.id}`,this.getContainer().add(a);const{brushMode:o="single",removeOnClick:l=!0}=this._spec;a.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFristState||"single"===o&&l&&"drawStart"===n)&&this._initMarkBrushState(e),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=VX.brushChange;r="brushStart"===n||"brushDown"===n?VX.brushStart:"brushEnd"===n||"brushMaskUp"===n?VX.brushEnd:VX.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,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}})})),this._brushComponents.push(a)}_transformBrushedMarkAttr(t){const e={};return t?.symbol&&(e.symbolType=t.symbol),t?.symbolSize&&(e.size=t.symbolSize),t?.color&&(e.fill=t.color),t?.colorAlpha&&(e.fillOpacity=t.colorAlpha),{...P$(t),...e}}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{const i=e.getGraphicItem();this._outOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,i)?(i.addState("inBrush"),this._inBrushElementsMap[t?.name]||(this._inBrushElementsMap[t?.name]={}),this._inBrushElementsMap[t?.name][e.key]=e,delete this._outOfBrushElementsMap[e.key]):this._inBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,i)&&(i.removeState("inBrush"),i.addState("outOfBrush"),this._outOfBrushElementsMap[e.key]=e,delete this._inBrushElementsMap[t.name][e.key])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((e=>{const n=e.getGraphicItem();this._linkedOutOfBrushElementsMap?.[e.key]&&this._isBrushContainItem(t,n,{dx:i,dy:s})?(n.addState("inBrush"),this._linkedInBrushElementsMap[t?.name]||(this._linkedInBrushElementsMap[t?.name]={}),this._linkedInBrushElementsMap[t?.name][e.key]=e,delete this._linkedOutOfBrushElementsMap[e.key]):this._linkedInBrushElementsMap?.[t?.name]?.[e.key]&&!this._isBrushContainItem(t,n,{dx:i,dy:s})&&(n.removeState("inBrush"),n.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[e.key]=e)}))}))}}))}_isBrushContainItem(t,e,i){if(!t?.globalTransMatrix||!t?.attribute?.points)return!1;const n=t?.attribute?.points??[],{a:s,b:r,c:a,d:o,e:l,f:h}=t.globalTransMatrix,c=i?.dx||0,d=i?.dy||0,u=n.map((t=>({x:s*t.x+a*t.y+l+c,y:r*t.x+o*t.y+h+d}))),p=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+c,t.globalAABBBounds.y1+d,t.globalAABBBounds.x2+c,t.globalAABBBounds.y2+d),g=e.globalTransMatrix.e,f=e.globalTransMatrix.f;if("symbol"===e.type)return p.contains(g,f)&&Le(u,g,f);if("rect"===e.type){const{width:t=0,height:i=0}=e?.attribute;return function(t,e){for(let i=0;i0&&De(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(u,[{x:g,y:f},{x:g+t,y:f},{x:g+t,y:f+i},{x:g,y:f+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){c(this._spec.regionId)&&c(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}_bindLinkedSeries(){c(this._spec.brushLinkSeriesId)&&c(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(N(this._spec.brushLinkSeriesId),N(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&N(t).includes(s.userId)||e&&N(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const e=this._transformBrushedMarkAttr(this._spec?.inBrush),i=this._transformBrushedMarkAttr(this._spec?.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((t=>{const n=t.getGraphicItem();n.stateProxy=t=>"inBrush"===t?e:"outOfBrush"===t?i:void 0,n.addState("outOfBrush"),this._outOfBrushElementsMap[t.key]=t,this._linkedOutOfBrushElementsMap[t.key]=t}))}))})),this._isFristState=!1}initEvent(){}onRender(t){}changeRegions(t){}onLayoutEnd(t){super.onLayoutEnd(t);(this._spec.visible??!0)&&0===this._brushComponents.length&&this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))}}var t3;function e3(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function i3(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function n3(t){if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const e=t.map((t=>({...t,bound:i3(t.rect),anchorCandidates:h3(t.anchors??[],t.point,t.rect,t.offset)}))),i=[];i.push(e[0].bound);for(let t=1;t<=e.length-1;t++){const n=e[t],s=n.bound;let r=i.some((t=>e3(t,s)));if(n.anchorCandidates)if(r&&n.anchorCandidates?.length>0){for(let t=0;te3(t,a)))){i.push(a),r=!1;break}}r&&i.push(n.bound)}else i.push(n.bound)}return i.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function s3(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=Be(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=o3(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=hn(r,n,i);if(!o3(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],r3(a3(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=r3(a3(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=l3(t.rect,a,0),t}));return n3(h)}function r3(t){return t>180?t-360:t}function a3(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function o3(t,e){for(let i=0;i{const{x:r,y:a}=l3({...e,width:i.width,height:i.height},t,n);s.push({x:r,y:a})})),s}!function(t){t.brushStart="brushStart",t.brushEnd="brushEnd",t.brushMaskUp="brushMaskUp",t.brushing="brushing",t.brushMaskDown="brushMaskDown",t.brushMaskMove="brushMaskMove"}(t3||(t3={}));class c3 extends Y2{static type=un.mapLabel;type=un.mapLabel;name=un.mapLabel;layoutType="absolute";static speckey="mapLabel";layoutZIndex=r$.MarkPoint;nameField;valueField;_series;_map;_longitudeField;_latitudeField;_markerComponents;_activeDatum=[];static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!c(i.series)?new c3(i,e):null}setAttrFromSpec(){this.nameField=this._spec.nameField??this._series?.getDimensionField()[0],this.valueField=this._spec.valueField??this._series?.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=this._regions[0].getSeriesInType("map")[0]?.getMapViewData()?.latestData,this._longitudeField=this._regions[0].getSpec?.()?.longitudeField,this._latitudeField=this._regions[0].getSpec?.()?.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new Vo(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new YK(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{const i=this._data?.getLatestData()[e];this._activeDatum.includes(i)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){const t=this._data?.getLatestData();t&&0!==t.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){const t=[],e=[];this._markerComponents||(this._markerComponents=this._data?.getLatestData().map(((t,e)=>{const i=new FU({position:void 0});return i&&(i.name=`${this.name}_marker_${e}`,i.id=this._spec.id??`${this.name}_marker_${this.id}`,i.setAttribute("zIndex",this.layoutZIndex)),i})));this._markerComponents.forEach(((i,n)=>{i.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&t.push(s),r&&e.push(r)}));const i=this._layoutLabels(t);this._layoutMarkers(i,e),this._renderMarkers()}_evaluateMarker(t,e){let i=0,n=0,s=0,r=0,a=0;const o=this._spec.position||"top",l=this._spec.offset,h=qh(this._spec.background?.padding),d=this._spec.space||0;n+=(h?.left||0)+(h?.right||0),s+=(h?.top||0)+(h?.bottom||0);const u={},p=this.dataToPosition(t),g=aB({});if(g.name=`${this.name}_marker_itemContainer_${e}`,u.container=g,this._spec.background?.visible){const t=hB(P$({...this._spec.background.style}));t.setAttributes(p),u.labelBackground=t,g.appendChild(t)}if(this._spec.icon?.visible){const t=uB(P$({...this._spec.icon.style}));t.setAttributes(p),t.setAttribute("symbolType",this._spec.icon.style?.shape);const e=t.AABBBounds,n=e?.y2-e?.y1??0,s=e?.x2-e?.x1??0;u.icon=t,g.appendChild(t),a=n,r+=s,i++}if(this._spec.nameLabel?.visible){const e=dB(P$({...this._spec.nameLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.nameField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.nameLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}if(this._spec.valueLabel?.visible&&c(t[this.valueField])){const e=dB(P$({...this._spec.valueLabel.style}));e.setAttributes(p),e.setAttribute("text",t[this.valueField]);const n=e.AABBBounds,s=n?.y2-n?.y1??0,o=n?.x2-n?.x1??0;u.valueLabel=e,g.appendChild(e),a=Math.max(a,s),r+=o,i++}const f=Object.values(u).find((t=>!!t&&"group"!==t.type)),m={x:f?.getComputedAttribute("x"),y:f?.getComputedAttribute("y")},y={x:m.x,y:m.y,width:0,height:0};y.width=n+r+(i-1)*d,y.height=s+a;const _={rect:y,point:m,index:e};if("outer"!==o){const t=["top","right","left","bottom"].filter((t=>t!==o));_.rect=l3(y,o,l),_.anchors=t,_.offset=l}else _.pointCoord={x:+t?.[this._longitudeField],y:+t?.[this._latitudeField]};return{pairInfo:_,contentMarks:u}}_layoutMarkers(t,e){for(let i=0;i{if(t){const i=t.AABBBounds;let n=0;"symbol"===t.type&&(n+=(i.x2-i.x1??0)/2),t.setAttributes({x:u+n,y:d}),u+=i.x2-i.x1??0,2!==e&&(u+=c)}})),a?.setAttributes({x:0,y:0,width:l.width,height:l.height}),o?.setAttributes({dx:-l.width/2,dy:-l.height/2});const p=this._data.getLatestData()[i],g=this.dataToPosition(p),f=!(!this._spec.leader?.visible||!(n||s||r));this._markerComponents[i].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:g,visible:this._activeDatum.includes(p),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>o,autoRotate:!1,offsetX:l.x+l.width/2-g.x,offsetY:l.y+l.height/2-g.y},itemLine:{visible:f,type:"type-po",lineStyle:P$({...this._spec.leader?.style}),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):n3(t)}_isRelativeModel(t){const e=this._series.getXAxisHelper()?.getAxisId()??this._series.getCoordinateHelper()?.getCoordinateId();return t?.id===e}_isRelativeSeries(t){return t?.id===this._series.id}onRender(t){}changeRegions(){}}class d3{id;name;service;static Name;constructor(t=d3.Name){this.id=el(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}function u3(t,e){const i=e.getSpec?.();M(t)||i?.label?.flush&&function(t,e){const{width:i,height:n}=e.getLayoutRect(),s=j$(e.layoutOrient),r=t[0],a=V(t);if(s){const t=0,e=i,n=r.AABBBounds.x1,s=a.AABBBounds.x2;ne&&a.setAttributes({x:e,textAlign:"right"})}else{const t=n,e=0,i=r.AABBBounds.y2,s=a.AABBBounds.y1;i>t&&r.setAttributes({y:t,textBaseline:"bottom"}),s"axis-label-container-layer-0"===t.name),!0),s=i.find((t=>"axis-label-container-layer-1"===t.name),!0);u3(n?n.getChildren():[],t.component),u3(s?s.getChildren():[],t.component)}}function g3(t){return 2===t.length&&b(t[0])&&b(t[1])&&t[1]>=t[0]}function f3(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!b(a.min),extendable_max:!b(a.max)}}function m3(t,e){const{positive:i,negative:n,extendable_min:s,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=n/i;r&&(t=n/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function y3(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 _3(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 v3(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 b3=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),x3=(t,e,i=0)=>{const n=new Wt(t).expand(i/2),s=new Wt(e).expand(i/2);return n.intersects(s)},S3=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function A3(t,e){for(let i,n=1,s=t.length,r=t[0];n{const{labelStyle:n,axisOrientType:s,labelFlush:r,labelFormatter:a,startAngle:o=0}=i,l=n.angle??0,h=["bottom","top"].includes(s),c=["left","right"].includes(s);let d=o;h?d=0:c&&(d=Sl(-90));const u=b$(n);return e.map(((i,s)=>{const o=a?a(i):`${i}`,{width:p,height:g}=u.quickMeasure(o),f=Math.max(p,12),m=Math.max(g,12),y=t.scale(i);let _,v,b=Math.cos(d)*y,x=-Math.sin(d)*y;_=r&&h&&0===s?"left":r&&h&&s===e.length-1?"right":n.textAlign??"center","right"===_?b-=f:"center"===_&&(b-=f/2),v=r&&c&&0===s?"top":r&&c&&s===e.length-1?"bottom":n.textBaseline??"middle","bottom"===v?x-=m:"middle"===v&&(x-=m/2);return(new Wt).set(b,x,b+f,x+m).rotate(l,b+f/2,x+m/2)}))},M3=(t,e)=>{if(!t)return t;const i=e?.targetAxis?.();if(!i)return t;const n=e?.currentAxis?.();if(!n)return t;const s=n.getTickData()?.getDataView();if(!s)return t;const r=s.transformsArr.find((t=>"ticks"===t.type));if(!r)return t;const a=n.getScale();if(!a)return t;const o=i.getTickData()?.getDataView()?.latestData;if(!o?.length)return t;const l=i.getScale();if(!l)return t;const h=l.domain(),c=h[1]-h[0];if(0===c)return t;const d=a.domain(),u=d[1]-d[0];if(0===c)return t;const p=o.map((t=>{const e=(t.value-h[0])/c;return u*e+d[0]}));return b3(p,r.options)};class C3 extends d3{Name="AxisSyncPlugin";constructor(){super(C3.Name)}_checkEnableSync(t){if(!zl(t.getScale().type))return!1;const e=t.getSpec().sync;return!!e?.axisId&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return i?.type.startsWith("cartesianAxis")?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const n=this._getTargetAxis(e,i);n&&e.event.on(VX.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!zl(i.type)||!zl(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!g3(s)||!g3(r))return;const a=f3(t,s),o=f3(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:m,includeZero:y}=o;if(0===l&&0===h){if(!y3(a,o))return}else if(0===p&&0===g){if(!y3(o,a))return}else if(u||y)if(u&&!y){if(!m3(a,o))return}else if(y&&!u){if(!m3(o,a))return}else{if(h===g)return;if(h>g){if(!_3(a,o))return}else if(!_3(o,a))return}else{if(0===h&&0===p){if(!v3(a,o))return}else if(0===g&&0===l&&!v3(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!m)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){rK(e.getOption().dataSet,"tickAlign",M3);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var T3={AxisLabelOverlapPlugin:p3,AxisSyncPlugin:C3};const E3=t=>t,P3={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!w3(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},R3=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?S3(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=r?.();if(!l)return b3(t.domain());let h;if(c(s))h=t.stepTicks(s);else if(c(n))h=t.forceTicks(n);else if(c(i))h=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=l2(a),r=((t,e,i)=>{const{labelStyle:n,getRadius:s,axisSpec:r,labelFormatter:a}=i,o=s?.(),l=n.angle??0,h=l2(r),c=b$(n),d=e.map((e=>{const i=a?a(e):`${e}`,{width:n,height:s}=c.quickMeasure(i),r=Math.max(n,12),d=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=Bl(u),{x:m,y:y}=$t({x:0,y:0},o+h,u);return p=m+("right"===f.align?-r:"center"===f.align?-r/2:0),g=y+("bottom"===f.baseline?-d:"middle"===f.baseline?-d/2:0),(new Wt).set(p,g,p+r,g+d).rotate(l,p+r/2,g+d/2)}));return d})(t,i,e),c=Math.min(...n),d=Math.max(...n),u=Math.abs(d-c)*(l+s)/i.length,{step:p,delCount:g}=I3(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));h=t.stepTicks(p),h=h.slice(0,h.length-g)}else h=t.domain();return b3(h)},I3=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&x3(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},D3=(t,e)=>{if(zl(t.type))return((t,e)=>{if(!zl(t.type))return b3(t.domain());const{tickCount:i,forceTickCount:n,tickStep:s}=e;let r;if(r=c(s)?t.stepTicks(s):c(n)?t.forceTicks(n):t.ticks(i??5),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=k3(t,r,e).map(((t,e)=>({AABBBounds:t,value:r[e]})));for(;s.length>=3&&A3(s,i);)s=P3.parity(s);const a=s.map((t=>t.value));a.length<3&&n&&(a.length>1&&a.pop(),V(a)!==V(r)&&a.push(V(r))),r=a}return b3(r)})(t,e);if(jl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{const{tickCount:i,forceTickCount:n,tickStep:s,labelGap:r=4,axisOrientType:a}=e,o=["bottom","top"].includes(a);let l;if(c(s))l=t.stepTicks(s);else if(c(n))l=t.forceTicks(n);else if(c(i))l=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=k3(t,i,e),a=s.map((t=>o?t.width():t.height())),h=Math.min(...n),c=(Math.max(...n)-h)/i.length,d=R3(i,s,r,e.labelLastVisible,o,Math.floor(Math.min(...a)/c));l=t.stepTicks(d.step),e.labelLastVisible&&(l=l.slice(0,l.length-d.delCount),l.push(i[i.length-1]))}else l=t.domain();return b3(l)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return B3(t,e)}return b3(t.domain())};class L3 extends Y2{static specKey="axes";_orient;get orient(){return this._orient}_scale;getScale(){return this._scale}_scales=[];getScales(){return this._scales}_tickData;getTickData(){return this._tickData}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_seriesUserId;_seriesIndex;_regionUserId;_regionIndex;_visible=!0;get visible(){return this._visible}_tick=void 0;_dataFieldText;constructor(t,e){super(t,{...e}),this._visible=t.visible??!0}created(){if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._initData(),this._visible){const t=this._createMark({type:"component",name:`axis-${this.orient}`},{componentType:"angle"===this.orient?"circleAxis":"axis",mode:this._spec.mode});if(this._marks.addMark(t),t.setZIndex(this.layoutZIndex),c(this._spec.id)&&t.setUserId(this._spec.id),o(this._spec.interactive)&&t.setInteractive(this._spec.interactive),!1!==this._option.animation&&!1!==C(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const e=WZ(NZ.axis(),{appear:this._spec.animationAppear??C(this._option.getChart().getSpec(),"animationAppear.axis")??C(this._option.getChart().getSpec(),"animationAppear"),disappear:this._spec.animationDisappear??C(this._option.getChart().getSpec(),"animationDisappear.axis")??C(this._option.getChart().getSpec(),"animationDisappear"),enter:this._spec.animationEnter??C(this._option.getChart().getSpec(),"animationEnter.axis")??C(this._option.getChart().getSpec(),"animationEnter"),exit:this._spec.animationExit??C(this._option.getChart().getSpec(),"animationExit.axis")??C(this._option.getChart().getSpec(),"animationExit"),update:this._spec.animationUpdate??C(this._option.getChart().getSpec(),"animationUpdate.axis")??C(this._option.getChart().getSpec(),"animationUpdate")});e.update[0].customParameters={enter:e.enter[0]},t.setAnimationConfig(e)}}}isSeriesDataEnable(){let t=!0;return Ll(this._regions,(e=>{m(e.getViewDataStatistics()?.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:n}=this._spec;c(t)&&(this._seriesUserId=N(t)),c(i)&&(this._regionUserId=N(i)),c(e)&&(this._seriesIndex=N(e)),c(n)&&(this._regionIndex=N(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}computeStatisticsDomain=()=>{const t=[];if(Ll(this._regions,(e=>{const i=e.getViewDataStatistics?.();i&&this.getSeriesStatisticsField(e).forEach((e=>{i.latestData?.[e]&&t.push(i.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!zl(this._scale.type)){this._statisticsDomain.index={};for(let t=0;tt?.id===this.id},this.effect.scaleUpdate.bind(this));const t=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));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(Ll(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=t?.find((t=>t.name===rU.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){const t=this._spec;let e,i=t.title.angle;return"left"!==t.orient&&"right"!==t.orient||t.title?.autoRotate&&h(t.title.angle)&&(i="left"===t.orient?-90:90,e=o2[t.orient]),{orient:this.orient,select:t.select,hover:t.hover,line:(n=t.domainLine,(n=C$(n)).startSymbol=C$(n.startSymbol),n.endSymbol=C$(n.endSymbol),n),label:{visible:t.label.visible,space:t.label.space,inside:t.label.inside,style:l(t.label.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.label.style(e.rawValue,i,e,n,s));return P$(this._preprocessSpec(L({},this._theme.label?.style,r)))}:P$(t.label.style),formatMethod:t.label.formatMethod?(e,i,n)=>t.label.formatMethod(i.rawValue,i):null,state:E$(t.label.state),autoRotate:!!t.label.autoRotate,autoHide:!!t.label.autoHide,autoLimit:!!t.label.autoLimit,autoRotateAngle:t.label.autoRotateAngle,autoHideMethod:t.label.autoHideMethod,autoHideSeparation:t.label.autoHideSeparation,limitEllipsis:t.label.limitEllipsis,layoutFunc:t.label.layoutFunc},tick:{visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,style:l(t.tick.style)?(e,i,n,s)=>{const r=this._preprocessSpec(t.tick.style(e,i,n,s));return P$(this._preprocessSpec(L({},this._theme.tick?.style,r)))}:P$(t.tick.style),state:T$(t.tick.state)},subTick:{visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount,style:l(t.subTick.style)?(e,i,n,s)=>{const r=t.subTick.style(e,i,n,s);return P$(L({},this._theme.subTick?.style,r))}:P$(t.subTick.style),state:T$(t.subTick.state)},grid:{type:"line",visible:t.grid.visible,alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:l(t.grid.style)?(e,i)=>{const n=t.grid.style(e.datum?.rawValue,i,e.datum);return P$(this._preprocessSpec(L({},this._theme.grid?.style,n)))}:P$(t.grid.style)},subGrid:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:P$(t.subGrid.style)},title:{visible:t.title.visible,position:t.title.position,space:t.title.space,autoRotate:!1,angle:i?Gt(i):null,textStyle:L({},e,P$(t.title.style)),padding:t.title.padding,shape:{visible:t.title.shape?.visible,space:t.title.shape?.space,style:P$(t.title.shape?.style)},background:{visible:t.title.background?.visible,style:P$(t.title.background?.style)},state:{text:T$(t.title.state),shape:T$(t.title.shape?.state),background:T$(t.title.background?.state)}},panel:{visible:t.background?.visible,style:P$(t.background?.style),state:T$(t.background?.state)}};var n}addTransformToTickData(t,e){this._tickData?.getDataView()?.transform(t,e)}}const O3=[T3.AxisLabelOverlapPlugin,T3.AxisSyncPlugin];class F3 extends L3{static type=un.cartesianAxis;type=un.cartesianAxis;name=un.cartesianAxis;layoutType="region-relative";layoutZIndex=r$.Axis;layoutLevel=a$.Axis;_dataSet;layout3dBox;_orient="left";get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}_scales=[];getScales(){return this._scales}_statisticsDomain={domain:[],index:{}};getStatisticsDomain(){return this._statisticsDomain}_tick=void 0;_axisStyle;_latestBounds;_verticalLimitSize;constructor(t,e){super(t,{...e}),this._orient=W$(t,["z"]),V$(this._orient)&&(this.layoutType="absolute"),c(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){const n=t.type??function(t,e){return e?j$(t)?"linear":"band":j$(t)?"band":"linear"}(t.orient,i),s=`${F3.type}-${n}`,r=B$.getComponentInKey(s);if(r){let n=t.inverse;return i&&!j$(t.orient)&&(n=!c(t.inverse)||!t.inverse),new r({...t,inverse:n},e)}throw`Component ${s} not found`}static createComponent(t,e){if(!this.type.startsWith(F3.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[F3.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===Gh.horizontal;if(!m(i))return c2(i)?F3.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>N$(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{c2(t)&&a.push(F3.createAxis(t,{...e,specIndex:i,specKey:F3.specKey},n))})),a}setLayout3dBox(t){this.layout3dBox=t}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):N$(this.orient)?t.setYAxisHelper(this.axisHelper()):V$(this.orient)&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];j$(this.orient)?b(e)&&(s=n?[e,0]:[0,e]):V$(this.orient)?b(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):b(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){super.init(t),this.pluginService?.load(O3.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();j$(this.orient)?h(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):h(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this.getLabelFormatMethod(),t.verticalFactor="top"===this.orient||"right"===this.orient?-1:1,this._axisStyle=t,this._tick=this._spec.tick}getSeriesStatisticsField(t){let e;return e=j$(this.orient)?t.fieldX:V$(this.orient)?t.fieldZ:t.fieldY,zl(this._scale.type)?e:[e[0]]}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}afterCompile(){const t=this.getMarks()[0]?.getProduct();t&&t.addEventListener(hV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(j$(this.orient)?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._delegateAxisContainerEvent(t.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(VX.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return Ll(this._regions,(e=>{t.push("left"===this.orient||"right"===this.orient?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:j$(this.orient)?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:V$(this.orient)?i.fieldZ:i.fieldY,n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{j$(this.orient)?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):N$(this.orient)?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):V$(this.orient)&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;b(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),b(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),e}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=j$(this.orient)?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=j$(this.orient),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(L({...this.getLayoutStartPoint()},this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=L({...this.getLayoutStartPoint()},this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){if(this._spec.title.visible&&h(this._spec.title.style?.maxLineWidth)){const e=this._spec.title.style?.angle||0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const i=this.getLayoutRect().height,n=Math.abs(Math.sin(e));return n<1e-6?1/0:i/n}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=this.getRegions();let{x:n,y:s}=t[0].getLayoutStartPoint(),r=n+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let e=1;e{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=j$(this.orient),s=t=>(n?!j$(t.orient):j$(t.orient))&&zl(t.getScale().type)&&t.getScale().ticks().includes(0),r=i.filter((t=>s(t)));if(r.length){let a;if(c(t))a=r.find((e=>e.id===t));else if(c(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:{...this._axisStyle.line,dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e}}):t.encode({line:{...this._axisStyle.line,dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)}})}}}}}const z3=Math.sqrt(50),H3=Math.sqrt(10),j3=Math.sqrt(2);class N3{_extend={};setExtraAttrFromSpec(){c(this._spec.nice)&&(this._nice=this._spec.nice),c(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=h2(this._spec)}transformScaleDomain(){this.setScaleNice()}setScaleNice(){let t=this._spec.tick?.forceTickCount??this._spec.tick?.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._nice&&this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._nice&&this._scale.niceMin(t)}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){const e=[];return t.forEach((t=>{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;const e=t[0],i=t[t.length-1];c(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),c(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){if(Math.abs(W(t)-function(t){if(t&&m(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=z3?10:s>=H3?5:s>=j3?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){if(this._nice){let t=this._tick.forceTickCount??this._tick.tickCount??10;"accurateFirst"===this._spec.niceType&&(t=Math.max(10,t)),h(this._domain?.min)&&h(this._domain?.max)?this._scale.nice(t):c(this._domain?.min)&&h(this._domain?.max)?this._scale.niceMax(t):h(this._domain?.min)&&c(this._domain?.max)&&this._scale.niceMin(t)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(VX.scaleUpdate,{model:this})}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{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._scales[t];return{dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id}}dataToPosition(t,e={}){if(0===t.length||0===this._scales.length)return 0;const{position:i,bandScale:n}=this.getPosition(t);return i+n.bandwidth()*(e.bandPosition??.5)}transformScaleDomain(){}}j(G3,W3);class U3 extends V3{static type=un.cartesianTimeAxis;type=un.cartesianTimeAxis;_layerTickData;_zero=!1;effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{j$(this.orient)?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec(),this._tick=L({},this._spec.tick,this._spec.layers?.[0])}_initData(){if(super._initData(),this._spec.layers?.[1]){const t=this._spec.label||{},e=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:this._spec.layers?.[1]?.tickCount,forceTickCount:this._spec.layers?.[1]?.forceTickCount,tickStep:this._spec.layers?.[1]?.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new YK(this._option,e)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){const t=Wo.getInstance(),e=this._spec?.layers?.[1]?.timeFormat||"%Y%m%d",i="local"===(this._spec?.layers?.[1]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat,n=this._spec?.layers?.[0]?.timeFormat||"%Y%m%d",s="local"===(this._spec?.layers?.[0]?.timeFormatMode||"local")?t.timeFormat:t.timeUTCFormat;return(t,r,a,o,l)=>{let h;return h=0===l?s(n,t):i(e,t),this._spec.label?.formatMethod?this._spec.label.formatMethod(h,r):h}}getLabelItems(t){const e=[];return m(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&m(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}class Y3 extends L3{static type=un.polarAxis;type=un.polarAxis;name=un.polarAxis;layoutType="absolute";layoutZIndex=r$.Axis;_tick=void 0;_center=null;get center(){return this._center}_startAngle=xN;get startAngle(){return this._startAngle}_endAngle=SN;get endAngle(){return this._endAngle}_orient="radius";get orient(){return this._orient}_groupScales=[];getGroupScales(){return this._groupScales}_refAngleAxis;setRefAngleAxis(t){return this._refAngleAxis=t,this}_axisStyle;static createAxis(t,e){const i=t.type??("angle"===t.orient?"band":"linear"),n=`${Y3.type}-${i}`,s=B$.getComponentInKey(n);if(s)return new s(t,e);throw`Component ${n} not found`}static createComponent(t,e){if(!this.type.startsWith(Y3.type))return null;const i=t.axes||e.defaultSpec;if(!i)return null;if(!m(i))return d2(i)?(i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),Y3.createAxis(i,{...e,specKey:"axes"})):null;const n=[];let s;const r=[];return i.forEach(((i,a)=>{if(!d2(i))return;i.center=t.center,i.startAngle=t.startAngle??wN,i.endAngle=t.endAngle??(c(t.startAngle)?t.startAngle+360:AN),i.outerRadius=i.radius??t.outerRadius??t.radius??kN;const o=Y3.createAxis(i,{...e,specIndex:a,specKey:"axes"});n.push(o),"radius"===i.orient?r.push(o):s=o})),r.forEach((t=>t.setRefAngleAxis(s))),n}effect={scaleUpdate:()=>{this.computeData(),Ll(this._regions,(t=>{"radius"===this.orient?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};setAttrFromSpec(){super.setAttrFromSpec();const t=this._getAxisAttributes();this._axisStyle=t,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Sl(this._spec.startAngle??wN),this._endAngle=Sl(this._spec.endAngle??(c(this._spec.startAngle)?this._spec.startAngle+360:AN))}setLayoutStartPosition(t){const e=this.getRegions()?.[0],i=e?e.getLayoutStartPoint():t;super.setLayoutStartPosition(i)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(VX.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){aK(this._option.dataSet,"scale",E3),rK(this._option.dataSet,"ticks",D3);const t=this._spec.label||{},e=this._spec.tick||{},i=new Vo(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new YK(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{const e=t.item;!1===this._option.getChart().getLayoutTag()&&e.context?.model===this&&this._delegateAxisContainerEvent(e.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.orient?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return Ll(this._regions,(i=>{let n;n=t>0?i.getGroups()?.fields?.[t]:"radius"===this.orient?i.getRadiusField():i.getAngleField(),n=m(n)?zl(this._scale.type)?n:[n[0]]:[n],t||(this._dataFieldText=i.getFieldAlias(n[0]));const s=i.getViewDataStatistics?.();n&&n.forEach((t=>{s?.latestData?.[t]&&e.push(s.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){Ll(this._regions,(t=>{"radius"===this.orient?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.orient?t.getRadiusField():t.getAngleField();return zl(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.orient)return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=Al({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);const h=la;)l+=h*Math.PI*2;return{radius:o,angle:l}}getCenter(){return{x:this._center?.x||this.getRefLayoutRect().width/2,y:this._center?.y||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.orient?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s={...this.getLayoutStartPoint(),inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]};this._update(s)}_layoutRadiusAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this.coordToPoint({angle:this._startAngle,radius:e}),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=jt.distancePP(s,n),a={...this.getLayoutStartPoint(),start:s,end:n,verticalFactor:-1,grid:{type:this._spec.grid?.smooth?"circle":"polygon",center:t,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:m(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-i)/r,rawValue:t.value}}))]:[]};this._update(a)}computeLayoutOuterRadius(){const t=this._spec.outerRadius??this._spec.radius??this.getRefSeriesRadius().outerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}computeLayoutInnerRadius(){const t=this._spec.innerRadius??this.getRefSeriesRadius().innerRadius,{width:e,height:i}=this.getRefLayoutRect();return Math.min(e,i)/2*t}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=kN,e=0;const i=this.getChart().getSpec();return Ll(this.getRegions(),(n=>{const s=n;if(function(t){return[tq.rose,tq.radar,tq.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;b(n)&&(t=n),b(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(L({},this._axisStyle,t))}}class X3 extends Y3{static type=un.polarLinearAxis;type=un.polarLinearAxis;_zero=!0;_nice=!0;_scale=new _h;setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}j(X3,N3);class $3 extends Y3{static type=un.polarBandAxis;type=un.polarBandAxis;_scale=new ah;computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return{...t,getBandwidth:e=>t.getScale(e).bandwidth()}}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}function K3(t,e){const{title:i={},item:n={},pager:s={},background:r={},type:a,id:o,visible:l,orient:h,position:d,data:u,filter:p,regionId:g,regionIndex:f,seriesIndex:m,seriesId:y,padding:_,...v}=L({},t),b=v;return i.visible&&(b.title=G2(i)),M(n.focusIconStyle)||P$(n.focusIconStyle),n.shape=C$(n.shape),n.label=C$(n.label),n.value=C$(n.value),n.background=C$(n.background),Xh(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*e.width/100),Xh(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*e.width/100),Xh(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*e.width/100),b.item=n,M(s.textStyle)||P$(s.textStyle),C$(s.handler),b.pager=s,r.visible&&!M(r.style)&&(L(b,r.style),c(r.padding)&&(b.padding=r.padding)),b}j($3,W3);const q3=(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},Z3=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=s();if(0===r.length&&a.length)return[];if(r.length===a.length)return t;const o={};r.forEach((t=>{o[t]=!0}));const l=n();return c(l)&&(t=t.filter((t=>!0===o[t[l]]))),t};class J3 extends Y2{layoutType="normal";layoutZIndex=r$.Legend;layoutLevel=a$.Legend;_orient="left";get orient(){return this._orient}_visible=!0;get visible(){return this._visible}_position="middle";get position(){return this._position}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}_legendData;getLegendData(){return this._legendData.getLatestData()}_selectedData=[];getSelectedData(){return this._selectedData}_legendComponent;_cacheAttrs;effect={onSelectedDataChange:()=>{Ll(this._regions,(t=>{t.getViewDataFilter()?.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),Ll(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}};_seriesUserId;_seriesIndex;_regionUserId;_regionUserIndex;setAttrFromSpec(){super.setAttrFromSpec(),this._orient=Uh(this._spec.orient)?this._spec.orient:"left",this._position=this._spec.position??"middle",this._visible=!1!==this._spec.visible;const{regionId:t,regionIndex:e,seriesId:i,seriesIndex:n}=this._spec;c(i)&&(this._seriesUserId=N(i)),c(t)&&(this._regionUserId=N(t)),c(n)&&(this._seriesIndex=N(n)),c(e)&&(this._regionUserIndex=N(e)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient,e.orient,i.reMake=!0,i}changeRegions(t){}initData(){const t=this._initLegendData();t.target.addListener("change",this._initSelectedData.bind(this)),this._legendData=new YK(this._option,t),this._initSelectedData(),Ll(this._regions,(t=>{t.event.on(VX.rawDataStatisticsUpdate,{filter:({model:e})=>e?.id===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){const e=this._selectedData;h(t)||JSON.stringify(e)===JSON.stringify(t)||(this._selectedData=[...t],this.effect.onSelectedDataChange?.(),this.event.emit(VX.legendSelectedDataChange,{model:this}),this._legendComponent?.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;b(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(L({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(L({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),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,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,i.y2=i.y1+r,i}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,super.clear()}}class Q3 extends J3{static type=un.discreteLegend;type=un.discreteLegend;name=un.discreteLegend;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return i.type&&"discrete"!==i.type?void 0:new Q3(i,{...e,specIndex:0,specKey:"legends"});const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new Q3(t,{...e,specIndex:i,specKey:"legends"}))})),n}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){rK(this._option.dataSet,"discreteLegendFilter",Z3),rK(this._option.dataSet,"discreteLegendDataMake",q3);const t=new Vo(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){const e=t.getSeriesField();if(!this._spec.scaleName)return e;if(!t.getRawData())return e;const i=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!i)return e;if(this._spec.field)return this._spec.field;if(!nl(i.domain))return e;const n=i.domain.find((e=>e.dataId===t.getRawData().name));return n?n.fields?.[0]??e:e}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._regions?.[0]?.getSeries()[0];if(!e)return;t.title.text=A$(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e={layout:"bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",items:this._getLegendItems(),zIndex:this.layoutZIndex,maxWidth:t.width,maxHeight:t.height,...K3(this._spec,t)};return this._addDefaultTitleText(e),e}_getLegendConstructor(){return KU}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(GU.legendItemClick,(e=>{const i=C(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(VX.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(GU.legendItemHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(GU.legendItemUnHover,(t=>{const e=C(t,"detail");this.event.emit(VX.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{const e=t.style("fill"),i=t.style("stroke"),n=t.style("lineWidth"),s=t.style("symbolType"),r=t.style("fillOpacity"),a=t.style("strokeOpacity"),o=t.style("opacity"),l=t.style("texture"),h=t.style("textureColor"),c=t.style("outerBorder"),d=t.style("innerBorder");return{label:t.key,shape:{fill:e,symbolType:s??t.shapeType??"circle",stroke:0===n||e===i?null:i,fillOpacity:b(r)?r:1,strokeOpacity:b(a)?a:1,opacity:b(o)?o:1,texture:l,texturePadding:l?1:null,textureSize:l?4:null,textureColor:h,innerBorder:d,outerBorder:c}}}));return l(this._spec.data)?this._spec.data(t):t}}const t5=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{const n=i.getRawDataStatistics().latestData,s=n?.[r]?.min,a=n?.[r]?.max;b(s)&&se&&(e=a)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},e5=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!M(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function i5(t){const{title:e={},handler:i={},rail:n={},track:s={},startText:r,endText:a,handlerText:o,sizeBackground:l,background:h={},type:d,id:u,visible:p,orient:g,position:f,data:m,defaultSelected:y,field:_,filter:v,regionId:b,regionIndex:x,seriesIndex:S,seriesId:w,padding:A,...k}=L({},t),C=k;return e.visible&&(C.title=G2(e)),C.showHandler=!1!==i.visible,M(i.style)||(C.handlerStyle=P$(i.style)),c(n.width)&&(C.railWidth=n.width),c(n.height)&&(C.railHeight=n.height),M(n.style)||(C.railStyle=P$(n.style)),M(s.style)||(C.trackStyle=P$(s.style)),C.startText=C$(r),C.endText=C$(a),C.handlerText=C$(o),M(l)||(C.sizeBackground=P$(l)),h.visible&&!M(h.style)&&(L(C,h.style),c(h.padding)&&(C.padding=h.padding)),C}function n5(t){return"color"===t||"size"===t}const s5={color:tY,size:iY},r5=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],a5=[2,10];class o5 extends J3{static type=un.continuousLegend;type=un.colorLegend;name=un.colorLegend;_field;_legendType;static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!m(i))return n5(i.type)?new o5(i,{...e,specIndex:0,specKey:"legends"}):void 0;const n=[];return i.forEach(((t,i)=>{n5(t.type)&&n.push(new o5(t,{...e,specIndex:i,specKey:"legends"}))})),n}constructor(t,e){super(t,e);const i="color"===this._spec.type?un.colorLegend:un.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),Ll(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){rK(this._option.dataSet,"continuousLegendFilter",e5),rK(this._option.dataSet,"continuousLegendDataMake",t5);const t=new Vo(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){if(t.title?.visible&&h(t.title.text)&&h(t.title.style?.text)){const e=this._field;if(e){const i=this._regions?.[0]?.getSeries()[0];if(!i)return;return void(t.title.text=A$(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const n=this._option.globalScale.getScaleSpec(i);if(!nl(n?.domain))return;const s=n.domain[0];if(0===s.fields.length)return;t.title.text=A$(this._option.dataSet.getDataView(s.dataId),s.fields[0])}else;}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i="horizontal"===e?"bottom":this.layoutOrient;let n=[];const s=this._getScaleInGlobal();s&&"linear"===s.type&&(n=s.range()),M(n)&&(n="color"===this._legendType?r5:a5);const r={...i5(this._spec),layout:e,align:i,zIndex:this.layoutZIndex,min:this._legendData.getLatestData()[0]??0,max:this._legendData.getLatestData()[1]??1,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:n};return this._addDefaultTitleText(r),r}_getLegendConstructor(){return s5[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",gt((e=>{const i=C(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(VX.legendFilter,{model:this,value:i,event:e})}),30))}}}const l5=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),N(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class h5 extends Y2{static speckey="indicator";static type=un.indicator;type=un.indicator;name=un.indicator;layoutType="absolute";layoutZIndex=r$.Indicator;layoutLevel=a$.Indicator;_gap=0;_activeDatum=null;_displayData;_title;_content;_indicatorComponent;_cacheAttrs;static createComponent(t,e){if(this.type!==h5.type)return null;const i=N(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map(((t,i)=>new h5(t,{...e,specIndex:i,specKey:h5.speckey})));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=this._spec.content,this._regions=this._option.getRegionsInUserIdOrIndex(N(this._spec.regionId),N(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this.setAttributeTag(!0),this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){rK(this._option.dataSet,"indicatorFilter",l5);const t=new Vo(this._option.dataSet);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 YK(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return N(this._spec.content).forEach((t=>{const e=L({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:{...P$(e.style),text:this._createText(e.field,e.style.text)}})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX??0,dy:this._spec.offsetY??0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!c(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:{...P$(this._spec.title.style),text:this._createText(this._spec.title.field,this._spec.title.style.text)}},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new rY(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){return t?this._activeDatum?this._activeDatum[t]:"":l(e)?e(this._activeDatum,void 0)??"":e??""}isRelativeModel(t){return Ll(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){this._indicatorComponent&&(this._container.removeChild(this._indicatorComponent),this._indicatorComponent=null),this._cacheAttrs=null,super.clear()}}class c5 extends Y2{static type=un.title;type=un.title;layoutType="normal";layoutZIndex=r$.Title;layoutLevel=a$.Title;_orient="top";_titleComponent;_cacheAttrs;get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,{...e}),this._orient=Uh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!m(i))return new c5(i,{...e,specKey:"title"});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new c5(t,{...e,specIndex:i,specKey:"title"}))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;b(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),b(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:b(t.width())?t.width():0,height:this._spec.height?this._spec.height:b(t.height())?t.height():0}}_getTitleAttrs(){const t=this._spec.width??this.getLayoutRect().width;return{text:this._spec.text??"",subtext:this._spec.subtext??"",x:this._spec.x??0,y:this._spec.y??0,width:t,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:this._spec.align??"left",verticalAlign:this._spec.verticalAlign??"top",textStyle:{width:t,...this._spec.textStyle},subtextStyle:{width:t,...this._spec.subtextStyle}}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new nY(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}clear(){super.clear(),this._titleComponent=null,this._cacheAttrs=null}}class d5{projection;constructor(t){if(this.projection=kJ(t.type)(),null===this.projection)throw Error("unsupported projection type!")}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}center(t){this.projection?.center?.(t)}project(t){return this.projection?.(t)}shape(t){return this.projection?.path?.(t)}scale(t){if(void 0===t)return this.projection?.scale?.();this.projection?.scale?.(t)}translate(t){if(void 0===t)return this.projection?.translate?.();this.projection?.translate?.(t)}evaluate(t,e,i){const n=this.projection.copy();return n?.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function u5(t,e){return`${Kj}_${e}_${t}`}class p5 extends Y2{static type=un.geoCoordinate;type=un.geoCoordinate;name=un.geoCoordinate;layoutType="absolute";_longitudeField;get longitudeField(){return this._longitudeField}_latitudeField;get latitudeField(){return this._latitudeField}_projectionSpec={name:u5(this.type,this.id),type:"mercator"};get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec={...t,name:this._projectionSpec.name}}_projection;_actualScale=1;_evaluated=!1;_lastHeight=0;_lastWidth=0;static createComponent(t,e){if(h(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s={...t,padding:0},r=new p5(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}effect={scaleUpdate:()=>{this.coordinateHelper()}};setAttrFromSpec(){super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=L(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>this._spec.zoomLimit?.max&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom{let i=t.zoomDelta;const n=this._actualScale;this._actualScale*=i,this._actualScalethis._spec.zoomLimit?.max&&(this._actualScale=this._spec.zoomLimit?.max,i=this._spec.zoomLimit?.max/n),e.zoomDelta=i,this.zoom(i,[t.zoomX,t.zoomY])};initEvent(){this.event.on(VX.scaleUpdate,{filter:({model:t})=>t?.id===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new d5(this._projectionSpec)}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===tq.map?e.setCoordinateHelper(t):(e.setXAxisHelper({...t,dataToPosition:t=>this.dataToLongitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),e.setYAxisHelper({...t,dataToPosition:t=>this.dataToLatitude(t[0]),getAxisType:()=>this.type,getAxisId:()=>this.id}),this._longitudeField&&e.setFieldX(this._longitudeField),this._latitudeField&&e.setFieldY(this._latitudeField))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{e.type===tq.map&&t.push(...e.getMapViewData()?.latestData??[])}))})),t}dataToPosition(t=[]){const e=this._projection?.project([t[0],t[1]]);return{x:e?.[0],y:e?.[1]}}dataToLatitude(t){const e=this._projection?.project([0,t]);return e?.[1]}dataToLongitude(t){const e=this._projection?.project([t,0]);return e?.[0]}zoom(t,e=[0,0]){let i=this._projection?.scale()??0;const n=this._projection?.translate()??[0,0];let s=n[0],r=n[1];i*=t,s-=(e[0]-s)*(t-1),r-=(e[1]-r)*(t-1),this._projection?.scale(i),this._projection?.translate([s,r])}pan=(t=[0,0])=>{const e=this._projection?.translate()??[0,0];let i=e[0],n=e[1];i+=t[0],n+=t[1],this._projection?.translate([i,n])};shape(t){return this._projection.shape(t)}evaluateProjection(t,e){const i=this._projection.evaluate(t,e,this.collectFeatures());let n=i.translate();const s=i.scale()*(this._projectionSpec.zoom??1),r=this._projectionSpec.center;return r&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:s,center:r}}rescaleMark(){this._regions.forEach((t=>{const e=t.getSeriesInType(tq.map)[0]?.getMarkInName("area");e&&t.getSeries().forEach((t=>{t.type!==tq.map&&t.getMarksInType("symbol").forEach((t=>{t.setAttribute("scaleX",(i=>t.getAttribute("size",i)*e.getAttribute("scaleX",i))),t.setAttribute("scaleY",(i=>t.getAttribute("size",i)*e.getAttribute("scaleY",i)))}))}))}))}}j(p5,U1);const g5={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},f5={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class m5 extends Y2{layoutType="absolute";gridZIndex=r$.CrossHair_Grid;labelZIndex=r$.CrossHair;trigger="hover";enable;showDefault;triggerOff="hover";get enableRemain(){return"none"===this.triggerOff}_crosshairConfig;_limitBounds;constructor(t,e){super(t,{...e}),this._spec=t,this.enable=!0,this.showDefault=!0}_getLimitBounds(){if(!this._limitBounds){const{width:t,height:e}=this._option.globalInstance.getChart()?.getCanvasRect()??{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:t,y2:e}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach(((t,i)=>this._registerEvent(t,m(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:WX.chart},this._handleEvent),this.event.on(e,{level:GX.chart},((...t)=>{this.enableRemain||this._hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_handleEvent=ft((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10);_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(g5[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(m(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(g5[e][t]),s=s.concat(g5[e][i(t)])})),{in:n,out:s}}return{in:g5[e][t],out:g5[e][i(t)]}}return null}_getAxisInfoByField(t){const e=this._option.getComponentsByKey("axes");if(!e.length)return null;let i=C(this._spec,`${t}Field.bindingAxesIndex`);if(i||(i=[],e.forEach(((e,n)=>{f5[t].includes(e.orient)&&i.push(n)}))),!i.length)return null;const n=new Map;let s=1/0,r=1/0,a=-1/0,o=-1/0;const{x:l,y:h}=this.getLayoutStartPoint();return i.forEach((t=>{s=1/0,r=1/0,a=-1/0,o=-1/0;const i=e.find((e=>e.getSpecIndex()===t));if(!i)return;i.getRegions().forEach((t=>{s=Math.min(s,t.getLayoutStartPoint().x-l),r=Math.min(r,t.getLayoutStartPoint().y-h),a=Math.max(a,t.getLayoutStartPoint().x+t.getLayoutRect().width-l),o=Math.max(o,t.getLayoutStartPoint().y+t.getLayoutRect().height-h)})),n.set(t,{x1:s,y1:r,x2:a,y2:o,axis:i})})),n}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();m(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),m(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;if(function(t,e,i){return t.x1>e||t.x2i||t.y2a||os&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function _5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}var v5,b5;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(v5||(v5={}));class x5 extends m5{static type=un.cartesianCrosshair;type=un.cartesianCrosshair;name=un.cartesianCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_xCrosshair;_xTopLabel;_xBottomLabel;_yCrosshair;_yLeftLabel;_yRightLabel;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.xField||i.yField?new x5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.xField||t.yField)&&n.push(new x5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if(t?.visible&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,v5.VERTICAL,!0),this.layoutByValue(v5.VERTICAL)}if(e?.visible&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,v5.HORIZONTAL,!1),this.layoutByValue(v5.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return zl(t.getScale().type)&&b(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){j$(e.orient),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this._hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(v5.ALL)}_hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=v5.ALL){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},n={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const s=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let r=0,a=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];r=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];a=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}i.visible=!!this.currValueX.size&&Number.isFinite(r),n.visible=!!this.currValueY.size&&Number.isFinite(a);const o={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},l={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let h,d;if(s(o,this.currValueX),s(l,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:n})=>{n=n??"";const s=t.getScale();if(jl(s.type)){const i=s._step;h=t?e.getXAxisHelper().getBandwidth?.(0):i}else if(zl(s.type)){const t=e.fieldX[0],i=e.fieldX2,s=_5(e.getViewData().latestData,+n,t,i);if(s){const a=e.dataToPositionX(s);i?(h=Math.abs(a-e.dataToPositionX1(s)),n=`${s[t]} ~ ${s[i]}`):h=1,r=a}}if(this.xHair.label?.visible){const e=l2(t.getSpec());"bottom"===t.orient?(i.bottom.visible=!0,i.bottom.text=n,i.bottom.dx=0,i.bottom.dy=e):"top"===t.orient&&(i.top.visible=!0,i.top.text=n,i.top.dx=0,i.top.dy=-e)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:i})=>{i=i??"";const s=t.getScale();if(jl(s.type)){const t=s._step;d=s?e.getYAxisHelper().getBandwidth?.(0):t}else if(zl(s.type)){const t=e.fieldY[0],n=e.fieldY2,s=_5(e.getViewData().latestData,+i,t,n);if(s){const r=e.dataToPositionY(s);n?(d=Math.abs(r-e.dataToPositionY1(s)),i=`${s[t]} ~ ${s[n]}`):d=1,a=r}}if(this.yHair.label?.visible){const e=l2(t.getSpec());"left"===t.orient?(n.left.visible=!0,n.left.text=i,n.left.dx=-e,n.left.dy=0):"right"===t.orient&&(n.right.visible=!0,n.right.text=i,n.right.dx=e,n.right.dy=0)}})),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(i.leftPos=o.x1,i.topPos=o.y1,i.height=o.y2-o.y1,i.x=r+this.getLayoutStartPoint().x,this.xHair?.label?.formatMethod){const{top:t,bottom:e}=i;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(n.leftPos=l.x1,n.topPos=l.y1,n.width=l.x2-l.x1,n.y=a+this.getLayoutStartPoint().y,this.yHair?.label?.formatMethod){const{left:t,right:e}=n;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(v5.HORIZONTAL&&this._layoutHorizontal(n,d??0),v5.VERTICAL&&this._layoutVertical(i,h??0)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t,e){if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:i,topPos:n,height:s,top:r,bottom:a,visible:o}=t;if(o){let t=0;this.xHair?.style?.sizePercent?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof this.xHair?.style?.size&&(t=this.xHair.style.size-e);const o=this.xHair.type;let l;if("line"===o?l={start:{x:i+e/2-t/2,y:n},end:{x:i+e/2+t/2,y:n+s}}:"rect"===o&&(l={start:{x:i-t/2,y:n},end:{x:i+e+t/2,y:n+s}}),this._updateCrosshair("x",o,l),r.visible){const t={x:i+e/2,y:n,...r,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"bottom"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(a.visible){const t={x:i+e/2,y:n+s,...a,...this.xHair.label,textStyle:{...this.xHair.label?.textStyle,textAlign:"center",textBaseline:"top"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:i,width:n,y:s,left:r,right:a,visible:o}=t;if(o){let t=0;this.yHair?.style?.sizePercent?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof this.yHair?.style?.size&&(t=this.yHair.style.size-e);const o=this.yHair.type;let l;if("line"===o?l={start:{x:i,y:s+e/2},end:{x:i+n,y:s+e/2}}:"rect"===o&&(l={start:{x:i,y:s-t/2},end:{x:i+n,y:s+e+t/2}}),this._updateCrosshair("y",o,l),r.visible){const t={x:i,y:s+e/2,...r,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"right",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(a.visible){const t={x:i+n,y:s+e,...a,...this.yHair.label,textStyle:{...this.yHair.label?.textStyle,textAlign:"left",textBaseline:"middle"},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EG({...i,lineStyle:r,zIndex:this.gridZIndex}):"rect"===e&&(s=new PG({...i,rectStyle:r,zIndex:this.gridZIndex})),n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new yG(e)),n.add(t)),y5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(b5||(b5={}));class S5 extends m5{static type=un.polarCrosshair;type=un.polarCrosshair;name=un.polarCrosshair;currValueX;currValueY;xHair;yHair;_cacheXCrossHairInfo;_cacheYCrossHairInfo;_radiusCrosshair;_radiusLabelCrosshair;_angleCrosshair;_angleLabelCrosshair;static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(h(i))return;if(!m(i))return i.categoryField||i.valueField?new S5(i,{...e,specKey:"crosshair"}):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new S5(t,{...e,specIndex:i,specKey:"crosshair"}))})),n}constructor(t,e){super(t,{...e}),this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}_hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{jl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis;let r=s.positionToData({x:e.x-(t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x),y:e.y-(t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y)});zl(s.getScale().type)&&b(+r)&&(r=(+r).toFixed(2));const a={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:r,axis:t.axis,center:a,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:jt.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(b5.ALL);else{if(this.enableRemain)return;this._hide()}}layoutByValue(t){if(!this.enable)return;const e=this._firstSeries();if(!e)return;let i={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},n={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:e.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){i.visible=!!this.currValueX.size;const t=e.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((({axis:n,v:s,coord:r,...a})=>{s=s??"",L(i,a);const o=e.angleAxisHelper.dataToPosition([s]);i.angle=o,this.xHair.label?.visible&&(i.label.visible=!0,i.label.text=s,i.label.offset=l2(n.getSpec())),i.startAngle=o-t/2,i.endAngle=o+t/2}))}if(this.yHair&&(n.visible=!!this.currValueY.size,this.currValueY.forEach((({axis:t,v:e,coord:i,...s})=>{e=e??"",this.yHair.label?.visible&&(n.label.visible=!0,n.label.text=e,n.label.offset=l2(t.getSpec())),n.angle=i.angle,n.axis=t,L(n,s)}))),this.enableRemain&&!i.visible&&c(this._cacheXCrossHairInfo))i=this._cacheXCrossHairInfo;else if(this.xHair?.label?.formatMethod&&i.label.visible){const{label:t}=i;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!n.visible&&c(this._cacheYCrossHairInfo))n=this._cacheYCrossHairInfo;else if(this.yHair?.label?.formatMethod&&n.label.visible){const{label:t}=n;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(b5.HORIZONTAL&&this._layoutHorizontal(n),b5.VERTICAL&&this._layoutVertical(i)),this.enableRemain&&(this._cacheXCrossHairInfo={...i,_isCache:!0},this._cacheYCrossHairInfo={...n,_isCache:!0})}_layoutVertical(t){if(t._isCache&&this.enableRemain)return;const e=this.getContainer(),{angle:i,innerRadius:n,radius:s,label:r,startAngle:a,endAngle:o,center:l,visible:h}=t;if(h){const t="rect"===this.xHair.type?"sector":"line";let h;if(h="sector"===t?{center:l,innerRadius:n,radius:s,startAngle:a,endAngle:o}:{start:$t(l,n,i),end:$t(l,s,i)},this._angleCrosshair)this._angleCrosshair.setAttributes(h);else{let i;"line"===t?i=new EG({...h,lineStyle:this.xHair.style,zIndex:this.gridZIndex}):"sector"===t&&(i=new BG({...h,sectorStyle:this.xHair.style,zIndex:this.gridZIndex})),this._angleCrosshair=i,e.add(i)}if(r.visible){const t=Bl(i),e={...$t(l,s+r.offset,i),...this.xHair.label,...r,textStyle:{...this.xHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._angleLabelCrosshair,e,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){if(t._isCache&&this.enableRemain)return;const{center:e,startAngle:i,endAngle:n,distance:s,sides:r,axis:a,label:o,point:l,radius:h,innerRadius:c,visible:d}=t,u=this.getContainer();if(d){const t=this.yHair.smooth?"circle":"polygon";let d=s;if("polygon"===t){const t=a.getCenter(),e=Kt(t,l),o=(n-i)/r,u=Math.floor((e-i)/o),p=u*o+i,g=Math.min((u+1)*o+i,n),f=$t(t,s,p),m=$t(t,s,g),y=ve([m.x,m.y],[f.x,f.y],[t.x,t.y],[l.x,l.y]);y&&(d=ct(jt.distancePN(l,y[0],y[1])+s,c,h))}const p={center:e,startAngle:i,endAngle:n,radius:d,sides:r};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(p);else{let e;e="polygon"===t?new IG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}):new RG({...p,lineStyle:this.yHair.style,zIndex:this.gridZIndex}),this._radiusCrosshair=e,u.add(e)}if(o.visible){const t=function(t){let e="center",i="middle";return e=(t=xl(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}}(i),n={...$t(e,d,i),...this.yHair.label,...o,textStyle:{...this.yHair.label?.textStyle,textAlign:t.align,textBaseline:t.baseline},zIndex:this.labelZIndex};this._updateCrosshairLabel(this._radiusLabelCrosshair,n,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){const{categoryField:t,valueField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"categoryField")),e&&e.visible&&(this.yHair=this._parseField(e,"valueField"),this.yHair.smooth=e?.line?.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new yG(e),n.add(t),i(t)),y5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{t&&(this._container?.removeChild(t),t=null)})),super.clear()}}const w5=t=>P$({...t}),A5=t=>({...t,style:{...P$(t.style)}}),k5=t=>{const e=w5(t?.slider?.trackStyle??{}),i=w5(t?.slider?.railStyle??{}),n=(s=t?.slider?.handlerStyle??{},P$({...s}));var s;const r=A5(t?.controller?.start??{}),a=A5(t?.controller?.pause??{}),o=A5(t?.controller?.backward??{}),l=A5(t?.controller?.forward??{});return{...t,direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:{...t.slider,trackStyle:e,railStyle:i,handlerStyle:n},controller:{...t.controller,start:r,pause:a,backward:o,forward:l}}},M5=(t,e)=>({...k5(t),data:e,type:"continuous"}),C5=(t,e)=>({...k5(t),data:e,type:"discrete"}),T5=t=>"left"===t||"right"===t,E5=t=>"top"===t||"bottom"===t;class P5 extends Y2{layoutZIndex=r$.Player;layoutLevel=a$.Player;static type=un.player;type=un.player;specKey="player";_orient="bottom";_specs;_playerComponent;_cacheAttrs;_direction;_alternate;_dx;_dy;_width;_height;_position;get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}static createComponent=(t,e)=>{const i=t.player;return h(i)||!1===i.visible?null:new P5(i,e)};setAttrFromSpec(){super.setAttrFromSpec(),this._orient=this._spec.orient??"bottom",this._specs=this._spec.specs??[],this._direction=this._spec.direction??"default",this._alternate=this._spec.alternate??!1,this._dx=this._spec.dx??0,this._dy=this._spec.dy??0,this._position=this._spec.position??"middle"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),b(t.x)){const e=T5(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(b(t.y)){const e=E5(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_getPlayerAttrs=()=>{const t=this._spec.type,e={size:{width:this._width,height:this._height},dx:this._spec.dx??0+this._dx,dy:this._spec.dy??0+this._dy};return"discrete"===t?{...C5(this._spec,this._specs),...e}:{...M5(this._spec,this._specs),...e}};_createOrUpdatePlayerComponent=()=>{const t={...this._getPlayerAttrs()},e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new _Y(t):this._playerComponent=new bY(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())};_computeLayoutRect(t,e,i){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 v(this._spec.width)?Math.min(t.width,Number(this._spec.width)):T5(this._orient)?this._maxSize():t.width}_computeHeight(t){return v(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):E5(this._orient)?this._maxSize():t.height}_computeDx(t){return T5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return E5(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}_maxSize=()=>Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size),(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10);_sliderExceededSize=()=>{const t=(T5(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)??10,e=Math.max(...N(this._spec.controller.start?.style?.size),...N(this._spec.controller.pause?.style?.size),...N(this._spec.controller.backward?.style?.size),...N(this._spec.controller.forward?.style?.size));return t>=e?t-e:0};_initEvent=()=>{this._option.globalInstance.on(VX.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnEnd,(()=>{this.event.emit(VX.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(pY.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];N(i.data).forEach((t=>{this._option?.globalInstance?.updateData(t.id,t.values)})),this.event.emit(VX.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(pY.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(VX.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}const R5=(t,e)=>Tl(t[0].latestData,e.field),B5=(t,e)=>El(t[0].latestData,e.field);function I5(t,e){return function(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return b(n)&&(t+=n),t}),0)}(t[0].latestData,e.field)}function D5(t,e){return Pl(t[0].latestData,e.field)}function L5(t,e){return Rl(t[0].latestData,e.field)}function O5(t,e){return function(t,e){return Math.sqrt(Rl(t,e))}(t[0].latestData,e.field)}function F5(t,e){return function(t,e){return Z(t.map((t=>t[e])))}(t[0].latestData,e.field)}function z5(t,e){const i={min:R5,max:B5,sum:I5,average:D5,variance:L5,standardDeviation:O5,median:F5},n=[];return e.forEach((e=>{const s={x:null,y:null};if(c(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(c(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function H5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.x)){v(t.x)&&V5(u,t.x,s)&&n?.getXAxisHelper().setExtendDomain?.("marker_xAxis_extend",t.x);const e=n.getXAxisHelper().dataToPosition([t.x])+a.x,i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),c=Math.min(a.y,l.y);h.push([{x:e,y:i},{x:e,y:c}])}})),h}function j5(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),h=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{if(c(t.y)){v(t.y)&&V5(u,t.y,s)&&n.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y);const e=Math.min(a.x,l.x),i=n.getYAxisHelper().dataToPosition([t.y])+a.y,c=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);h.push([{x:e,y:i},{x:c,y:i}])}})),h}function N5(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{const s=t?.getRefRelativeSeries?t.getRefRelativeSeries():e,r=s.getRegion().getLayoutStartPoint(),a=s.getXAxisHelper().getScale(0).domain(),o=s.getYAxisHelper().getScale(0).domain();v(t.x)&&V5(a,t.x,i)&&s.getXAxisHelper()?.setExtendDomain?.("marker_xAxis_extend",t.x),v(t.y)&&V5(o,t.y,i)&&s.getYAxisHelper()?.setExtendDomain?.("marker_yAxis_extend",t.y),n.push({x:s.getXAxisHelper().dataToPosition([t.x])+r.x,y:s.getYAxisHelper().dataToPosition([t.y])+r.y})})),n}function V5(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const W5=["sum","average","min","max","variance","standardDeviation","median"];class G5 extends Y2{layoutType="absolute";_startRelativeSeries;_endRelativeSeries;_relativeSeries;_markerData;_markerComponent;created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||W5.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){return(t.coordinates??N(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){(this._spec.visible??!0)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){let i;return i=this._option.getSeriesInUserIdOrIndex(N(t),[e])?.[0],i||(i=this._relativeSeries??this.getFirstSeries()),i}_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)}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Tl(t,e),r=El(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Y5 extends G5{static type=un.markLine;type=un.markLine;name=un.markLine;layoutZIndex=r$.MarkLine;static speckey="markLine";static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new Y5(i,{...e,specKey:Y5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new Y5(t,{...e,specIndex:i,specKey:Y5.speckey}))})),n}_createMarkerComponent(){const t=new LU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0},{x:0,y:0}],lineStyle:P$(this._spec?.line.style),startSymbol:{...this._spec?.startSymbol,visible:this._spec.startSymbol?.visible,style:P$(this._spec.startSymbol?.style)},endSymbol:{...this._spec?.endSymbol,visible:this._spec.endSymbol?.visible,style:P$(this._spec.endSymbol?.style)},label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markLine",this._markerComponent.id=this._spec.id??`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)||c(t.coordinates)&&c(t.process)&&c(t.process.x),a=c(t.y)||c(t.coordinates)&&c(t.process)&&c(t.process.y),o=c(t.coordinates)&&(!c(t.process)||"process"in t&&"xy"in t.process),l=c(t.positions),h=t?.autoRange??!1;let d=[];r?d=H5(e,i,n,s,h)[0]:a?d=j5(e,i,n,s,h)[0]:o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new Vo(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new Vo(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}class X5 extends G5{static type=un.markArea;type=un.markArea;name=un.markArea;layoutZIndex=r$.MarkArea;static speckey="markArea";static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new X5(i,{...e,specKey:X5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new X5(t,{...e,specIndex:i,specKey:X5.speckey}))})),n}_createMarkerComponent(){const t=new OU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,points:[{x:0,y:0}],areaStyle:P$(this._spec.area?.style),label:{...this._spec.label,padding:this._spec.label?.labelBackground?.padding,shape:{...P$(this._spec.label?.shape),visible:this._spec.label?.shape?.visible??!1},panel:{...P$(this._spec.label?.labelBackground?.style),visible:this._spec.label?.labelBackground?.visible??!0},textStyle:P$(this._spec.label?.style)}});this._markerComponent=t,this._markerComponent.name="markArea",this._markerComponent.id=this._spec.id??`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._startRelativeSeries,n=this._endRelativeSeries,s=this._relativeSeries,r=c(t.x)&&c(t.x1),a=c(t.y)&&c(t.y1),o=c(t.coordinates),l=c(t.positions),h=t?.autoRange??!1;let d=[],u=[];r?(u=H5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):a?(u=j5(e,i,n,s,h),d=[...u[0],u[1][1],u[1][0]]):o?d=N5(e,s,h):l&&(d=t.positions),this._markerComponent?.setAttributes({points:d})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=c(t.x)&&c(t.x1),n=c(t.y)&&c(t.y1),s=c(t.coordinates);if(!i&&!n&&!s)return null;let r;rK(this._option.dataSet,"markerAggregation",z5),rK(this._option.dataSet,"markerRegression",U5),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new Vo(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}class $5 extends G5{static type=un.markPoint;type=un.markPoint;name=un.markPoint;layoutZIndex=r$.MarkPoint;static speckey="markPoint";static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(h(i))return;if(!m(i)&&!1!==i.visible)return new $5(i,{...e,specKey:$5.speckey});const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new $5(t,{...e,specIndex:i,specKey:$5.speckey}))})),n}_createMarkerComponent(){const t=new FU({zIndex:this.layoutZIndex,interactive:this._spec.interactive??!1,position:{x:0,y:0},itemLine:{lineStyle:P$(this._spec.itemLine?.line?.style),...this._spec.itemLine},itemContent:{symbolStyle:P$(this._spec.itemContent?.symbol?.style),imageStyle:this._spec.itemContent?.image?.style,textStyle:{...this._spec.itemContent?.text,padding:this._spec.itemContent?.text?.labelBackground?.padding,shape:{...P$(this._spec.itemContent?.text?.shape),visible:this._spec.itemContent?.text?.shape?.visible??!1},panel:{...P$(this._spec.itemContent?.text?.labelBackground?.style),visible:this._spec.itemContent?.text?.labelBackground?.visible??!0},textStyle:P$(this._spec.itemContent?.text?.style)},richTextStyle:this._spec.itemContent?.richText?.style,...this._spec.itemContent}});this._markerComponent=t,this._markerComponent.name="markPoint",this._markerComponent.id=this._spec.id??`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){const t=this._spec,e=this._markerData,i=this._relativeSeries,n="position"in t;let s;"coordinate"in t?s=N5(e,i,t?.autoRange??!1)[0]:n&&(s=t.position),this._markerComponent?.setAttributes({position:s})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!c(t.coordinate))return;rK(this._option.dataSet,"markerAggregation",z5);const i=this._processSpecCoo(t),n=new Vo(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}const K5=(t,e,i)=>h(t)?t:l(t)?t(e,i):t,q5=(t,e,i)=>{if(h(t))return t;if(m(t)){const n=[];return t.forEach((t=>{if(l(t)){const s=t(e,i);c(s)&&n.push(s)}else n.push(t)})),n}return l(t)?t(e,i):t};const Z5=(t,e)=>(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight),J5="vchart-tooltip-container",Q5=20,t4={key:"其他",value:"..."},e4={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(")}};class i4{static dom=`${Kj}_TOOLTIP_HANDLER_DOM`;static canvas=`${Kj}_TOOLTIP_HANDLER_CANVAS`}const n4=(t,e,i)=>{const n=K5(e.key,t,i),s=K5(e.value,t,i),r=!1!==K5(e.visible,t,i)&&(c(n)||c(s)),a=K5(e.isKeyAdaptive,t,i),o=K5(e.shapeType,t,i),l=K5(e.shapeColor,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l}},s4=(t,e,i)=>t.tooltipHelper?.getDefaultTooltipPattern(e,i)??null,r4=(t,e)=>{let i;if(c(t))if(v(t))i=t;else if(l(t)){const n=t(e);v(n)&&(i=n)}return i},a4=(t,e)=>{const i=b$(e);if(!e.multiLine){const{width:e,height:n}=i.fullMeasure(t);return{width:e,height:n,text:t}}let n=t.split("\n");n=n.map(((t,e)=>e({...e,text:t})))});return{width:t.width(),height:t.height(),text:n}}return{width:s,height:r,text:n}};function o4(t={},e){return{fill:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:t.fontFamily??e?.fontFamily??Ej,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing??10,multiLine:t.multiLine??!1,maxWidth:t.maxWidth,wordBreak:t.wordBreak??"break-word"}}var l4;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(l4||(l4={}));class h4{type;_visible=!0;_option;_chartOption;_id="";get id(){return this._id}_env;get env(){return this._env}_component;_chartContainer;_compiler;_cacheViewSpec;_cacheActualTooltip;_attributeCache=null;_style;_container;constructor(t,e){this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}showTooltip=(t,e,i)=>{let n=!!i.changePositionOnly;return i.changePositionOnly&&this._cacheActualTooltip?.activeType===t||(n=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),n&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(n,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,n,t,e)};changeTooltip;_changeTooltip=(t,e,i,n,s)=>{if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?.hideTooltip?(t.handler?.hideTooltip(e),l4.success):(this._updateTooltip(!1,e),l4.success)}if(h(n)||h(s))return l4.failed;let r;if(i&&this._cacheViewSpec?r=this._cacheViewSpec:(r=((t,e,i,n)=>{const s={...e,activeType:t};let r={},a={};if("mark"===t&&i){const t=i.tooltipHelper?.spec??{};if(c(t.visible)||c(t.activeType)?s.visible=bq(t).includes("mark"):c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("mark"):s.visible=!0,s.handler=t.handler??e.handler??void 0,s.handler?.showTooltip)return s;r=s4(i,"mark")??{},a=L({},R(e.mark),R(t.mark))}else if("dimension"===t&&n?.length){const t=n.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(c))),[]);if(t.every((t=>!bq(t.tooltipHelper?.spec).includes("dimension")))?s.visible=!1:c(e.visible)||c(e.activeType)?s.visible=bq(e).includes("dimension"):s.visible=!0,s.handler=e.handler??void 0,s.handler?.showTooltip)return s;const i=[];n[0].data.forEach((t=>{const{series:e}=t,s=[{...n[0],data:[t]}],r=s4(e,"dimension",s);r&&i.push(r)}));const o=[];i.forEach((({content:t})=>{l(t)?o.push(t):o.push(...N(t))})),r={...i[0],content:o};let d={};const u=t.filter((t=>{const e=t.tooltipHelper?.spec;return c(e?.dimension)&&bq(e).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(u.length){let t=[];u.every((({content:t})=>h(t)))?t=void 0:u.forEach((({content:e})=>{h(e)||(l(e)?t?.push(e):t?.push(...N(e)))})),d={...u[0],content:t}}a=L({},R(e.dimension),d)}const o=r.title,d={hasShape:a.hasShape??o?.hasShape,shapeType:a.shapeType??o?.shapeType,shapeColor:a.shapeColor??o?.shapeColor};if(c(a.title))if(l(a.title)){const t=a.title;a.title=(e,i)=>{const n=t(e,i)??{};return{...d,...n}}}else a.title={...r.title,...d,...a.title};else a.title={...r.title,...d};const u=t=>({hasShape:a.hasShape??t?.hasShape,shapeType:a.shapeType??t?.shapeType,shapeColor:a.shapeColor??t?.shapeColor}),p=N(r.content);if(c(a.content))if(l(a.content)){const t=a.content;a.content=(e,i)=>{const n=N(t(e,i)??[]);return n.forEach(((t,e)=>{n[e]={...u(p[0]),...t}})),n}}else{const t=N(a.content);t.forEach(((e,i)=>{t[i]={...u(p[0]),...e}}))}else a.content=p.map((t=>({...t,...u(t)})));return s[t]={...r,...a,activeType:t},s})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=r),!1===r.visible)return l4.failed;if(r.handler?.showTooltip)return r.handler?.showTooltip(n,s,e)??l4.success;const a=r[n];if(!a)return l4.failed;let o;return i&&this._cacheActualTooltip?o=this._cacheActualTooltip:(o=this._getActualTooltipContent(a,s,e),a.updateTitle&&(o.title=a.updateTitle(o.title,s,e)),a.updateContent&&(o.content=a.updateContent(o.content,s,e))),h(o.title?.key)&&h(o.title?.value)&&!o.content?.length?l4.failed:(this._cacheActualTooltip=o,this._changeTooltipPosition(!!i,o,r,n,s,e))};changeTooltipPosition;_changeTooltipPosition=(t,e,i,n,s,r)=>{const a=r.event;if(i.handler?.showTooltip)return i.handler.showTooltip(n,s,r)??l4.success;const o=i[n];if(!o)return l4.failed;const l=this._getActualTooltipPosition(e,q5(o.position,s,r),r,this._getParentElement(i),t);e.position=l,o.updatePosition&&(e.position=o.updatePosition(e.position,s,r));let h=!1!==o?.visible;return s&&"mouseout"!==a.type&&e.visible&&(e.title||e.content)||(h=!1),this._updateTooltip(h,{...r,changePositionOnly:t},e),l4.success};hideTooltip(t){this.changeTooltip(!1,t)}release(){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();t.handler?.release?t.handler?.release():this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=v(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,ft(t,i)}_getDefaultOption(){const{offset:t}=this._component.getSpec();return{...e4,offsetX:t?.x??e4.offsetX,offsetY:t?.y??e4.offsetY}}_getActualTooltipContent=(t,e,i)=>{const n=q5(t.visible,e,i);let s=null;s=((t,e,i)=>{if(!e||"mouseout"===i?.event?.type)return null;const n=q5(t.title,e,i),s=N(q5(t.content,e,i)),r={title:{value:n?.value?.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:a=Q5}=t,o=!1!==K5(n?.visible,e,i);if(n&&o){if(r.title.hasShape=n.hasShape,c(n.value)){r.title={hasShape:n.hasShape,shapeHollow:n.shapeHollow};const t=function(t){const e=t[0]?.series?[{data:t,value:""}]:t;for(const{data:t}of e)for(const{datum:e}of t)for(const t of e??[])if(t)return t}(e);r.title.value=K5(n?.value,t,i)}}else r.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of s??[]){const n=n4(e[0]?.datum[0],t,i);if(!1!==n.visible){if(r.content.length===a-1){r.content.push({...n,...t4});break}if(!(r.content.lengthh(t.seriesId)||t.seriesId===n.id))??[];for(const n of e){for(const e of t){const t=n4(n,e,i);if(!1!==t.visible){if(r.content.length===a-1){r.content.push({...t,...t4});break}if(!(r.content.length=a)break}if(r.content.length>=a)break}if(r.content.length>=a)break}return r.title&&(r.content.length>0&&r.content[0].shapeType?(h(r.title.shapeType)&&(r.title.shapeType=r.content[0].shapeType),h(r.title.shapeColor)&&(r.title.shapeColor=r.content[0].shapeColor)):r.title.hasShape=!1),r})(t,e,i);return{...s,visible:!!c(s)&&!1!==n,activeType:t.activeType}};_getActualTooltipPosition=(t,e,i,n,s)=>{const r=i.event,{width:a=0,height:o=0}=this._getTooltipBoxSize(t,s)??{},{offsetX:l,offsetY:h}=this._option,u=this._component.getSpec(),p="canvas"===u.renderMode,g=i?.chart?.getCanvasRect(),f=g?.width??qj,m=g?.height??Zj;let y,_,v,x,S,w,A=!1;if(d(e)){const{left:t,right:i,top:n,bottom:s}=e;y=r4(t,r),_=r4(n,r),v=r4(i,r),x=r4(s,r)}else if(c(e)&&"mark"===t.activeType){A=!0;const t=i.item,n=i.model,s=t?.getBounds(),r=n?.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:c}=s;switch(t+=r.x,n+=r.x,i+=r.y,c+=r.y,e){case H$.left:y=t-a-l,_=(i+c)/2-o/2;break;case H$.right:y=n+l,_=(i+c)/2-o/2;break;case H$.top:y=(t+n)/2-a/2,_=i-o-h;break;case H$.bottom:y=(t+n)/2-a/2,_=c+h;break;case H$.inside:y=(t+n)/2-a/2,_=(i+c)/2-o/2}}}const k={width:0,height:0},M=(t=0)=>({x:t,y:t});let C=M(),T=M(),E=1,P=1;if(Zo(this._env)&&!u.confine){if(k.width=window.innerWidth,k.height=window.innerHeight,!p){T=n.getBoundingClientRect();const t=this._compiler.getCanvas()??this._chartContainer,e=t.getBoundingClientRect();C={x:e.x-T.x,y:e.y-T.y},E=Z5(t,e),P=Z5(n,T)}}else k.width=f,k.height=m;const{canvasX:R,canvasY:B}=r;S=b(y)?y:b(v)?f-a-v:R+l,w=b(_)?_:b(x)?m-o-x:B+h,S*=E,w*=E,Zo(this._env)&&(S+=C.x,w+=C.y),S/=P,w/=P;const{width:I,height:D}=k;return(S+a)*P+T.x>I&&(A?S=(I-T.x)/P-a:S-=2*l+a),(w+o)*P+T.y>D&&(A?w=(D-T.y)/P-o:w-=2*h+o),S*P+T.x<0&&(S=0-T.x/P),w*P+T.y<0&&(w=0-T.y/P),{x:S,y:w}};_getTooltipBoxSize(t,e){return e&&!h(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l={...e,title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0};["key","value","shape"].forEach((t=>{delete l[t]}));const{title:h={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:m="",hasShape:y,shapeType:_="",shapeHollow:v,shapeColor:b}=h;if(l.title.visible=f,f){const{text:t,width:e,height:i}=a4(m,s);if(l.title.value={width:e,height:i,text:t,multiLine:s.multiLine,wordBreak:s.wordBreak},u=e,g=i,y&&WP[_]){const t={symbolType:_};v?t.stroke=b:t.fill=b,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],h=[],d=[];l.content=t.map(((l,u)=>{const g={height:0,spaceRow:i};let f=0;const{hasShape:m,key:y,shapeColor:_,shapeHollow:v,shapeType:b="",value:x,isKeyAdaptive:S}=l;if(c(y)){const{width:t,height:e,text:i}=a4(y,a);g.key={width:t,height:e,text:i,multiLine:a.multiLine,wordBreak:s.wordBreak},S?h.push(t):n.push(t),f=Math.max(f,e)}if(c(x)){const{width:t,height:e,text:i}=a4(x,o);g.value={width:t,height:e,text:i,multiLine:o.multiLine,wordBreak:s.wordBreak},d.push(t),f=Math.max(f,e)}if(m&&WP[b]){e=!0;const t={visible:!0,symbolType:b};v?t.stroke=_:t.fill=_,f=Math.max(r.size,f),g.shape=t}else g.shape={visible:!1};return g.height=f,p+=f,uc(t)?m(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:e??"initial";function d4(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=L({},e,t),d={};return d.fontFamily=i,d.fontSize=c4(n),d.color=s,d.textAlign=r,d.lineHeight=c4(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=c4(c),d}function u4(t,e){if(!t)return;const{size:i}=L({},e,t),n={};return n.width=c4(i),n}class p4{static type="tooltipModel";static isInstance(t){return!!t&&t.type===p4.type}type=p4.type;parent;childIndex;_option;setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}_renderContentCache=null;children={};product;getParentEl(){return p4.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.parent=t,this._option=e,this.childIndex=i??0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){return!!this.product?.style?.visibility&&"hidden"!==this.product.style.visibility}release(){Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(this.getParentEl()?.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=qo?.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(p4.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}const g4={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},f4={boxSizing:"border-box"},m4={display:"flex",whiteSpace:"nowrap"},y4={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},_4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},v4={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},b4={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},x4={lineHeight:"normal"};class S4 extends p4{svg;_svgHtmlCache;init(t,e,i){if(!this.product){const n=this.createElement(i??"div",[...t??[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){if(!t?.hasShape||!t.shapeType||!WP[t.shapeType])return"";const{shapeType:e,size:i,color:n,hollow:s=!1,marginTop:r="0px"}=t,a=WP[e].pathStr;let o="currentColor";if(!n||f(n)||s)return o=s?"none":n??"currentColor",`\n \n \n \n `;if(d(n)){o="gradientColor";let t="";return"radial"===n.gradient?t=`\n \n ${(n.stops??[]).map((t=>``))}\n \t\n `:"linear"===n.gradient&&(t=`\n \n ${(n.stops??[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class w4 extends p4{init(t,e,i){this.product||(this.product=this.createElement(i??"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class A4 extends p4{className;constructor(t,e,i,n){super(t,e,n),this.className=i}init(){this.product||(this.product=this.createElement("div",[this.className]));const t=this._option.getTooltipActual()?.content??[];if("shape-box"!==this.className||t.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((e=>{const i=$(e);i>=t.length&&(this.children[i].release(),delete this.children[i])}));for(let e=0;e{const e=$(t);this.children[e].release(),delete this.children[e]}))}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},y4,t.content,this._getContentColumnStyle()));const e=this._option.getTooltipActual()?.content??[],i=this._option.getTooltipAttributes()?.content??[];e.forEach(((e,n)=>{let s={};if("key-box"===this.className){const{key:r,isKeyAdaptive:a}=e;s=L({},a?v4:_4,{height:c4(i[n].height),...t.keyColumn.item});f(r)&&""!==r?.trim?.()||v(r)||s.visibility?s.visibility="visible":s.visibility="hidden",this.children[n].setStyle(s)}else"value-box"===this.className?(s=L({},b4,{height:c4(i[n].height),...t.valueColumn.item}),this.children[n].setStyle(s)):"shape-box"===this.className&&(s=L({},x4,{height:c4(i[n].height),...t.shapeColumn.item}),this.children[n]?.setStyle(s,this._getShapeSvgOption(e)))}))}setContent(){const t=this._option.getTooltipActual()?.content??[],e=this._option.getTooltipAttributes()?.content??[];t.forEach(((t,i)=>{let n;if("key-box"===this.className){const s=t.key;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else if("value-box"===this.className){const s=t.value;n=f(s)&&""!==s?.trim?.()||v(s)?s:"",this.children[i]?.setContent(n,e[i].value?.multiLine)}else"shape-box"===this.className&&(n=this._getShapeSvgOption(t),this.children[i]?.setContent(n))}))}_getContentColumnStyle(){const t=this._option.getTooltipStyle();switch(this.className){case"shape-box":const e=this._option.getTooltipActual()?.content??[];return{...t.shapeColumn,..."shape-box"!==this.className||e.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"}};case"key-box":return t.keyColumn;case"value-box":return t.valueColumn}}_getShapeSvgOption(t){const e=this._option.getTooltipStyle();return{hasShape:t.hasShape,shapeType:t.shapeType,size:e.shapeColumn.item?.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${e.keyColumn.item?.lineHeight??e.keyColumn.item?.fontSize??"18px"} - ${e.shapeColumn.item?.width??"8px"}) / 2)`}}}class k4 extends p4{shapeBox;keyBox;valueBox;init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new A4(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new A4(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new A4(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(L({},m4,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class M4 extends p4{shape;textSpan;init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;e?.hasShape&&e?.shapeType?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new S4(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new w4(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){const e=this._option.getTooltipStyle(),i=this._option.getTooltipActual(),{title:n}=i;super.setStyle(L({},g4,e.title,t)),this.shape?.setStyle({paddingRight:e.shapeColumn.item?.marginRight},{hasShape:n?.hasShape,shapeType:n?.shapeType,size:e.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow})}setContent(){const t=this._option.getTooltipStyle(),e=this._option.getTooltipActual(),i=this._option.getTooltipAttributes(),{title:n}=e;this.init(),this.shape?.setStyle(void 0,{hasShape:n?.hasShape,shapeType:n?.shapeType,size:t.shapeColumn.item?.width,color:n?.shapeColor,hollow:n?.shapeHollow}),this.textSpan?.setContent(n?.value,i.title?.value?.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class C4 extends p4{title=null;content=null;_classList;_id;constructor(t,e,i,n){super(t,e,0),this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){const t=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:e}=t;!1!==e?.visible&&c(e?.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(t.content??[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new M4(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new k4(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(L({},f4,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class T4 extends h4{type=i4.dom;_tooltipContainer=qo?.body;_domStyle;_tooltipActual;model;getVisibility(){return!!this.model?.getVisibility()}setVisibility(t){t!==this.getVisibility()&&this.model?.setVisibility(t)}constructor(t,e){super(t,e),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),{parentElement:e}=t;if(qo&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){this.model?.release(),this._container=null}_updateTooltip(t,e,i){if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:n=0,y:s=0}=i.position??{},r=this.model.product;r&&(r.style.transform=`translate3d(${n}px, ${s}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=function(t,e){const{panel:{fill:i,shadow:n,shadowBlur:s,shadowColor:r,shadowOffsetX:a,shadowOffsetY:o,shadowSpread:l,cornerRadius:h,stroke:d,lineWidth:u=0},padding:p,key:g,value:f,title:m,shape:y,enterable:_,spaceRow:v,transitionDuration:b}=t,x=i,S={panel:{width:c4((e?.panel?.width??0)+2*u),height:c4((e?.panel?.height??0)+2*u),paddingBottom:c4(p.bottom),paddingLeft:c4(p.left),paddingRight:c4(p.right),paddingTop:c4(p.top),borderColor:d,borderWidth:c4(u),borderRadius:c4(h),backgroundColor:x?`${x}`:"transparent",boxShadow:n?`${a}px ${o}px ${s}px ${l}px ${r}`:"initial",pointerEvents:_?"auto":"none",transitionDuration:b?`${b}ms`:"initial",transitionProperty:b?"transform":"initial",transitionTimingFunction:b?"ease-out":"initial"},title:d4(m),content:{},shapeColumn:{item:u4(y),width:c4(y.size),marginRight:c4(y.spacing??8)},keyColumn:{item:d4(g),width:c4(e?.keyWidth),marginRight:c4(g.spacing??26)},valueColumn:{item:d4(f),width:c4(e?.valueWidth),marginRight:c4(f.spacing??0)},spaceRow:c4(v)};if(c(v)){const t=v/2;[S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((e=>{e.marginTop=c4(t),e.marginBottom=e.marginTop})),S.content.marginTop=c4(-t),S.content.marginBottom=S.content.marginTop}else[S.content,S.shapeColumn.item,S.keyColumn.item,S.valueColumn.item].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return S}(this._style,this._attributeCache)}_getParentElement(t){return this._container??super._getParentElement(t)}reInit(){super.reInit(),this._initStyle()}}class E4 extends h4{type=i4.canvas;_layer;_el;_tooltipCanvasId;_tooltipComponent;constructor(t,e){super(t,e),this._tooltipCanvasId=this._chartOption.modeParams?.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new CY({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),n.renderNextFrame()));this._tooltipComponent||this._initTooltipComponent(n);const s=i?.position;e.changePositionOnly?c(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes({visible:!0,...this._attributeCache,...s}),this._tooltipComponent.attribute.visible||this._tooltipComponent.showAll()}release(){super.release(),this._layer?.release()}}class P4{component;activeType;constructor(t){this.component=t}_showTooltipByHandler=(t,e)=>this.component.tooltipHandler?.showTooltip&&c(t)?this.component.tooltipHandler.showTooltip(this.activeType,t,e)??l4.success:l4.failed}class R4 extends P4{activeType="dimension";showTooltip(t,e,i){const n={...e,dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i};return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!(!xq(t)&&!h(n))||!!n.activeType.includes("dimension")}getMouseEventData(t){let e,i;const n=t.event.viewX,s=t.event.viewY,r=this.component.getChart(),a={x:n,y:s};if(e=[...X$(r,a)??[],...Z$(r,a)??[]],0===e.length)e=void 0;else if(e.length>1){const t=e.filter((t=>{const e=t.axis;let i;for(const t of e?.getRegions()??[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){i=e;break}if(c(i))break}return c(i)&&i.getDimensionField()===i.fieldY?"left"===e.orient||"right"===e.orient:"bottom"===e.orient||"top"===e.orient}))[0]??e[0];e=[t]}return[...this.component.getOption().getAllSeries()??[]].some((e=>{const i=e.tooltipHelper?.ignoreTriggerSet.dimension;return t.model&&i?.has(t.model)||t.mark&&i?.has(t.mark)}))&&(i=!0),{tooltipInfo:e,ignore:i}}_preprocessDimensionInfo(t){const e=[];if(t?.forEach((t=>{const i={...t,data:t.data.filter((({series:t})=>!1!==t.getSpec()?.tooltip?.visible))};i.data.length>0&&e.push(i)})),e.length>0)return e}}class B4 extends P4{activeType="mark";showTooltip(t,e,i){const{datum:n,series:s}=t,r=[{datum:[n],series:s}],a={...e,changePositionOnly:i};return this._showTooltipByHandler(r,a)}shouldHandleTooltip(t,e){const{tooltipInfo:i}=e;if(h(i))return!1;if(![i4.dom,i4.canvas].includes(this.component.tooltipHandler.type))return!0;const n=t.model?.tooltipHelper;return!!n?.activeType.includes("mark")}getMouseEventData(t){let e,i;if("series"===t.model?.modelType){const n=t.model,s=n.tooltipHelper,r=s?.activeTriggerSet.mark,a=s?.ignoreTriggerSet.mark;r?.has(t.model)||r?.has(t.mark)?e={mark:t.mark,datum:t.datum,series:n}:(a?.has(t.model)||a?.has(t.mark))&&(i=!0)}return{tooltipInfo:e,ignore:i}}}const I4=t=>c(t)&&!m(t),D4=t=>c(t)&&m(t);class L4 extends Y2{static type=un.tooltip;type=un.tooltip;name=un.tooltip;layoutType="absolute";static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!m(i))return new L4(i,{...e,specKey:"tooltip"});const n=[];return i.forEach(((t,i)=>{n.push(new L4(t,{...e,specIndex:i,specKey:"tooltip"}))})),n}tooltipHandler;_alwaysShow=!1;_cacheInfo;_eventList=[];_processor;changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initHandler(),this._initProcessor(),this._initEvent()}release(){super.release(),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],this.tooltipHandler?.release?.()}_initHandler(){const t=this._spec.renderMode??"html",e=this._option.globalInstance.getTooltipHandlerByUser();if(e)this.tooltipHandler=e;else{const e="canvas"===t?E4:T4,i=`${this._spec.className}-${this._option.globalInstance.id??0}-${this._option.specIndex??0}`;this.tooltipHandler=new e(i,this)}}_initProcessor(){this._processor={mark:new B4(this),dimension:new R4(this)}}_initEvent(){const t=this._spec.trigger??"hover",e=this._option.mode;"hover"===t?(this._mountEvent("pointermove",{level:GX.chart},this._handleMouseMove),(Jo(e)||Qo(e))&&(this._mountEvent("pointerdown",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===t&&(this._mountEvent("pointertap",{level:GX.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})};_handleMouseOut=t=>{if(this._alwaysShow)return;const{clientX:e,clientY:i}=t.event;Zo(this._option.mode)&&(this._isPointerInChart({x:e,y:i})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)};_handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler({...t}),this._cacheInfo=void 0)};_handleMouseMove=t=>{if(this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||xq(t)||(n&&I4(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&D4(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):c(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!h(i)||this._handleChartMouseOut(t)};_showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}const a=this._option.globalInstance;return r&&wK.globalConfig.uniqueTooltip&&wK.hideTooltip(a.id),r};_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};_hideTooltipByHandler=t=>{this.tooltipHandler?.hideTooltip&&this.tooltipHandler.hideTooltip(t)};_initTheme(t){super._initTheme(t),this._spec.style=L({},this._theme,this._originalSpec.style)}reInit(t){super.reInit(t),this.tooltipHandler?.reInit?.()}setAttrFromSpec(){super.setAttrFromSpec();const t=this._spec;this._spec={...t,visible:!c(t.visible)||t.visible,activeType:bq(t),renderMode:"html",trigger:c(t.trigger)?t.trigger:"hover",className:c(t.className)?t.className:"vchart-tooltip-element",enterable:!!c(t.enterable)&&t.enterable,transitionDuration:c(t.transitionDuration)?t.transitionDuration:150},this._spec.triggerOff=c(t.triggerOff)?t.triggerOff:this._spec.trigger,c(t.renderMode)?this._spec.renderMode=t.renderMode:Qo(this._option.mode)&&(this._spec.renderMode="canvas"),c(t.mark)&&(this._spec.mark={...R(t.mark),activeType:"mark"}),c(t.dimension)&&(this._spec.dimension={...R(t.dimension),activeType:"dimension"}),c(t.parentElement)?f(t.parentElement)?this._spec.parentElement=globalThis.document?.getElementById(t.parentElement):this._spec.parentElement=t.parentElement:Zo(this._option.mode)&&(this._spec.parentElement=qo?.body),c(t.confine)?this._spec.confine=t.confine:this._spec.confine="canvas"===this._spec.renderMode}showTooltip(t,e){if(!this.tooltipHandler?.showTooltip)return!1;const i=vq(t,e,this.tooltipHandler,this._option);return"none"!==i&&(this._alwaysShow=!!e?.alwaysShow),i}hideTooltip(){return!!this.tooltipHandler?.hideTooltip&&(this._alwaysShow=!1,this.tooltipHandler.hideTooltip({changePositionOnly:!1,item:void 0,datum:void 0,source:WX.chart}),!0)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(h(this._cacheInfo)||h(t))return!1;if(D4(t)){if(I4(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>D$(t,e[i])))}if(D4(this._cacheInfo))return!1;const e=this._cacheInfo;return t?.datum===e.datum&&t?.mark===e.mark&&t?.series===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:e}=t;let i;if(c(e.nativeEvent)){const t=e.nativeEvent;i=t.target,t.composedPath&&t.composedPath().length>0&&(i=t.composedPath()[0])}else i=e.target;const n=this.tooltipHandler?.getTooltipContainer?.();if(c(n)&&c(i)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(i,n))return!0}return!1}getVisible(){return!0===this._spec.visible}}function O4(t){const e=[{type:"position",position:e=>{const{data:i}=e,n=t.getMeasureField()[0];return i?.[n]>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function F4(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}const z4={rect:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s=n.position??"outside";let r,a=s;"inside"!==a&&(a=t=>{const{data:i}=t,n=e.getMeasureField()[0];return"outside"===s?"horizontal"===e.direction?i?.[n]>=0?"right":"left":i?.[n]>=0?"top":"bottom":"inside-bottom"===s?"horizontal"===e.direction?"inside-left":"inside-bottom":"inside-top"===s?"horizontal"===e.direction?"inside-right":"inside-top":s}),r=!1!==n.overlap&&{strategy:n.overlap?.strategy??O4(e)};let o=!1;return f(s)&&s.includes("inside")&&(o=!0),{position:a,overlap:r,smartInvert:o}},symbol:function(t){const{series:e,baseMark:i}=t,n=i.getLabelSpec()??{},s="horizontal"===e.direction?"right":"top",r=n.position??s;let a;return a=!1!==n.overlap&&{strategy:n.overlap?.strategy??F4(),avoidBaseMark:"center"!==r},{position:r,overlap:a}}};class H4 extends Y2{static type=un.label;type=un.label;name=un.label;layoutType="absolute";layoutZIndex=r$.Label;_labelInfo;_labelComponentMap;_layoutRule;constructor(t,e){super(t,e),this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>!0===t.getLabelSpec()?.visible))&&n.push(new H4(t,{...e,specIndex:s}))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(VX.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(hV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(hV.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),Ll(this._regions,(t=>{const e=t.getMarks(),i=t.getRegion();this._labelInfo.get(i)||this._labelInfo.set(i,[]);for(let n=0;n{if("region"===this._layoutRule){const i=this._createMark({type:R$.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:R$.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{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}setLayoutStartPosition(){}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark));i.getProduct().target(n.map((t=>t.getProduct()))).configure({interactive:!1}).labelStyle((t=>{const i=t.context.markId,s=this._option.getChart().getMarkById(i);if(s){const t=z4[s.type]??z4.symbol,i=s.getLabelSpec()??{},{smartInvert:r,offset:a,overlap:o,animation:l}=i,h=this._interactiveConfig(i);return L({textStyle:{pickable:!0===i.interactive}},t(e[n.findIndex((t=>t===s))]),{smartInvert:r,offset:a,animation:l,overlap:o,...h})}})).encode(((t,i)=>{const s=i.mark.context.markId,r=this._option.getChart().getMarkById(s);return function(t,e){const{labelMark:i,series:n,baseMark:s}=t,r=s.getLabelSpec()?.formatMethod,a={text:e[n.getMeasureField()[0]],data:e},o=Object.keys(i.stateStyle.normal);for(const t of o){const n=i.getAttribute(t,e);a[t]=n,"text"===t&&r&&(a[t]=r(a[t],e))}return a}(e[n.findIndex((t=>t===r))],t)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:e}),t.getProduct()?.configure({context:{model:this}})}))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._labelComponentMap.forEach(((t,e)=>{e.getProduct()&&e.getProduct().release()}))}}class j4{static type;_chartLayoutRect={x:0,y:0,width:1,height:1};_chartViewBox;_col=1;_row=1;_colSize;_rowSize;_colElements;_rowElements;_gridInfo;_elementMap=new Map;constructor(t){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.initUserSetting()}standardizationSpec(t){t.col=t.col??1,t.row=t.row??1,t.elements=t.elements??[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(b(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:l(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){const e=this._elementMap.get(t);if(e)return e;const i=t;let n;return n=this._gridInfo.elements?.find((t=>{if("modelId"in t&&c(t.modelId)){if(c(i.userId)&&i.userId===t.modelId)return!0}else if("modelKey"in t&&c(t.modelKey)&&"modelIndex"in t&&c(t.modelIndex)&&i.specKey===t.modelKey&&i.getSpecIndex()===t.modelIndex)return!0;return!1})),n||(n={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,n),n}getSizeFromGird(t,e){const i="col"===e?this._colSize:this._rowSize;let n=0;for(let s=t[e];s1)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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>N4(t))),a=s.filter((t=>!N4(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>N4(t))),h=o.filter((t=>!N4(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){const n="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),s="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),r=this.getItemGridInfo(t),a={width:(s(r,"col")??this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(n(r,"row")??this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},o=t.computeBoundsInRect(a);b(o.width)||(o.width=a.width),b(o.height)||(o.height=a.height),t.setLayoutRect("grid"!==e?o:a),this.setItemLayoutSizeToGrid(t,r)}}function N4(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class V4 extends VK{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&j$(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&N$(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var W4;W4={},L(xG.poptip,W4),Wk.load(CG),wK.useChart([J1,x2,Q1,t2,L2,S2,A2,k2,I2,E2,n2,O2,v2,b2,M2,N2,V2,r2,a2,C2,R2,B2,F2,i2,z2,H2,e2,D2,m2,P2,y2]),wK.useComponent([V3,G3,U3,$3,X3,Q3,o5,L4,x5,S5,Z2,q2,h5,p5,Y5,c5,X5,P5,H4,$5,Q2,J2,c3]),B$.registerLayout("grid",j4),B$.registerLayout("layout3d",V4),t.Arc3dMark=qJ,t.ArcMark=XJ,t.AreaChart=J1,t.AreaMark=vJ,t.AreaSeries=bJ,t.Bar3dChart=t2,t.Bar3dSeries=gJ,t.BarChart=Q1,t.BarSeries=ZZ,t.BaseChart=sq,t.BaseMark=KK,t.BaseSeries=Lq,t.BoxPlotChart=e2,t.BoxPlotMark=sJ,t.BoxPlotSeries=oJ,t.Brush=Q2,t.CartesianAxis=F3,t.CartesianBandAxis=G3,t.CartesianChart=rq,t.CartesianCrossHair=x5,t.CartesianLinearAxis=V3,t.CartesianSeries=Oq,t.CartesianTimeAxis=U3,t.CellMark=q1,t.CirclePackingChart=i2,t.CirclePackingSeries=T1,t.CircularProgressChart=M2,t.CircularProgressSeries=fQ,t.CommonChart=n2,t.ComponentMark=ZK,t.ContinuousLegend=o5,t.CustomMark=J2,t.DataZoom=Z2,t.DiscreteLegend=Q3,t.DotSeries=cQ,t.Factory=B$,t.Funnel3dChart=a2,t.Funnel3dSeries=N0,t.FunnelChart=r2,t.FunnelSeries=H0,t.GaugeChart=m2,t.GaugePointerSeries=X1,t.GaugeSeries=$1,t.GeoCoordinate=p5,t.GridLayout=j4,t.GroupMark=qK,t.HeatmapChart=y2,t.HeatmapSeries=Z1,t.Histogram3dChart=b2,t.HistogramChart=v2,t.Indicator=h5,t.Label=H4,t.Layout=VK,t.Layout3d=V4,t.LineChart=x2,t.LineMark=dJ,t.LineSeries=uJ,t.LinearProgressChart=C2,t.LinearProgressSeries=yQ,t.LinkPathMark=j1,t.LinkSeries=uQ,t.MapChart=S2,t.MapLabelComponent=c3,t.MapSeries=jJ,t.MarkArea=X5,t.MarkLine=Y5,t.MarkPoint=$5,t.PathMark=OJ,t.Pie3dChart=k2,t.Pie3dSeries=ZJ,t.PieChart=A2,t.PieSeries=KJ,t.Player=P5,t.PolarAxis=Y3,t.PolarBandAxis=$3,t.PolarChart=g2,t.PolarCrossHair=S5,t.PolarLinearAxis=X3,t.PolarSeries=NJ,t.PolygonMark=z0,t.ProgressArcMark=gQ,t.ProgressLikeChart=f2,t.ProgressLikeSeries=pQ,t.Pyramid3dMark=j0,t.RadarChart=E2,t.RadarSeries=aQ,t.RangeAreaChart=P2,t.RangeAreaSeries=SJ,t.RangeColumn3dChart=B2,t.RangeColumn3dSeries=_J,t.RangeColumnChart=R2,t.RangeColumnSeries=yJ,t.Rect3dMark=pJ,t.RectMark=KZ,t.RoseChart=I2,t.RoseLikeChart=T2,t.RoseLikeSeries=sQ,t.RoseSeries=rQ,t.RuleMark=JZ,t.SankeyChart=D2,t.SankeySeries=N1,t.ScatterChart=L2,t.ScatterSeries=nQ,t.ScrollBar=q2,t.SequenceChart=O2,t.SunburstChart=F2,t.SunburstSeries=k1,t.SymbolMark=aJ,t.TextMark=qZ,t.ThemeManager=v$,t.Title=c5,t.Tooltip=L4,t.TreeMapChart=z2,t.TreeMapSeries=Y1,t.VChart=wK,t.WaterfallChart=H2,t.WaterfallSeries=QZ,t.WordCloud3dChart=V2,t.WordCloud3dSeries=S0,t.WordCloudChart=N2,t.WordCloudSeries=x0,t.default=wK,t.version="1.1.1",Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart/CHANGELOG.json b/packages/vchart/CHANGELOG.json index 70fa77654d..76e8cfd840 100644 --- a/packages/vchart/CHANGELOG.json +++ b/packages/vchart/CHANGELOG.json @@ -1,6 +1,33 @@ { "name": "@visactor/vchart", "entries": [ + { + "version": "1.1.1", + "tag": "@visactor/vchart_v1.1.1", + "date": "Fri, 28 Jul 2023 08:52:08 GMT", + "comments": { + "patch": [ + { + "comment": "feat(logger): support static api `getLogger` in vchart class" + }, + { + "comment": "fix(vchart): fix the problem of default logLevel not sync to vgrammar" + }, + { + "comment": "fix(map): fix the issue that some map data cannot be drawn" + }, + { + "comment": "fix(map): fix the issue of misalignment of the map after interaction with legend" + }, + { + "comment": "fix(indicator): add `specKey` for Indicator to fix the issue that the indicator text does not display after the update, close#251" + }, + { + "comment": "fix(map): fix the issue that defaultFillColor does not work in map" + } + ] + } + }, { "version": "1.1.0", "tag": "@visactor/vchart_v1.1.0", diff --git a/packages/vchart/CHANGELOG.md b/packages/vchart/CHANGELOG.md index 2b6e54243d..7fa55e3210 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, 26 Jul 2023 03:18:52 GMT and should not be manually modified. +This log was last generated on Fri, 28 Jul 2023 08:52:08 GMT and should not be manually modified. + +## 1.1.1 +Fri, 28 Jul 2023 08:52:08 GMT + +### Patches + +- feat(logger): support static api `getLogger` in vchart class +- fix(vchart): fix the problem of default logLevel not sync to vgrammar +- fix(map): fix the issue that some map data cannot be drawn +- fix(map): fix the issue of misalignment of the map after interaction with legend +- fix(indicator): add `specKey` for Indicator to fix the issue that the indicator text does not display after the update, close#251 +- fix(map): fix the issue that defaultFillColor does not work in map ## 1.1.0 Wed, 26 Jul 2023 03:18:52 GMT diff --git a/packages/vchart/package.json b/packages/vchart/package.json index 3fb64065cb..db8c09b56a 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "1.1.0", + "version": "1.1.1", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js",