@ecan-bi/pivot-table 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +3 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/types/pivotTable/index.d.ts +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @ecan-bi/pivot-table@1.0.
|
|
1
|
+
/*! @ecan-bi/pivot-table@1.0.4 */
|
|
2
2
|
(function($n,ft){typeof exports=="object"&&typeof module<"u"?ft(exports,require("vue"),require("dayjs"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue","dayjs","lodash-es"],ft):($n=typeof globalThis<"u"?globalThis:$n||self,ft($n["@ecan-bi/pivot-table"]={},$n.Vue))})(this,function($n,ft){"use strict";const f1=(n,t)=>{if(n.install=e=>{for(const i of[n,...Object.values(t??{})])e.component(i.name,i)},t)for(const[e,i]of Object.entries(t))n[e]=i;return n},yf=(n,t)=>Object.prototype.hasOwnProperty.call(n,t);class Te{static GenAutoIncrementId(){return Te.auto_increment_id++}}Te.auto_increment_id=0;class Bt{constructor(t){this.id=Te.GenAutoIncrementId(),this.registry=t}}const Tl="named",wf="inject",Sf="multi_inject",xf="inversify:tagged",Af="inversify:paramtypes";class Od{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Tl?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}const Qo=function(n){var t;return function(e){const i=typeof Symbol=="function",o=i&&Symbol.toPrimitive!==void 0?Symbol.toPrimitive:"@@toPrimitive",r=Object.getPrototypeOf(Function),s=(typeof process=="object"&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),l=new WeakMap;function a(B,H,E,F){if(!y(E))throw new TypeError;return m(B,H,E,F)}function h(B,H,E){if(!y(H))throw new TypeError;return w(E)||(E=T(E)),g(B,H,E)}function d(B,H,E){if(!y(H))throw new TypeError;return w(E)||(E=T(E)),f(B,H,E)}function u(B,H,E){if(!y(H))throw new TypeError;return w(E)||(E=T(E)),p(B,H,E)}function c(B,H,E){let F=l.get(B);if(w(F)){if(!E)return;F=new s,l.set(B,F)}let L=F.get(H);if(w(L)){if(!E)return;L=new s,F.set(H,L)}return L}function g(B,H,E){if(f(B,H,E))return!0;const F=k(H);return!C(F)&&g(B,F,E)}function f(B,H,E){const F=c(H,E,!1);return!w(F)&&A(F.has(B))}function p(B,H,E){if(f(B,H,E))return v(B,H,E);const F=k(H);return C(F)?void 0:p(B,F,E)}function v(B,H,E){const F=c(H,E,!1);if(!w(F))return F.get(B)}function m(B,H,E,F){c(E,F,!0).set(B,H)}function b(B){if(B===null)return 1;switch(typeof B){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return B===null?1:6;default:return 6}}function w(B){return B===void 0}function C(B){return B===null}function _(B){return typeof B=="symbol"}function y(B){return typeof B=="object"?B!==null:typeof B=="function"}function x(B,H){switch(b(B)){case 0:case 1:case 2:case 3:case 4:case 5:return B}const E=H===3?"string":H===5?"number":"default",F=P(B,o);if(F!==void 0){const L=F.call(B,E);if(y(L))throw new TypeError;return L}return S(B,E==="default"?"number":E)}function S(B,H){if(H==="string"){const E=B.toString;if(M(E)){const L=E.call(B);if(!y(L))return L}const F=B.valueOf;if(M(F)){const L=F.call(B);if(!y(L))return L}}else{const E=B.valueOf;if(M(E)){const L=E.call(B);if(!y(L))return L}const F=B.toString;if(M(F)){const L=F.call(B);if(!y(L))return L}}throw new TypeError}function A(B){return!!B}function R(B){return""+B}function T(B){const H=x(B,3);return _(H)?H:R(H)}function M(B){return typeof B=="function"}function P(B,H){const E=B[H];if(E!=null){if(!M(E))throw new TypeError;return E}}function k(B){const H=Object.getPrototypeOf(B);if(typeof B!="function"||B===r||H!==r)return H;const E=B.prototype,F=E&&Object.getPrototypeOf(E);if(F==null||F===Object.prototype)return H;const L=F.constructor;return typeof L!="function"||L===B?H:L}e("defineMetadata",a),e("hasMetadata",h),e("hasOwnMetadata",d),e("getMetadata",u)}((t=n,function(e,i){typeof t[e]!="function"&&Object.defineProperty(t,e,{configurable:!0,writable:!0,value:i})})),n}({});function p1(n,t,e,i){const o=[i];let r={};Qo.hasOwnMetadata(n,t)&&(r=Qo.getMetadata(n,t));let s=r[e];s===void 0&&(s=[]),s.push(...o),r[e]=s,Qo.defineMetadata(n,r,t)}function v1(n,t,e,i){p1(xf,n,e.toString(),i)}function Rf(n){return(t,e,i)=>{v1(t,e,i,n)}}function Tf(n){return t=>(e,i,o)=>Rf(new Od(n,t))(e,i,o)}const Ot=Tf(wf),Mf=Tf(Sf);function st(){return function(n){return Qo.defineMetadata(Af,null,n),n}}function Ie(n){return Rf(new Od(Tl,n))}const Co={Singleton:"Singleton",Transient:"Transient"},Yn={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};class Wd{constructor(t,e){this.id=Te.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Yn.Invalid,this.constraint=i=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Wd(this.serviceIdentifier,this.scope);return t.activated=t.scope===Co.Singleton&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class m1{getConstructorMetadata(t){return{compilerGeneratedMetadata:Qo.getMetadata(Af,t),userGeneratedMetadata:Qo.getMetadata(xf,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const b1=(n=>t=>{const e=i=>{if(i==null)return!1;if(i.key===n&&i.value===t)return!0;if(i.constructorArgsMetadata==null)return!1;const o=i.constructorArgsMetadata;for(let r=0;r<o.length;r++)if(o[r].key===n&&o[r].value===t)return!0;return!1};return e.metaData=new Od(n,t),e})(Tl);class Ml{constructor(t){this._binding=t}inRequestScope(){throw new Error("暂未实现")}inSingletonScope(){return this._binding.scope=Co.Singleton,this}inTransientScope(){return this._binding.scope=Co.Transient,this}whenTargetNamed(t){return this._binding.constraint=b1(t),this}}class C1{constructor(t){this._binding=t}to(t){return this._binding.type=Yn.Instance,this._binding.implementationType=t,new Ml(this._binding)}toSelf(){const t=this._binding.serviceIdentifier;return this.to(t)}toDynamicValue(t){return this._binding.type=Yn.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new Ml(this._binding)}toConstantValue(t){return this._binding.type=Yn.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=Co.Singleton,new Ml(this._binding)}toFactory(t){return this._binding.type=Yn.Factory,this._binding.factory=t,this._binding.scope=Co.Singleton,new Ml(this._binding)}toService(t){this.toDynamicValue(e=>e.container.get(t))}}let _1=class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Co.Transient,this.options=e,this.id=Te.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new m1}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const o=this._getNotAllArgs(t,!1,e,i);return this._get(o)}getNamed(t,e){return this.getTagged(t,Tl,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Wd(t,e),o=this._bindingDictionary.get(t)||[];return o.push(i),this._bindingDictionary.set(t,o),new C1(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(s,l)=>{s._binding.moduleId=l},e=s=>l=>{const a=this.bind(l);return t(a,s),a},i=()=>s=>this.unbind(s),o=()=>s=>this.isBound(s),r=s=>l=>{const a=this.rebind(l);return t(a,s),a};return s=>({bindFunction:e(s),isboundFunction:o(),rebindFunction:r(s),unbindFunction:i(),unbindAsyncFunction:l=>null})}_getNotAllArgs(t,e,i,o){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:o}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter(i=>i.constraint(t)).forEach(i=>{e.push(this._resolveFromBinding(i))}),t.isMultiInject||e.length!==1?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),o=Object.keys(i),r=[];for(let s=0;s<o.length;s++){const l=i[s],a={};l.forEach(g=>{a[g.key]=g.value});const h={inject:a[wf],multiInject:a[Sf]},d=h.inject||h.multiInject,u={serviceIdentifier:d,constructorArgsMetadata:l},c={injectIdentifier:d,metadata:l,bindings:this._bindingDictionary.get(d).filter(g=>g.constraint(u))};r.push(c)}return r}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Yn.ConstantValue:case Yn.Function:e=t.cache;break;case Yn.Instance:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map(e=>e.bindings.length>1?e.bindings.map(i=>this._resolveFromBinding(i)):this._resolveFromBinding(e.bindings[0]))}_saveToScope(t,e){t.scope===Co.Singleton&&(t.cache=e,t.activated=!0)}};const Me=Symbol("ContributionProvider");class Bf{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function ei(n,t){n(Me).toDynamicValue(({container:e})=>new Bf(t,e)).inSingletonScope().whenTargetNamed(t)}function y1(n,t){n(Me).toDynamicValue(({container:e})=>new Bf(t,e)).whenTargetNamed(t)}class w1{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i=typeof t=="string"?t.trim():t.name;i&&(this.taps=this.taps.filter(o=>!(o.name===i&&(!e||o.fn===e))))}_parseOptions(t,e,i){let o;if(typeof e=="string")o={name:e.trim()};else if(typeof e!="object"||e===null)throw new Error("Invalid tap options");if(typeof o.name!="string"||o.name==="")throw new Error("Missing name for tap");return o=Object.assign({type:t,fn:i},o),o}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;typeof t.before=="string"?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;typeof t.stage=="number"&&(i=t.stage);let o=this.taps.length;for(;o>0;){o--;const r=this.taps[o];this.taps[o+1]=r;const s=r.stage||0;if(e){if(e.has(r.name)){e.delete(r.name);continue}if(e.size>0)continue}if(!(s>i)){o++;break}}this.taps[o]=t}}class gi extends w1{call(...t){this.taps.map(e=>e.fn).forEach(e=>e(...t))}}const Bl=Symbol.for("EnvContribution"),Nd=Symbol.for("VGlobal");var S1=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},x1=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Pf=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let Vd=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}set supportEvent(n){this._env||this.setEnv("browser"),this.envContribution.supportEvent=n}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(n){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=n}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(n){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=n}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(n){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=n}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(n){this._env||this.setEnv("browser"),this.envContribution.applyStyles=n}constructor(n){this.contributions=n,this.id=Te.GenAutoIncrementId(),this.hooks={onSetEnv:new gi(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(n){const t=[];if(this.contributions.getContributions().forEach(e=>{const i=e.configure(this,n);i&&i.then&&t.push(i)}),t.length)return Promise.all(t)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(n,t){if(t&&t.force===!0||this._env!==n)return this.deactiveCurrentEnv(),this.activeEnv(n,t)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(n,t){const e=this._env;this._env=n;const i=this.bindContribution(t);if(i&&i.then)return i.then(()=>{this.envParams=t,this.hooks.onSetEnv.call(e,n,this)});this.envParams=t,this.hooks.onSetEnv.call(e,n,this)}setActiveEnvContribution(n){this.envContribution=n}createCanvas(n){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(n)}createOffscreenCanvas(n){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(n)}releaseCanvas(n){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(n)}addEventListener(n,t,e){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(n,t,e)}removeEventListener(n,t,e){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(n,t,e)}dispatchEvent(n){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(n)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(n){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(n):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(n,t){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(n,t):null}loadImage(n){return this._env||this.setEnv("browser"),this.envContribution.loadImage(n)}loadSvg(n){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(n)}loadJson(n){return this._env||this.setEnv("browser"),this.envContribution.loadJson(n)}loadArrayBuffer(n){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(n)}loadBlob(n){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(n)}isChrome(){return this._isChrome!=null||(this._env||this.setEnv("browser"),this._isChrome=this._env==="browser"&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return this._isSafari!=null||(this._env||this.setEnv("browser"),this._isSafari=this._env==="browser"&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(n){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(n)}removeDom(n){return this._env||this.setEnv("browser"),this.envContribution.removeDom(n)}createDom(n){return this._env||this.setEnv("browser"),this.envContribution.createDom(n)}updateDom(n,t){return this._env||this.setEnv("browser"),this.envContribution.updateDom(n,t)}getElementTop(n,t=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(n,t)}getElementLeft(n,t=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(n,t)}getElementTopLeft(n,t=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(n,t)}};Vd=S1([st(),Pf(0,Ot(Me)),Pf(0,Ie(Bl)),x1("design:paramtypes",[Object])],Vd);var _o={},A1={get exports(){return _o},set exports(n){_o=n}};(function(n){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function o(a,h,d){this.fn=a,this.context=h,this.once=d||!1}function r(a,h,d,u,c){if(typeof d!="function")throw new TypeError("The listener must be a function");var g=new o(d,u||a,c),f=e?e+h:h;return a._events[f]?a._events[f].fn?a._events[f]=[a._events[f],g]:a._events[f].push(g):(a._events[f]=g,a._eventsCount++),a}function s(a,h){--a._eventsCount===0?a._events=new i:delete a._events[h]}function l(){this._events=new i,this._eventsCount=0}l.prototype.eventNames=function(){var h=[],d,u;if(this._eventsCount===0)return h;for(u in d=this._events)t.call(d,u)&&h.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(d)):h},l.prototype.listeners=function(h){var d=e?e+h:h,u=this._events[d];if(!u)return[];if(u.fn)return[u.fn];for(var c=0,g=u.length,f=new Array(g);c<g;c++)f[c]=u[c].fn;return f},l.prototype.listenerCount=function(h){var d=e?e+h:h,u=this._events[d];return u?u.fn?1:u.length:0},l.prototype.emit=function(h,d,u,c,g,f){var p=e?e+h:h;if(!this._events[p])return!1;var v=this._events[p],m=arguments.length,b,w;if(v.fn){switch(v.once&&this.removeListener(h,v.fn,void 0,!0),m){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,d),!0;case 3:return v.fn.call(v.context,d,u),!0;case 4:return v.fn.call(v.context,d,u,c),!0;case 5:return v.fn.call(v.context,d,u,c,g),!0;case 6:return v.fn.call(v.context,d,u,c,g,f),!0}for(w=1,b=new Array(m-1);w<m;w++)b[w-1]=arguments[w];v.fn.apply(v.context,b)}else{var C=v.length,_;for(w=0;w<C;w++)switch(v[w].once&&this.removeListener(h,v[w].fn,void 0,!0),m){case 1:v[w].fn.call(v[w].context);break;case 2:v[w].fn.call(v[w].context,d);break;case 3:v[w].fn.call(v[w].context,d,u);break;case 4:v[w].fn.call(v[w].context,d,u,c);break;default:if(!b)for(_=1,b=new Array(m-1);_<m;_++)b[_-1]=arguments[_];v[w].fn.apply(v[w].context,b)}}return!0},l.prototype.on=function(h,d,u){return r(this,h,d,u,!1)},l.prototype.once=function(h,d,u){return r(this,h,d,u,!0)},l.prototype.removeListener=function(h,d,u,c){var g=e?e+h:h;if(!this._events[g])return this;if(!d)return s(this,g),this;var f=this._events[g];if(f.fn)f.fn===d&&(!c||f.once)&&(!u||f.context===u)&&s(this,g);else{for(var p=0,v=[],m=f.length;p<m;p++)(f[p].fn!==d||c&&!f[p].once||u&&f[p].context!==u)&&v.push(f[p]);v.length?this._events[g]=v.length===1?v[0]:v:s(this,g)}return this},l.prototype.removeAllListeners=function(h){var d;return h?(d=e?e+h:h,this._events[d]&&s(this,d)):(this._events=new i,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=e,l.EventEmitter=l,n.exports=l})(A1);const tr=(n,t)=>Object.prototype.toString.call(n)===`[object ${t}]`,ze=(n,t=!1)=>t?typeof n=="boolean":n===!0||n===!1||tr(n,"Boolean"),jt=n=>typeof n=="function",ct=n=>n==null,I=n=>n!=null,$t=n=>{const t=typeof n;return n!==null&&t==="object"||t==="function"},R1=n=>typeof n=="object"&&n!==null,er=function(n){if(!R1(n)||!tr(n,"Object"))return!1;if(Object.getPrototypeOf(n)===null)return!0;let t=n;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===t},be=n=>n===void 0,Qt=(n,t=!1)=>{const e=typeof n;return t?e==="string":e==="string"||tr(n,"String")},it=n=>Array.isArray?Array.isArray(n):tr(n,"Array"),jd=function(n){return n!==null&&typeof n!="function"&&Number.isFinite(n.length)},Hf=n=>tr(n,"Date"),nt=(n,t=!1)=>{const e=typeof n;return t?e==="number":e==="number"||tr(n,"Number")},ie=n=>nt(n)&&Number.isFinite(n),T1=n=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(n),M1=n=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(n),B1=n=>({}).toString.call(n).replace(/^\[object /,"").replace(/]$/,""),P1=Object.prototype,H1=function(n){const t=n&&n.constructor;return n===(typeof t=="function"&&t.prototype||P1)},E1=Object.prototype.hasOwnProperty;function Et(n){if(ct(n))return!0;if(jd(n))return!n.length;const t=B1(n);if(t==="Map"||t==="Set")return!n.size;if(H1(n))return!Object.keys(n).length;for(const e in n)if(E1.call(n,e))return!1;return!0}const De=(n,t,e)=>{const i=Qt(t)?t.split("."):t;for(let o=0;o<i.length;o++)n=n?n[i[o]]:void 0;return n===void 0?e:n},L1=Object.prototype.hasOwnProperty,Ef=(n,t)=>n!=null&&L1.call(n,t);function Be(n,t,e){let i;if(!I(n)||typeof n!="object"||t&&t(n))return n;const o=it(n),r=n.length;i=o?new Array(r):typeof n=="object"?{}:ze(n)||nt(n)||Qt(n)?n:Hf(n)?new Date(+n):void 0;const s=o?void 0:Object.keys(Object(n));let l=-1;if(i)for(;++l<(s||n).length;){const a=s?s[l]:l,h=n[a];e&&e.includes(a.toString())?i[a]=h:i[a]=Be(h,t,e)}return i}function Lf(n,t,e=!1,i=!1){if(t){if(n===t)return;if(I(t)&&typeof t=="object"){const o=Object(t),r=[];for(const a in o)r.push(a);let{length:s}=r,l=-1;for(;s--;){const a=r[++l];!I(o[a])||typeof o[a]!="object"||i&&it(n[a])?Ff(n,a,o[a]):F1(n,t,a,e,i)}}}}function F1(n,t,e,i=!1,o=!1){const r=n[e],s=t[e];let l=t[e],a=!0;if(it(s)){if(i)l=[];else if(it(r))l=r;else if(jd(r)){l=new Array(r.length);let h=-1;const d=r.length;for(;++h<d;)l[h]=r[h]}}else er(s)?(l=r??{},typeof r!="function"&&typeof r=="object"||(l={})):a=!1;a&&Lf(l,s,i,o),Ff(n,e,l)}function Ff(n,t,e){(e!==void 0&&!k1(n[t],e)||e===void 0&&!(t in n))&&(n[t]=e)}function k1(n,t){return n===t||Number.isNaN(n)&&Number.isNaN(t)}function dt(n,...t){let e=-1;const i=t.length;for(;++e<i;)Lf(n,t[e],!0);return n}function I1(n,t){if(!n||!er(n))return n;const e={};return Object.keys(n).forEach(i=>{const o=n[i];let r=!1;t.forEach(s=>{(Qt(s)&&s===i||s instanceof RegExp&&i.match(s))&&(r=!0)}),r||(e[i]=o)}),e}function kf(n){return Object.prototype.toString.call(n)}function If(n){return Object.keys(n)}function es(n,t,e){if(n===t)return!0;if(typeof n!=typeof t||n==null||t==null)return!1;if(Number.isNaN(n)&&Number.isNaN(t))return!0;if(kf(n)!==kf(t))return!1;if(jt(n))return!!(e!=null&&e.skipFunction);if(typeof n!="object")return!1;if(it(n)){if(n.length!==t.length)return!1;for(let r=n.length-1;r>=0;r--)if(!es(n[r],t[r],e))return!1;return!0}if(!er(n))return!1;const i=If(n),o=If(t);if(i.length!==o.length)return!1;i.sort(),o.sort();for(let r=i.length-1;r>=0;r--)if(i[r]!=o[r])return!1;for(let r=i.length-1;r>=0;r--){const s=i[r];if(!es(n[s],t[s],e))return!1}return!0}function z1(n){if(!n)return[];if(Object.keys)return Object.keys(n);const t=[];for(const e in n)n.hasOwnProperty(e)&&t.push(e);return t}function D1(n,t,e){const i=z1(t);for(let o=0;o<i.length;o++){const r=i[o];(e?t[r]!=null:n[r]==null)&&(n[r]=t[r])}return n}function Gd(n,t,e=!0){if(n="prototype"in n?n.prototype:n,t="prototype"in t?t.prototype:t,Object.getOwnPropertyNames){const i=Object.getOwnPropertyNames(t);for(let o=0;o<i.length;o++){const r=i[o];r!=="constructor"&&(e?t[r]!=null:n[r]==null)&&(n[r]=t[r])}}else D1(n,t,e)}function Ud(n){return I(n)?it(n)?n:[n]:[]}function yo(n){if(jd(n))return n[n.length-1]}const Kd=(n,t)=>{var e;if(n.length===0)return;let i=n[0];for(let o=1;o<n.length;o++){const r=n[o];((e=t==null?void 0:t(r,i))!==null&&e!==void 0?e:r-i>0)&&(i=r)}return i},Pl=(n,t)=>{var e;if(n.length===0)return;let i=n[0];for(let o=1;o<n.length;o++){const r=n[o];((e=t==null?void 0:t(r,i))!==null&&e!==void 0?e:r-i<0)&&(i=r)}return i};function is(n,t){if(!it(n)||!it(t)||n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}function $d(n){if(!it(n))return[n];const t=[];for(const e of n)t.push(...$d(e));return t}function O1(n,t,e){I(t)||(t=n,n=0),I(e)||(e=1);let i=-1;const o=0|Math.max(0,Math.ceil((t-n)/e)),r=new Array(o);for(;++i<o;)r[i]=n+i*e;return r}function W1(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function ns(n){return Number(n)}const N1=typeof console<"u";function Hl(n,t,e){const i=[t].concat([].slice.call(e));N1&&console[n].apply(console,i)}var Xi;(function(n){n[n.None=0]="None",n[n.Error=1]="Error",n[n.Warn=2]="Warn",n[n.Info=3]="Info",n[n.Debug=4]="Debug"})(Xi||(Xi={}));class ne{static getInstance(t,e){return ne._instance&&nt(t)?ne._instance.level(t):ne._instance||(ne._instance=new ne(t,e)),ne._instance}static setInstance(t){return ne._instance=t}static setInstanceLevel(t){ne._instance?ne._instance.level(t):ne._instance=new ne(t)}static clearInstance(){ne._instance=null}constructor(t=Xi.None,e){this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find(e=>e===t)||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex(i=>i===t);e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(...t){this._onErrorHandler.forEach(e=>e(...t))}canLogInfo(){return this._level>=Xi.Info}canLogDebug(){return this._level>=Xi.Debug}canLogError(){return this._level>=Xi.Error}canLogWarn(){return this._level>=Xi.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=Xi.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):Hl((e=this._method)!==null&&e!==void 0?e:"error","ERROR",t)),this}warn(...t){return this._level>=Xi.Warn&&Hl(this._method||"warn","WARN",t),this}info(...t){return this._level>=Xi.Info&&Hl(this._method||"log","INFO",t),this}debug(...t){return this._level>=Xi.Debug&&Hl(this._method||"log","DEBUG",t),this}}ne._instance=null;function V1(n,t,e=0,i){for(ct(i)&&(i=n.length);e<i;){const o=e+i>>>1;W1(n[o],t)>0?i=o:e=o+1}return e}const j1=(n,t,e)=>{let i=n,o=t;for(;i<o;){const r=Math.floor((i+o)/2);e(r)>=0?o=r:i=r+1}return i},G1=1e-10,U1=1e-10;function qi(n,t,e=U1,i=G1){const o=i,r=e*Math.max(n,t);return Math.abs(n-t)<=Math.max(o,r)}function zf(n,t,e,i){return n>t&&!qi(n,t,e,i)}function Df(n,t,e,i){return n<t&&!qi(n,t,e,i)}const os=n=>{let t=null,e=null;return(...i)=>(t&&i.every((o,r)=>o===t[r])||(t=i,e=n(...i)),e)},bi=function(n,t,e){return n<t?t:n>e?e:n},wo=(n,t,e)=>{let[i,o]=n;o<i&&(i=n[1],o=n[0]);const r=o-i;return r>=e-t?[t,e]:(i=Math.min(Math.max(i,t),e-r),[i,i+r])};function Yd(n,t){let e;return n>t&&(e=n,n=t,t=e),i=>Math.max(n,Math.min(t,i))}let El=!1;try{El=typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"}catch{El=!1}function Of(n,t,e){let i,o,r,s,l,a,h=0,d=!1,u=!1,c=!0;const g=!t&&t!==0&&El;if(typeof n!="function")throw new TypeError("Expected a function");function f(C){const _=i,y=o;return i=o=void 0,h=C,s=n.apply(y,_),s}function p(C,_){return g?(cancelAnimationFrame(l),requestAnimationFrame(C)):setTimeout(C,_)}function v(C){const _=C-a;return a===void 0||_>=t||_<0||u&&C-h>=r}function m(){const C=Date.now();if(v(C))return b(C);l=p(m,function(_){const y=_-h,x=t-(_-a);return u?Math.min(x,r-y):x}(C))}function b(C){return l=void 0,c&&i?f(C):(i=o=void 0,s)}function w(...C){const _=Date.now(),y=v(_);if(i=C,o=this,a=_,y){if(l===void 0)return function(x){return h=x,l=p(m,t),d?f(x):s}(a);if(u)return l=p(m,t),f(a)}return l===void 0&&(l=p(m,t)),s}return t=+t||0,$t(e)&&(d=!!e.leading,u="maxWait"in e,u&&(r=Math.max(ie(e.maxWait)?e.maxWait:0,t)),c="trailing"in e?!!e.trailing:c),w.cancel=function(){l!==void 0&&function(C){if(g)return cancelAnimationFrame(C);clearTimeout(C)}(l),h=0,i=a=o=l=void 0},w.flush=function(){return l===void 0?s:b(Date.now())},w.pending=function(){return l!==void 0},w}El=!1;function Wf(n,t,e){let i=!0,o=!0;if(typeof n!="function")throw new TypeError("Expected a function");return $t(e)&&(i="leading"in e?!!e.leading:i,o="trailing"in e?!!e.trailing:o),Of(n,t,{leading:i,trailing:o,maxWait:t})}function Ll(n,t){return e=>n*(1-e)+t*e}function K1(n,t){return function(e){return Math.round(n*(1-e)+t*e)}}function $1(n,t){const e=n.valueOf(),i=t.valueOf(),o=new Date;return r=>(o.setTime(e*(1-r)+i*r),o)}const ae=1e-12,oe=Math.PI,Ei=oe/2,Ye=2*oe,Gt=2*Math.PI,Jt=Math.abs,Xt=Math.atan2,Pe=Math.cos,Xn=Math.max,ii=Math.min,pe=Math.sin,Zi=Math.sqrt,ir=Math.pow;function Y1(n){return n>1?0:n<-1?oe:Math.acos(n)}function Nf(n){return n>=1?Ei:n<=-1?-Ei:Math.asin(n)}function Vf(n,t,e,i,o){let r=e,s=i;return typeof n=="number"&&typeof e=="number"&&(r=(1-o)*n+o*e),typeof t=="number"&&typeof i=="number"&&(s=(1-o)*t+o*i),{x:r,y:s}}function X1(n,t){return n[0]*t[1]-n[1]*t[0]}class ye{constructor(t=0,e=0,i,o){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=o}clone(){return new ye(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 nt(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return nt(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 Rn{static distancePP(t,e){return Zi(ir(t.x-e.x,2)+ir(t.y-e.y,2))}static distanceNN(t,e,i,o){return Zi(ir(t-i,2)+ir(e-o,2))}static distancePN(t,e,i){return Zi(ir(e-t.x,2)+ir(i-t.y,2))}static pointAtPP(t,e,i){return new ye((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Li(n){return n*(Math.PI/180)}function q1(n){return 180*n/Math.PI}const Z1=(n=0)=>{if(n<0)for(;n<-Ye;)n+=Ye;else if(n>0)for(;n>Ye;)n-=Ye;return n};function J1(n,t,e){return t?{x:n.x+t*Math.cos(e),y:n.y+t*Math.sin(e)}:{x:n.x,y:n.y}}function jf(n){for(;n<0;)n+=2*Math.PI;for(;n>=2*Math.PI;)n-=2*Math.PI;return n}function Gf(n,t,e){if(n===null)return t;if(t===null)return n;const{x11:i,x12:o,y11:r,y12:s,x21:l,x22:a,y21:h,y22:d}=Xd(n,t,e);return i>=a||o<=l||r>=d||s<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(i,l),y1:Math.max(r,h),x2:Math.min(o,a),y2:Math.min(s,d)}}var nr;(function(n){n[n.NONE=0]="NONE",n[n.BBOX1=1]="BBOX1",n[n.BBOX2=2]="BBOX2"})(nr||(nr={}));const Xd=(n,t,e)=>{let i=n.x1,o=n.x2,r=n.y1,s=n.y2,l=t.x1,a=t.x2,h=t.y1,d=t.y2;return e&&(i>o&&([i,o]=[o,i]),r>s&&([r,s]=[s,r]),l>a&&([l,a]=[a,l]),h>d&&([h,d]=[d,h])),{x11:i,x12:o,y11:r,y12:s,x21:l,x22:a,y21:h,y22:d}};function Q1(n,t,e){if(!n||!t)return nr.NONE;const{x11:i,x12:o,y11:r,y12:s,x21:l,x22:a,y21:h,y22:d}=Xd(n,t,e);return i>l&&o<a&&r>h&&s<d?nr.BBOX1:l>i&&a<o&&h>r&&d<s?nr.BBOX2:nr.NONE}function qd(n,t,e){if(n&&t){if(!e)return!(n.x1>t.x2||n.x2<t.x1||n.y1>t.y2||n.y2<t.y1);const{x11:i,x12:o,y11:r,y12:s,x21:l,x22:a,y21:h,y22:d}=Xd(n,t,!0);return!(i>a||o<l||r>d||s<h)}return!0}function Zd(n,t){return Math.abs(t[0]*n[0]+t[1]*n[1])}function or({x:n,y:t},e,i={x:0,y:0}){return{x:(n-i.x)*Math.cos(e)-(t-i.y)*Math.sin(e)+i.x,y:(n-i.x)*Math.sin(e)+(t-i.y)*Math.cos(e)+i.y}}function Jd(n){return{x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2}}function Uf(n,t){const e=t?Li(n.angle):n.angle,i=Jd(n);return[or({x:n.x1,y:n.y1},e,i),or({x:n.x2,y:n.y1},e,i),or({x:n.x2,y:n.y2},e,i),or({x:n.x1,y:n.y2},e,i)]}function Kf(n,t,e=!1,i){const o=Uf(n,e),r=Uf(t,e),s=(w,C)=>[C.x-w.x,C.y-w.y];i&&(i.save(),i.fillStyle="red",i.globalAlpha=.6,o.forEach((w,C)=>{C===0?i.moveTo(w.x,w.y):i.lineTo(w.x,w.y)}),i.fill(),i.restore(),i.save(),i.fillStyle="green",i.globalAlpha=.6,r.forEach((w,C)=>{C===0?i.moveTo(w.x,w.y):i.lineTo(w.x,w.y)}),i.fill(),i.restore());const l=Jd(n),a=Jd(t);i&&i.fillRect(l.x,l.y,2,2),i&&i.fillRect(a.x,a.y,2,2);const h=s(l,a),d=s(o[0],o[1]),u=s(o[1],o[2]),c=s(r[0],r[1]),g=s(r[1],r[2]),f=e?Li(n.angle):n.angle;let p=e?Li(90-n.angle):n.angle+Ei;const v=e?Li(t.angle):t.angle;let m=e?Li(90-t.angle):t.angle+Ei;p>Gt&&(p-=Gt),m>Gt&&(m-=Gt);const b=(w,C,_,y)=>{const x=[Math.cos(C),Math.sin(C)];return w+(Zd(x,_)+Zd(x,y))/2>Zd(x,h)};return b((n.x2-n.x1)/2,f,c,g)&&b((n.y2-n.y1)/2,p,c,g)&&b((t.x2-t.x1)/2,v,d,u)&&b((t.y2-t.y1)/2,m,d,u)}const $f=n=>{let t=n.charCodeAt(0),e=n.length===2?n.charCodeAt(1):0,i=t;return 55296<=t&&t<=56319&&56320<=e&&e<=57343&&(t&=1023,e&=1023,i=t<<10|e,i+=65536),i===12288||65281<=i&&i<=65376||65504<=i&&i<=65510?"F":i===8361||65377<=i&&i<=65470||65474<=i&&i<=65479||65482<=i&&i<=65487||65490<=i&&i<=65495||65498<=i&&i<=65500||65512<=i&&i<=65518?"H":4352<=i&&i<=4447||4515<=i&&i<=4519||4602<=i&&i<=4607||9001<=i&&i<=9002||11904<=i&&i<=11929||11931<=i&&i<=12019||12032<=i&&i<=12245||12272<=i&&i<=12283||12289<=i&&i<=12350||12353<=i&&i<=12438||12441<=i&&i<=12543||12549<=i&&i<=12589||12593<=i&&i<=12686||12688<=i&&i<=12730||12736<=i&&i<=12771||12784<=i&&i<=12830||12832<=i&&i<=12871||12880<=i&&i<=13054||13056<=i&&i<=19903||19968<=i&&i<=42124||42128<=i&&i<=42182||43360<=i&&i<=43388||44032<=i&&i<=55203||55216<=i&&i<=55238||55243<=i&&i<=55291||63744<=i&&i<=64255||65040<=i&&i<=65049||65072<=i&&i<=65106||65108<=i&&i<=65126||65128<=i&&i<=65131||110592<=i&&i<=110593||127488<=i&&i<=127490||127504<=i&&i<=127546||127552<=i&&i<=127560||127568<=i&&i<=127569||131072<=i&&i<=194367||177984<=i&&i<=196605||196608<=i&&i<=262141?"W":32<=i&&i<=126||162<=i&&i<=163||165<=i&&i<=166||i===172||i===175||10214<=i&&i<=10221||10629<=i&&i<=10630?"Na":i===161||i===164||167<=i&&i<=168||i===170||173<=i&&i<=174||176<=i&&i<=180||182<=i&&i<=186||188<=i&&i<=191||i===198||i===208||215<=i&&i<=216||222<=i&&i<=225||i===230||232<=i&&i<=234||236<=i&&i<=237||i===240||242<=i&&i<=243||247<=i&&i<=250||i===252||i===254||i===257||i===273||i===275||i===283||294<=i&&i<=295||i===299||305<=i&&i<=307||i===312||319<=i&&i<=322||i===324||328<=i&&i<=331||i===333||338<=i&&i<=339||358<=i&&i<=359||i===363||i===462||i===464||i===466||i===468||i===470||i===472||i===474||i===476||i===593||i===609||i===708||i===711||713<=i&&i<=715||i===717||i===720||728<=i&&i<=731||i===733||i===735||768<=i&&i<=879||913<=i&&i<=929||931<=i&&i<=937||945<=i&&i<=961||963<=i&&i<=969||i===1025||1040<=i&&i<=1103||i===1105||i===8208||8211<=i&&i<=8214||8216<=i&&i<=8217||8220<=i&&i<=8221||8224<=i&&i<=8226||8228<=i&&i<=8231||i===8240||8242<=i&&i<=8243||i===8245||i===8251||i===8254||i===8308||i===8319||8321<=i&&i<=8324||i===8364||i===8451||i===8453||i===8457||i===8467||i===8470||8481<=i&&i<=8482||i===8486||i===8491||8531<=i&&i<=8532||8539<=i&&i<=8542||8544<=i&&i<=8555||8560<=i&&i<=8569||i===8585||8592<=i&&i<=8601||8632<=i&&i<=8633||i===8658||i===8660||i===8679||i===8704||8706<=i&&i<=8707||8711<=i&&i<=8712||i===8715||i===8719||i===8721||i===8725||i===8730||8733<=i&&i<=8736||i===8739||i===8741||8743<=i&&i<=8748||i===8750||8756<=i&&i<=8759||8764<=i&&i<=8765||i===8776||i===8780||i===8786||8800<=i&&i<=8801||8804<=i&&i<=8807||8810<=i&&i<=8811||8814<=i&&i<=8815||8834<=i&&i<=8835||8838<=i&&i<=8839||i===8853||i===8857||i===8869||i===8895||i===8978||9312<=i&&i<=9449||9451<=i&&i<=9547||9552<=i&&i<=9587||9600<=i&&i<=9615||9618<=i&&i<=9621||9632<=i&&i<=9633||9635<=i&&i<=9641||9650<=i&&i<=9651||9654<=i&&i<=9655||9660<=i&&i<=9661||9664<=i&&i<=9665||9670<=i&&i<=9672||i===9675||9678<=i&&i<=9681||9698<=i&&i<=9701||i===9711||9733<=i&&i<=9734||i===9737||9742<=i&&i<=9743||9748<=i&&i<=9749||i===9756||i===9758||i===9792||i===9794||9824<=i&&i<=9825||9827<=i&&i<=9829||9831<=i&&i<=9834||9836<=i&&i<=9837||i===9839||9886<=i&&i<=9887||9918<=i&&i<=9919||9924<=i&&i<=9933||9935<=i&&i<=9953||i===9955||9960<=i&&i<=9983||i===10045||i===10071||10102<=i&&i<=10111||11093<=i&&i<=11097||12872<=i&&i<=12879||57344<=i&&i<=63743||65024<=i&&i<=65039||i===65533||127232<=i&&i<=127242||127248<=i&&i<=127277||127280<=i&&i<=127337||127344<=i&&i<=127386||917760<=i&&i<=917999||983040<=i&&i<=1048573||1048576<=i&&i<=1114109?"A":"N"};function Fl(n,t={},e){e||(e=1);const{fontStyle:i=t.fontStyle,fontVariant:o=t.fontVariant,fontWeight:r=t.fontWeight,fontSize:s=t.fontSize,fontFamily:l=t.fontFamily}=n;return(i?i+" ":"")+(o?o+" ":"")+(r?r+" ":"")+s*e+"px "+(l||"sans-serif")}class Oe{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=e??{},this.textSpec=this._initSpec(),I(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=I(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(ct(this._canvas)&&(I(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),ct(this._canvas)&&typeof window<"u"&&window.document!==void 0&&globalThis&&I(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),ct(this._context)&&I(this._canvas)){const t=this._canvas.getContext("2d");I(t)&&(t.save(),t.font=Fl(this.textSpec),this._contextSaved=!0,this._context=t)}return!ct(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:o={}}=this._option,{fontStyle:r=o.fontStyle,fontVariant:s=o.fontVariant,fontWeight:l=(t=o.fontWeight)!==null&&t!==void 0?t:"normal",fontSize:a=(e=o.fontSize)!==null&&e!==void 0?e:12,fontFamily:h=(i=o.fontFamily)!==null&&i!==void 0?i:"sans-serif",align:d,textAlign:u=d??"center",baseline:c,textBaseline:g=c??"middle",ellipsis:f,limit:p}=this._userSpec;let{lineHeight:v=a}=this._userSpec;if(Qt(v)&&v[v.length-1]==="%"){const m=Number.parseFloat(v.substring(0,v.length-1))/100;v=a*m}return{fontStyle:r,fontVariant:s,fontFamily:h,fontSize:a,fontWeight:l,textAlign:u,textBaseline:g,ellipsis:f,limit:p,lineHeight:v}}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(ct(t))return{width:0,height:0};if(ct(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:o,textAlign:r,textBaseline:s,ellipsis:l,limit:a,lineHeight:h}=this.textSpec;let d;try{const u=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:o,textAlign:r,textBaseline:s,ellipsis:!!l,maxLineWidth:a||1/0,lineHeight:h});d={width:u.width(),height:u.height()}}catch{this._notSupportVRender=!0,d=this.measureWithNaiveCanvas(t)}return d}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:o,lineHeight:r}=this.textSpec;return{width:i.width,height:(e=r)!==null&&e!==void 0?e:o}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;i<t.length;i++){const o=t[i];let r=this._measureSpecialChar(o);ct(r)&&Oe.NUMBERS_CHAR_SET.includes(o)&&(r=this._measureNumberChar()),ct(r)&&["F","W"].includes($f(o))&&(r=this._measureFullSizeChar()),ct(r)&&(r=this._measureLetterChar()),e.width+=r.width,e.height=Math.max(e.height,r.height)}return e}quickMeasureWithoutCanvas(t){return this._measureReduce(t,this._quickMeasureWithoutCanvas.bind(this))}_quickMeasureWithoutCanvas(t){var e;const i={width:0,height:0},{fontSize:o,lineHeight:r}=this.textSpec;for(let s=0;s<t.length;s++){const l=t[s],a=["F","W"].includes($f(l))?1:.53;i.width+=a*o}return i.height=(e=r)!==null&&e!==void 0?e:o,i}_measureReduce(t,e){var i;const{fontSize:o,lineHeight:r}=this.textSpec,s={width:0,height:0};if(ct(t))return s;if(it(t)){const l=t.filter(I).map(a=>a.toString());return l.length===0?s:l.length===1?e(l[0]):{width:l.reduce((a,h)=>Math.max(a,e(h).width),0),height:l.length*(((i=r)!==null&&i!==void 0?i:o)+1)+1}}return e(t.toString())}_measureNumberChar(){if(ct(this._numberCharSize)){const t=this._standardMethod(Oe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Oe.NUMBERS_CHAR_SET.length,height:t.height}}return this._numberCharSize}_measureFullSizeChar(){return ct(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Oe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(ct(this._letterCharSize)){const t=this._standardMethod(Oe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Oe.ALPHABET_CHAR_SET.length,height:t.height}}return this._letterCharSize}_measureSpecialChar(t){return I(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){I(this._canvas)&&(this._canvas=null),I(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Oe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Oe.NUMBERS_CHAR_SET="0123456789",Oe.FULL_SIZE_CHAR="字";function Qd(n,t,e){const{x1:i,y1:o,x2:r,y2:s}=t;return e.onlyTranslate()?(n!==t&&n.setValue(t.x1,t.y1,t.x2,t.y2),n.translate(e.e,e.f),t):(n.clear(),n.add(e.a*i+e.c*o+e.e,e.b*i+e.d*o+e.f),n.add(e.a*r+e.c*o+e.e,e.b*r+e.d*o+e.f),n.add(e.a*r+e.c*s+e.e,e.b*r+e.d*s+e.f),n.add(e.a*i+e.c*s+e.e,e.b*i+e.d*s+e.f),t)}class Ci{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ci(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(t=0,e=0,i=0,o=0){return this.x1=t,this.y1=e,this.x2=i,this.y2=o,this}set(t=0,e=0,i=0,o=0){return i<t?(this.x2=t,this.x1=i):(this.x1=t,this.x2=i),o<e?(this.y2=e,this.y1=o):(this.y1=e,this.y2=o),this}add(t=0,e=0){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=0){return it(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),this}round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this}translate(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=0){const o=this.rotatedPoints(t,e,i);return this.clear().add(o[0],o[1]).add(o[2],o[3]).add(o[4],o[5]).add(o[6],o[7])}scale(t=0,e=0,i=0,o=0){const r=this.scalePoints(t,e,i,o);return this.clear().add(r[0],r[1]).add(r[2],r[3])}union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.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<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this}encloses(t){return t&&this.x1<=t.x1&&this.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.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)}contains(t=0,e=0){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)}containsPoint(t){return!(t.x<this.x1||t.x>this.x2||t.y<this.y1||t.y>this.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Qd(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:o,y1:r,x2:s,y2:l}=this,a=Math.cos(t),h=Math.sin(t),d=e-e*a+i*h,u=i-e*h-i*a;return[a*o-h*r+d,h*o+a*r+u,a*o-h*l+d,h*o+a*l+u,a*s-h*r+d,h*s+a*r+u,a*s-h*l+d,h*s+a*l+u]}scalePoints(t,e,i,o){const{x1:r,y1:s,x2:l,y2:a}=this;return[t*r+(1-t)*i,e*s+(1-e)*o,t*l+(1-t)*i,e*a+(1-e)*o]}}class he extends Ci{}class tw extends Ci{constructor(t,e=0){super(t),t&&(this.angle=e)}intersects(t){return Kf(this,t)}setValue(t=0,e=0,i=0,o=0,r=0){return super.setValue(t,e,i,o),this.angle=r,this}}class He{constructor(t=1,e=0,i=0,o=1,r=0,s=0){this.a=t,this.b=e,this.c=i,this.d=o,this.e=r,this.f=s}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,o,r,s){return!(this.e!==r||this.f!==s||this.a!==t||this.d!==o||this.b!==e||this.c!==i)}setValue(t,e,i,o,r,s){return this.a=t,this.b=e,this.c=i,this.d=o,this.e=r,this.f=s,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,o=this.d,r=this.e,s=this.f,l=new He,a=t*o-e*i;return l.a=o/a,l.b=-e/a,l.c=-i/a,l.d=t/a,l.e=(i*s-o*r)/a,l.f=-(t*s-e*r)/a,l}rotate(t){const e=Math.cos(t),i=Math.sin(t),o=this.a*e+this.c*i,r=this.b*e+this.d*i,s=this.a*-i+this.c*e,l=this.b*-i+this.d*e;return this.a=o,this.b=r,this.c=s,this.d=l,this}rotateByCenter(t,e,i){const o=Math.cos(t),r=Math.sin(t),s=(1-o)*e+r*i,l=(1-o)*i-r*e,a=o*this.a-r*this.b,h=r*this.a+o*this.b,d=o*this.c-r*this.d,u=r*this.c+o*this.d,c=o*this.e-r*this.f+s,g=r*this.e+o*this.f+l;return this.a=a,this.b=h,this.c=d,this.d=u,this.e=c,this.f=g,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,o,r,s){return this.multiply(t,e,i,o,r,s),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:o,e:r,f:s}=this;return this.a=e,this.b=t,this.c=o,this.d=i,this.e=s,this.f=r,this}multiply(t,e,i,o,r,s){const l=this.a,a=this.b,h=this.c,d=this.d,u=l*t+h*e,c=a*t+d*e,g=l*i+h*o,f=a*i+d*o,p=l*r+h*s+this.e,v=a*r+d*s+this.f;return this.a=u,this.b=c,this.c=g,this.d=f,this.e=p,this.f=v,this}interpolate(t,e){const i=new He;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:o,c:r,d:s,e:l,f:a}=this,h=i*s-o*r,d=s/h,u=-o/h,c=-r/h,g=i/h,f=(r*a-s*l)/h,p=-(i*a-o*l)/h,{x:v,y:m}=t;e.x=v*d+m*c+f,e.y=v*u+m*g+p}onlyTranslate(t=1){return this.a===t&&this.b===0&&this.c===0&&this.d===t}clone(){return new He(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,o=this.d,r=t*o-e*i,s={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!==0||e!==0){const l=Math.sqrt(t*t+e*e);s.rotateDeg=e>0?Math.acos(t/l):-Math.acos(t/l),s.scaleX=l,s.scaleY=r/l,s.skewX=(t*i+e*o)/r,s.skewY=0}else if(i!==0||o!==0){const l=Math.sqrt(i*i+o*o);s.rotateDeg=Math.PI/2-(o>0?Math.acos(-i/l):-Math.acos(i/l)),s.scaleX=r/l,s.scaleY=l,s.skewX=0,s.skewY=(t*i+e*o)/r}return s.rotateDeg=q1(s.rotateDeg),s}}function ew(n,t,e,i,o,r,s,l){const a=t.a,h=t.b,d=t.c,u=t.d,c=t.e,g=t.f,f=Pe(s),p=pe(s);let v,m;l?(v=l[0],m=l[1]):(v=e,m=i);const b=v-e,w=m-i,C=a*f+d*p,_=h*f+u*p,y=d*f-a*p,x=u*f-h*p;n.a=o*C,n.b=o*_,n.c=r*y,n.d=r*x,n.e=c+a*v+d*m-C*b-y*w,n.f=g+h*v+u*m-_*b-x*w}class iw{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:o=this.L_TIME,R_COUNT:r=this.R_COUNT}=e;if(t.size<i)return 0;let s=0;const l=h=>{s++,t.delete(h)},a=Date.now();return t.forEach((h,d)=>{if(h.timestamp.length<r)return l(d);let u=0;for(;a-h.timestamp[h.timestamp.length-1-u]<o&&(u++,!(u>=r)););if(u<r)return l(d);for(;a-h.timestamp[0]>o;)h.timestamp.shift()}),s}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:o=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>o&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,o=Date.now();t.forEach(r=>{for(;o-r.timestamp[0]>i;)r.timestamp.shift()})}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,o=Date.now();for(;o-t.timestamp[0]>i;)t.timestamp.shift()}}function tu(n,t,e){t/=100,e/=100;const i=(1-Math.abs(2*e-1))*t,o=i*(1-Math.abs(n/60%2-1)),r=e-i/2;let s=0,l=0,a=0;return 0<=n&&n<60?(s=i,l=o,a=0):60<=n&&n<120?(s=o,l=i,a=0):120<=n&&n<180?(s=0,l=i,a=o):180<=n&&n<240?(s=0,l=o,a=i):240<=n&&n<300?(s=o,l=0,a=i):300<=n&&n<360&&(s=i,l=0,a=o),s=Math.round(255*(s+r)),l=Math.round(255*(l+r)),a=Math.round(255*(a+r)),{r:s,g:l,b:a}}function eu(n,t,e){n/=255,t/=255,e/=255;const i=Math.min(n,t,e),o=Math.max(n,t,e),r=o-i;let s=0,l=0,a=0;return s=r===0?0:o===n?(t-e)/r%6:o===t?(e-n)/r+2:(n-t)/r+4,s=Math.round(60*s),s<0&&(s+=360),a=(o+i)/2,l=r===0?0:r/(1-Math.abs(2*a-1)),l=+(100*l).toFixed(1),a=+(100*a).toFixed(1),{h:s,s:l,l:a}}const nw=/^#([0-9a-f]{3,8})$/,Yf={transparent:4294967040},kl={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 Il(n){return((n=Math.max(0,Math.min(255,Math.round(n)||0)))<16?"0":"")+n.toString(16)}function Xf(n){return nt(n)?new li(n>>16,n>>8&255,255&n,1):it(n)?new li(n[0],n[1],n[2]):new li(255,255,255)}function ow(n){return nt(n)?new li(n>>>24,n>>>16&255,n>>>8&255,255&n):it(n)?new li(n[0],n[1],n[2],n[3]):new li(255,255,255,1)}function iu(n){return n<.04045?.0773993808*n:Math.pow(.9478672986*n+.0521327014,2.4)}function nu(n){return n<.0031308?12.92*n:1.055*Math.pow(n,.41666)-.055}const qf=(n,t)=>{const e=nw.exec(n);if(t||e){const i=parseInt(e[1],16),o=e[1].length;return o===3?new li((i>>8&15)+((i>>8&15)<<4),(i>>4&15)+((i>>4&15)<<4),(15&i)+((15&i)<<4),1):o===6?Xf(i):o===8?new li(i>>24&255,i>>16&255,i>>8&255,(255&i)/255):null}};class _i{static Brighter(t,e=1){return e===1?t:new _i(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return e===1?t:new _i(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof _i?t:new _i(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3()}}static parseColorString(t){if(I(Yf[t]))return ow(Yf[t]);if(I(kl[t]))return Xf(kl[t]);const e=`${t}`.trim().toLowerCase(),i=qf(e);if(i!==void 0)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const o=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new li(parseInt(o[0],10),parseInt(o[1],10),parseInt(o[2],10),parseFloat(o[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const o=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),r=tu(parseInt(o[0],10),parseInt(o[1],10),parseInt(o[2],10));return new li(r.r,r.g,r.b,parseFloat(o[3]))}}constructor(t){const e=_i.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new li(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:o}=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(o*t))),this}add(t){const{r:e,g:i,b:o}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,o+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:o}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(o*t.color.b))),this}getHSVBrightness(){return Math.max(this.color.r,this.color.g,this.color.b)/255}getHSLBrightness(){return .5*(Math.max(this.color.r,this.color.g,this.color.b)/255+Math.min(this.color.r,this.color.g,this.color.b)/255)}setHsl(t,e,i){const o=this.color.opacity,r=eu(this.color.r,this.color.g,this.color.b),s=tu(ct(t)?r.h:bi(t,0,360),ct(e)?r.s:e>=0&&e<=1?100*e:e,ct(i)?r.l:i<=1&&i>=0?100*i:i);return this.color=new li(s.r,s.g,s.b,o),this}setRGB(t,e,i){return!ct(t)&&(this.color.r=t),!ct(e)&&(this.color.g=e),!ct(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=qf(e,!0);return i??this}setColorName(t){const e=kl[t.toLowerCase()];return e!==void 0?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(t=1){return this.color.opacity=t,this}getLuminance(){return(.2126*this.color.r+.7152*this.color.g+.0722*this.color.b)/255}getLuminance2(){return(.2627*this.color.r+.678*this.color.g+.0593*this.color.b)/255}getLuminance3(){return(.299*this.color.r+.587*this.color.g+.114*this.color.b)/255}clone(){return new _i(this.color.toString())}copyGammaToLinear(t,e=2){return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=iu(t.color.r),this.color.g=iu(t.color.g),this.color.b=iu(t.color.b),this}copyLinearToSRGB(t){return this.color.r=nu(t.color.r),this.color.g=nu(t.color.g),this.color.b=nu(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class li{constructor(t,e,i,o){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)),I(o)?this.opacity=isNaN(+o)?1:Math.max(0,Math.min(1,+o)):this.opacity=1}formatHex(){return`#${Il(this.r)+Il(this.g)+Il(this.b)+(this.opacity===1?"":Il(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${t===1?"rgb(":"rgba("}${this.r},${this.g},${this.b}${t===1?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:o}=eu(this.r,this.g,this.b);return`${t===1?"hsl(":"hsla("}${e},${i}%,${o}%${t===1?")":`,${t})`}`}toString(){return this.formatHex()}}function rw(n){let t="",e="",i="";const o=n[0]==="#"?1:0;for(let r=o;r<n.length;r++)n[r]!=="#"&&(r<o+2?t+=n[r]:r<o+4?e+=n[r]:r<o+6&&(i+=n[r]));return[parseInt(t,16),parseInt(e,16),parseInt(i,16)]}function sw(n,t,e){return Number((1<<24)+(n<<16)+(t<<8)+e).toString(16).slice(1)}function lw(n,t){const e=n.r,i=t.r,o=n.g,r=t.g,s=n.b,l=t.b,a=n.opacity,h=t.opacity;return d=>{const u=Math.round(e*(1-d)+i*d),c=Math.round(o*(1-d)+r*d),g=Math.round(s*(1-d)+l*d);return new li(u,c,g,a*(1-d)+h*d)}}const aw=Object.freeze(Object.defineProperty({__proto__:null,Color:_i,DEFAULT_COLORS:kl,RGB:li,hexToRgb:rw,hslToRgb:tu,interpolateRgb:lw,rgbToHex:sw,rgbToHsl:eu},Symbol.toStringTag,{value:"Module"}));function gn(n){if(ie(n))return[n,n,n,n];if(it(n)){const t=n.length;if(t===1){const e=n[0];return[e,e,e,e]}if(t===2){const[e,i]=n;return[e,i,e,i]}if(t===3){const[e,i,o]=n;return[e,i,o,i]}if(t===4)return n}if($t(n)){const{top:t=0,right:e=0,bottom:i=0,left:o=0}=n;return[t,e,i,o]}return[0,0,0,0]}function hw(n){try{return n instanceof Element}catch{const e=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],i=Object.keys(n);return e.every(o=>i.includes(o))}}const dw=Ye-1e-8;class ou{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,o,r,s){if(Math.abs(r-o)>dw)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let l,a,h,d,u=1/0,c=-1/0,g=1/0,f=-1/0;function p(v){h=i*Math.cos(v),d=i*Math.sin(v),h<u&&(u=h),h>c&&(c=h),d<g&&(g=d),d>f&&(f=d)}if(p(o),p(r),r!==o)if((o%=Ye)<0&&(o+=Ye),(r%=Ye)<0&&(r+=Ye),r<o&&(s=!s,l=o,o=r,r=l),s)for(r-=Ye,l=o-o%Ei,a=0;a<4&&l>r;++a,l-=Ei)p(l);else for(l=o-o%Ei+Ei,a=0;a<4&&l<r;++a,l+=Ei)p(l);this.bounds.add(t+u,e+g),this.bounds.add(t+c,e+f)}arcTo(t,e,i,o,r){this.bounds.add(t,e)}bezierCurveTo(t,e,i,o,r,s){this.bounds.add(t,e),this.bounds.add(i,o),this.bounds.add(r,s)}closePath(){}ellipse(){throw new Error("不支持ellipse")}lineTo(t,e){this.bounds.add(t,e)}moveTo(t,e){this.bounds.add(t,e)}quadraticCurveTo(t,e,i,o){this.bounds.add(t,e),this.bounds.add(i,o)}rect(t,e,i,o){this.bounds.add(t,e),this.bounds.add(t+i,e+o)}clear(){this.bounds.clear()}release(...t){}}class uw{constructor(){this.curves=[],this.bounds=new he}getCurveLengths(){return this.curves.map(t=>t.getLength())}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const cw=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,gw={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},qt={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ru,Zf,zl,Jf,su,Dl;function fw(n){if(!n)return[];const t=n.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(t===null)return[];let e,i;const o=[];for(let r=0,s=t.length;r<s;r++)if(ru=t[r],Zf=ru.slice(1),zl=ru[0],e=[zl],i=Zf.match(cw),i!==null){for(let l=0,a=i.length;l<a;l++)Jf=i[l],su=parseFloat(Jf),Number.isNaN(su)||e.push(su);if(Dl=gw[zl],e.length-1>Dl){let l,a=zl;for(let h=1,d=e.length;h<d;h+=Dl){l=[a];for(let u=h,c=h+Dl;u<c;u++)l.push(e[u]);o.push(l),a==="m"?a="l":a==="M"&&(a="L")}}else o.push(e)}else o.push(e);return o}var te;(function(n){n[n.NONE=0]="NONE",n[n.UPDATE_BOUNDS=1]="UPDATE_BOUNDS",n[n.UPDATE_SHAPE=2]="UPDATE_SHAPE",n[n.CLEAR_SHAPE=253]="CLEAR_SHAPE",n[n.UPDATE_SHAPE_AND_BOUNDS=3]="UPDATE_SHAPE_AND_BOUNDS",n[n.INIT=179]="INIT",n[n.CLEAR_BOUNDS=254]="CLEAR_BOUNDS",n[n.UPDATE_GLOBAL_MATRIX=32]="UPDATE_GLOBAL_MATRIX",n[n.CLEAR_GLOBAL_MATRIX=223]="CLEAR_GLOBAL_MATRIX",n[n.UPDATE_LOCAL_MATRIX=16]="UPDATE_LOCAL_MATRIX",n[n.CLEAR_LOCAL_MATRIX=239]="CLEAR_LOCAL_MATRIX",n[n.UPDATE_GLOBAL_LOCAL_MATRIX=48]="UPDATE_GLOBAL_LOCAL_MATRIX",n[n.UPDATE_LAYOUT=128]="UPDATE_LAYOUT",n[n.CLEAR_LAYOUT=127]="CLEAR_LAYOUT"})(te||(te={}));var rs;(function(n){n[n.GLOBAL=1]="GLOBAL",n[n.LOCAL=16]="LOCAL",n[n.GLOBAL_ACCURATE=3]="GLOBAL_ACCURATE",n[n.LOCAL_ACCURATE=48]="LOCAL_ACCURATE"})(rs||(rs={}));var fi;(function(n){n[n.INIT=0]="INIT",n[n.DEFAULT=1]="DEFAULT",n[n.STATE=2]="STATE",n[n.ANIMATE_BIND=10]="ANIMATE_BIND",n[n.ANIMATE_PLAY=11]="ANIMATE_PLAY",n[n.ANIMATE_START=12]="ANIMATE_START",n[n.ANIMATE_UPDATE=13]="ANIMATE_UPDATE",n[n.ANIMATE_END=14]="ANIMATE_END",n[n.TRANSLATE=20]="TRANSLATE",n[n.TRANSLATE_TO=21]="TRANSLATE_TO",n[n.SCALE=22]="SCALE",n[n.SCALE_TO=23]="SCALE_TO",n[n.ROTATE=24]="ROTATE",n[n.ROTATE_TO=25]="ROTATE_TO"})(fi||(fi={}));var ni;(function(n){n[n.INITIAL=0]="INITIAL",n[n.RUNNING=1]="RUNNING",n[n.PAUSED=2]="PAUSED",n[n.END=3]="END"})(ni||(ni={}));var Ol;(function(n){n[n.NORMAL=0]="NORMAL",n[n.SET_ATTR_IMMEDIATELY=1]="SET_ATTR_IMMEDIATELY"})(Ol||(Ol={}));var rr;(function(n){n.wait="wait",n.from="from",n.to="to",n.customAnimate="customAnimate"})(rr||(rr={}));var re;(function(n){n[n.ROW=1]="ROW",n[n.COLUMN=2]="COLUMN"})(re||(re={}));var Wl;(function(n){n[n.CubicBezierCurve=0]="CubicBezierCurve",n[n.QuadraticBezierCurve=1]="QuadraticBezierCurve",n[n.ArcCurve=2]="ArcCurve",n[n.LineCurve=3]="LineCurve",n[n.EllipseCurve=4]="EllipseCurve",n[n.MoveCurve=5]="MoveCurve"})(Wl||(Wl={}));var Ut;(function(n){n[n.beforeFillStroke=0]="beforeFillStroke",n[n.afterFillStroke=1]="afterFillStroke"})(Ut||(Ut={}));function pw(n,t,e,i,o,r,s,l,a){const h=Li(s),d=Math.sin(h),u=Math.cos(h),c=u*(l-n)*.5+d*(a-t)*.5,g=u*(a-t)*.5-d*(l-n)*.5;let f=c*c/((e=Math.abs(e))*e)+g*g/((i=Math.abs(i))*i);f>1&&(f=Math.sqrt(f),e*=f,i*=f);const p=u/e,v=d/e,m=-d/i,b=u/i,w=p*l+v*a,C=m*l+b*a,_=p*n+v*t,y=m*n+b*t;let x=1/((_-w)*(_-w)+(y-C)*(y-C))-.25;x<0&&(x=0);let S=Math.sqrt(x);r===o&&(S=-S);const A=.5*(w+_)-S*(y-C),R=.5*(C+y)+S*(_-w),T=Math.atan2(C-R,w-A);let M=Math.atan2(y-R,_-A)-T;M<0&&r===1?M+=Ye:M>0&&r===0&&(M-=Ye);const P=Math.ceil(Math.abs(M/(Ei+.001))),k=[];for(let B=0;B<P;++B){const H=T+B*M/P,E=T+(B+1)*M/P;k[B]=[A,R,H,E,e,i,d,u]}return k}function vw(n){const t=n[0],e=n[1],i=n[2],o=n[3],r=n[4],s=n[5],l=n[6],a=n[7],h=a*r,d=-l*s,u=l*r,c=a*s,g=Math.cos(i),f=Math.sin(i),p=Math.cos(o),v=Math.sin(o),m=.5*(o-i),b=Math.sin(.5*m),w=8/3*b*b/Math.sin(m),C=t+g-w*f,_=e+f+w*g,y=t+p,x=e+v,S=y+w*v,A=x-w*p;return[h*C+d*_,u*C+c*_,h*S+d*A,u*S+c*A,h*y+d*x,u*y+c*x]}function Qf(n,t,e,i){const o=pw(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,e);for(let r=0;r<o.length;++r){const s=vw(o[r]);n.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}}const mw=(n,t,e,i,o,r,s)=>{const l=Math.abs(e-t),a=l>.5*Math.PI?Math.ceil(2*l/Math.PI):1,h=(e-t)/a;for(let d=0;d<a;d++){const u=t+h*d,c=t+h*(d+1),g=4*Math.tan(Math.abs(h)/4)/3,f=c<u?-1:1,p=Math.cos(u),v=Math.sin(u),m=Math.cos(c),b=Math.sin(c),w=p*r+i,C=v*s+o,_=m*r+i,y=b*s+o,x=r*g*f,S=s*g*f;n.push(w-x*v,C+S*p,_+x*b,y-S*m,_,y)}},bw=[(n,t,e,i,o,r,s)=>t.arc(n[1]*o+e,n[2]*r+i,n[3]*(o+r)/2,n[4],n[5],n[6],s),(n,t,e,i,o,r,s)=>t.arcTo(n[1]*o+e,n[2]*r+i,n[3]*o+e,n[4]*r+i,n[5]*(o+r)/2,s),(n,t,e,i,o,r,s)=>t.bezierCurveTo(n[1]*o+e,n[2]*r+i,n[3]*o+e,n[4]*r+i,n[5]*o+e,n[6]*r+i,s),(n,t,e,i)=>t.closePath(),(n,t,e,i,o,r)=>t.ellipse(n[1]*o+e,n[2]*r+i,n[3]*o,n[4]*r,n[5],n[6],n[7],n[8]),(n,t,e,i,o,r,s)=>t.lineTo(n[1]*o+e,n[2]*r+i,s),(n,t,e,i,o,r,s)=>t.moveTo(n[1]*o+e,n[2]*r+i,s),(n,t,e,i,o,r,s)=>t.quadraticCurveTo(n[1]*o+e,n[2]*r+i,n[3]*o+e,n[4]*r+i,s),(n,t,e,i,o,r,s)=>t.rect(n[1]*o+e,n[2]*r+i,n[3]*o,n[4]*r,s)];function qn(n,t,e=0,i=0,o=1,r=1,s){for(let l=0;l<n.length;l++){const a=n[l];bw[a[0]](a,t,e,i,o,r,s)}}class t0{getLength(t){return t!=null?this.calcProjLength(t):(Number.isFinite(this.length)||(this.length=this.calcLength()),this.length)}}function Cw(n,t){let e=0;const i=n.length;for(let o=0;o<i;o++){const r=n[o],s=t[o],l=n[(o+1)%i],a=t[(o+1)%i];e+=Rn.distanceNN(r,s,l,a)}return e/2}function _w(n,t,e,i,o){return Cw([n.x,t.x,e.x,i.x],[n.y,t.y,e.y,i.y])}function e0(n,t,e,i,o){const r=1-o;return r*r*r*n+3*t*o*r*r+3*e*o*o*r+i*o*o*o}function i0(n,t,e,i,o){const r=e0(n.x,t.x,e.x,i.x,o),s=e0(n.y,t.y,e.y,i.y,o);return new ye(r,s)}function lu(n,t){const{p0:e,p1:i,p2:o,p3:r}=n,s=i0(e,i,o,r,t),l=Rn.pointAtPP(e,i,t),a=Rn.pointAtPP(i,o,t),h=Rn.pointAtPP(o,r,t),d=Rn.pointAtPP(l,a,t),u=Rn.pointAtPP(a,h,t);return[new au(e,l,d,s),new au(s,u,h,r)]}class au extends t0{constructor(t,e,i,o){super(),this.type=Wl.CubicBezierCurve,this.p0=t,this.p1=e,this.p2=i,this.p3=o}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y+this.p3.x+this.p3.y)}getPointAt(t){if(this.defined!==!1)return i0(this.p0,this.p1,this.p2,this.p3,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?_w(this.p0,this.p1,this.p2,this.p3):60}calcProjLength(t){return t===re.ROW?Jt(this.p0.x-this.p3.x):t===re.COLUMN?Jt(this.p0.y-this.p3.y):0}getAngleAt(t){const e=Xn(t-.01,0),i=ii(t+.01,1),o=this.getPointAt(e),r=this.getPointAt(i);return Xt(r.y-o.y,r.x-o.x)}}function n0(n,t){const{p0:e,p1:i}=n,o=Rn.pointAtPP(e,i,t);return[new hu(e,o),new hu(o,i)]}class hu extends t0{constructor(t,e){super(),this.type=Wl.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(this.defined!==!1)return Rn.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return this.angle==null&&(this.angle=Xt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Rn.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===re.ROW?Jt(this.p0.x-this.p1.x):t===re.COLUMN?Jt(this.p0.y-this.p1.y):0}}class du{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,o,r,s,l,a){const h=new au(new ye(this._lastX,this._lastY),new ye(t,e),new ye(i,o),new ye(r,s));h.originP1=this._lastOriginP,h.originP2=a,h.defined=l,this.curves.push(h),this._lastX=r,this._lastY=s,this._lastOriginP=a}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,o){const r=this.addLinearCurve(t,e,i,this._lastOriginP,o);this.curves.push(r),this._lastX=t,this._lastY=e,this._lastOriginP=o}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,o){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,o,r){const s=new hu(new ye(this._lastX,this._lastY),new ye(t,e));return s.originP1=o,s.originP2=r,s.defined=i,s}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===re.COLUMN){if(!this.curves.length)return 0;const o=this.curves[0],r=this.curves[this.curves.length-1],s=(e=r.p3)!==null&&e!==void 0?e:r.p1;return Jt(o.p0.y-s.y)}if(t===re.ROW){if(!this.curves.length)return 0;const o=this.curves[0],r=this.curves[this.curves.length-1],s=(i=r.p3)!==null&&i!==void 0?i:r.p1;return Jt(o.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce((o,r)=>o+r.getLength(),0)),this.length}}class yw extends du{bezierCurveTo(t,e,i,o,r,s,l,a){return super.bezierCurveTo(e,t,o,i,s,r,l,a)}lineTo(t,e,i,o){return super.lineTo(e,t,i,o)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function So(n,t,e=1){let i=!1;for(let o=0,r=t.length;o<=r;o++)o>=r===i&&((i=!i)?n.lineStart():n.lineEnd()),i&&n.point(t[o])}function sr(n,t,e){const i=t??(Jt(e[e.length-1].x-e[0].x)>Jt(e[e.length-1].y-e[0].y)?re.ROW:re.COLUMN);return n==="monotoneY"?new yw(n,i):new du(n,i)}class o0{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||this._line!==0&&this._point===1)&&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,this._lastDefined!==!1&&t.defined!==!1,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,this._lastDefined!==!1&&t.defined!==!1,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function ss(n,t={}){const{direction:e,startPoint:i}=t;if(n.length<2-+!!i)return null;const o=sr("linear",e,n);return ww(new o0(o,i),n),o}function ww(n,t){return So(n,t,1)}function r0(n,t,e,i,o){n.context.bezierCurveTo((2*n._x0+n._x1)/3,(2*n._y0+n._y1)/3,(n._x0+2*n._x1)/3,(n._y0+2*n._y1)/3,(n._x0+4*n._x1+t)/6,(n._y0+4*n._y1+e)/6,i,n.lastPoint1)}class Sw{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(){this._point===2&&r0(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1),(this._line||this._line!==0&&this._point===1)&&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,this._lastDefined1!==!1&&this._lastDefined2!==!1,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:r0(this,e,i,this._lastDefined1!==!1&&this._lastDefined2!==!1)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function xw(n,t){return So(n,t,2)}function Aw(n,t={}){const{direction:e,startPoint:i}=t;if(n.length<2-+!!i)return null;if(n.length<3-+!!i)return ss(n,t);const o=sr("basis",e,n);return xw(new Sw(o,i),n),o}function s0(n){return n<0?-1:1}function l0(n,t,e){const i=n._x1-n._x0,o=t-n._x1,r=(n._y1-n._y0)/(i||Number(o<0&&-0)),s=(e-n._y1)/(o||Number(i<0&&-0)),l=(r*o+s*i)/(i+o);return(s0(r)+s0(s))*Math.min(Math.abs(r),Math.abs(s),.5*Math.abs(l))||0}function a0(n,t){const e=n._x1-n._x0;return e?(3*(n._y1-n._y0)/e-t)/2:t}function uu(n,t,e,i,o){const r=n._x0,s=n._y0,l=n._x1,a=n._y1,h=(l-r)/3;n.context.bezierCurveTo(r+h,s+h*t,l-h,a-h*e,l,a,i,n.lastPoint1)}class h0{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,this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1);break;case 3:uu(this,this._t0,a0(this,this._t0),this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1)}(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,o=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,o,this._lastDefined1!==!1&&this._lastDefined2!==!1,t):this.context.moveTo(i,o,t);break;case 1:this._point=2;break;case 2:this._point=3,uu(this,a0(this,e=l0(this,i,o)),e,this._lastDefined1!==!1&&this._lastDefined2!==!1);break;default:uu(this,this._t0,e=l0(this,i,o),this._lastDefined1!==!1&&this._lastDefined2!==!1)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=o,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined!==!1,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Rw extends h0{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tw(n,t){return So(n,t,2)}function Mw(n,t={}){const{direction:e,startPoint:i}=t;if(n.length<2-+!!i)return null;if(n.length<3-+!!i)return ss(n,t);const o=sr("monotoneX",e,n);return Tw(new h0(o,i),n),o}function Bw(n,t){return So(n,t,2)}function Pw(n,t={}){const{direction:e,startPoint:i}=t;if(n.length<2-+!!i)return null;if(n.length<3-+!!i)return ss(n,t);const o=sr("monotoneY",e,n);return Bw(new Rw(o,i),n),o}let Hw=class{constructor(t,e=.5,i){this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0<this._t&&this._t<1&&this._point===2&&this.context.lineTo(this._x,this._y,this._lastDefined!==!1,this.lastPoint),(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line>=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,this._lastDefined!==!1&&t.defined!==!1,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,this._lastDefined!==!1&&t.defined!==!1,this.lastPoint),this.context.lineTo(e,i,this._lastDefined!==!1&&t.defined!==!1,t);else{const o=this._x*(1-this._t)+e*this._t;this.context.lineTo(o,this._y,this._lastDefined!==!1&&t.defined!==!1,this.lastPoint),this.context.lineTo(o,i,this._lastDefined!==!1&&t.defined!==!1,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function cu(n,t,e={}){const{direction:i,startPoint:o}=e;if(n.length<2-+!!o)return null;const r=new du("step",i??(Jt(n[n.length-1].x-n[0].x)>Jt(n[n.length-1].y-n[0].y)?re.ROW:re.COLUMN));return Ew(new Hw(r,t,o),n),r}function Ew(n,t){return So(n,t,1)}class Lw extends o0{lineEnd(){this.context.closePath()}}function Fw(n,t={}){const{direction:e,startPoint:i}=t;if(n.length<2-+!!i)return null;const o=sr("linear",e,n);return kw(new Lw(o,i),n),o}function kw(n,t){return So(n,t,1)}function d0(n,t,e,i,o){let r=n._x1,s=n._y1,l=n._x2,a=n._y2;if(n._l01_a>ae){const h=2*n._l01_2a+3*n._l01_a*n._l12_a+n._l12_2a,d=3*n._l01_a*(n._l01_a+n._l12_a);r=(r*h-n._x0*n._l12_2a+n._x2*n._l01_2a)/d,s=(s*h-n._y0*n._l12_2a+n._y2*n._l01_2a)/d}if(n._l23_a>ae){const h=2*n._l23_2a+3*n._l23_a*n._l12_a+n._l12_2a,d=3*n._l23_a*(n._l23_a+n._l12_a);l=(l*h+n._x1*n._l23_2a-t*n._l12_2a)/d,a=(a*h+n._y1*n._l23_2a-e*n._l12_2a)/d}n.context.bezierCurveTo(r,s,l,a,n._x2,n._y2,i,n.lastPoint1)}class Iw{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||this._line!==0&&this._point===1)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const o=this._x2-e,r=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(o*o+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,this._lastDefined1!==!1&&this._lastDefined2!==!1):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:d0(this,e,i,this._lastDefined1!==!1&&this._lastDefined2!==!1)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function u0(n,t){return function(e,i,o={}){const{direction:r,startPoint:s}=o;if(e.length<2-+!!s)return null;if(e.length<3-+!!s)return ss(e,o);const l=sr(n,r,e),a=new t(l,i,s);return So(a,e,2),l}}const zw=u0("catmullRom",Iw);class Dw{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,this._lastDefined1!==!1&&this._lastDefined2!==!1,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const o=this._x2-e,r=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(o*o+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:d0(this,e,i,this._lastDefined1!==!1&&this._lastDefined2!==!1)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}const Ow=u0("catmullRomClosed",Dw);function xo(n,t,e){var i,o;switch(t){case"linear":default:return ss(n,e);case"basis":return Aw(n,e);case"monotoneX":return Mw(n,e);case"monotoneY":return Pw(n,e);case"step":return cu(n,.5,e);case"stepBefore":return cu(n,0,e);case"stepAfter":return cu(n,1,e);case"catmullRom":return zw(n,(i=e==null?void 0:e.curveTension)!==null&&i!==void 0?i:.5,e);case"catmullRomClosed":return Ow(n,(o=e==null?void 0:e.curveTension)!==null&&o!==void 0?o:.5,e);case"linearClosed":return Fw(n,e)}}class Ue extends uw{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new ou(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([qt.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([qt.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,o){return this.commandList.push([qt.Q,t,e,i,o]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,o),this}bezierCurveTo(t,e,i,o,r,s){return this.commandList.push([qt.C,t,e,i,o,r,s]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,o,r,s),this}arcTo(t,e,i,o,r){return this.commandList.push([qt.AT,t,e,i,o,r]),this._ctx&&this._ctx.arcTo(t,e,i,o,r),this}ellipse(t,e,i,o,r,s,l,a){return this.commandList.push([qt.E,t,e,i,o,r,s,l,a]),this._ctx&&this._ctx.ellipse(t,e,i,o,r,s,l,a),this}rect(t,e,i,o){return this.commandList.push([qt.R,t,e,i,o]),this._ctx&&this._ctx.rect(t,e,i,o),this}arc(t,e,i,o,r,s){return this.commandList.push([qt.A,t,e,i,o,r,s]),this._ctx&&this._ctx.arc(t,e,i,o,r,s),this}closePath(){return this.commandList.push([qt.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const i=[];i[qt.M]=o=>`M${o[1]} ${o[2]}`,i[qt.L]=o=>`L${o[1]} ${o[2]}`,i[qt.Q]=o=>`Q${o[1]} ${o[2]} ${o[3]} ${o[4]}`,i[qt.C]=o=>`C${o[1]} ${o[2]} ${o[3]} ${o[4]} ${o[5]} ${o[6]}`,i[qt.A]=o=>{const r=[];mw(r,o[4],o[5],o[1],o[2],o[3],o[3]);let s="";for(let l=0;l<r.length;l+=6)s+=`C${r[l]} ${r[l+1]} ${r[l+2]} ${r[l+3]} ${r[l+4]} ${r[l+5]}`;return s},i[qt.R]=o=>`M${o[1]} ${o[2]} h${o[3]} v${o[4]} H${o[1]}Z`,i[qt.Z]=o=>"Z",this.toStringCbList=i}const t=this.toStringCbList;let e="";return this.commandList.forEach(i=>{e+=t[i[0]](i)}),e}fromString(t,e,i,o,r){this.clear();const s=fw(t);return this._runCommandStrList(s,e,i,o,r),this._updateBounds(),this}fromLine(t){const{points:e,curveType:i,clipRangeByDimension:o}=t.attribute;if(!e)return;const r=xo(e,i);o==="x"?this.direction=re.ROW:o==="y"?this.direction=re.COLUMN:o==="auto"&&(this.direction=r.direction),this.curves=r.curves}fromCustomPath2D(t,e,i,o,r){return this.clear(),this._runCommandList(t.commandList,e,i,o,r),this._updateBounds(),this}transform(t,e,i,o){const r=this.commandList;if(!this.transformCbList){const s=[];s[qt.M]=this.moveToTransform,s[qt.L]=this.lineToTransform,s[qt.Q]=this.quadraticCurveToTransform,s[qt.C]=this.bezierCurveToTransform,s[qt.AT]=this.arcToTransform,s[qt.E]=this.ellipseTransform,s[qt.R]=this.rectTransform,s[qt.A]=this.arcTransform,s[qt.Z]=this.closePathTransform,this.transformCbList=s}r.forEach(s=>{this.transformCbList[s[0]](s,t,e,i,o)}),this._updateBounds()}moveToTransform(t,e,i,o,r){t[1]=t[1]*o+e,t[2]=t[2]*r+i}lineToTransform(t,e,i,o,r){t[1]=t[1]*o+e,t[2]=t[2]*r+i}quadraticCurveToTransform(t,e,i,o,r){t[1]=t[1]*o+e,t[2]=t[2]*r+i,t[3]=t[3]*o+e,t[4]=t[4]*r+i}bezierCurveToTransform(t,e,i,o,r){t[1]=t[1]*o+e,t[2]=t[2]*r+i,t[3]=t[3]*o+e,t[4]=t[4]*r+i,t[5]=t[5]*o+e,t[6]=t[6]*r+i}arcToTransform(t,e,i,o,r){t[1]=t[1]*o+e,t[2]=t[2]*r+i,t[3]=t[3]*o+e,t[4]=t[4]*r+i,t[5]=t[5]*(o+r)/2}ellipseTransform(t,e,i,o,r){t[1]=t[1]*o+e,t[2]=t[2]*r+i,t[3]=t[3]*o,t[4]=t[4]*r}rectTransform(t,e,i,o,r){t[1]=t[1]*o+e,t[2]=t[2]*r+i,t[3]=t[3]*o,t[4]=t[4]*r}arcTransform(t,e,i,o,r){t[1]=t[1]*o+e,t[2]=t[2]*r+i,t[3]=t[3]*(o+r)/2}closePathTransform(){}_runCommandStrList(t,e=0,i=0,o=1,r=1){let s,l,a,h,d,u=null,c=0,g=0,f=0,p=0;for(let v=0,m=t.length;v<m;++v){switch(s=t[v],o===1&&r===1||(s=Ww(s,o,r)),s[0]){case"l":c+=s[1],g+=s[2],this.lineTo(c+e,g+i);break;case"L":c=s[1],g=s[2],this.lineTo(c+e,g+i);break;case"h":c+=s[1],this.lineTo(c+e,g+i);break;case"H":c=s[1],this.lineTo(c+e,g+i);break;case"v":g+=s[1],this.lineTo(c+e,g+i);break;case"V":g=s[1],this.lineTo(c+e,g+i);break;case"m":c+=s[1],g+=s[2],this.moveTo(c+e,g+i);break;case"M":c=s[1],g=s[2],this.moveTo(c+e,g+i);break;case"c":l=c+s[5],a=g+s[6],f=c+s[3],p=g+s[4],this.bezierCurveTo(c+s[1]+e,g+s[2]+i,f+e,p+i,l+e,a+i),c=l,g=a;break;case"C":c=s[5],g=s[6],f=s[3],p=s[4],this.bezierCurveTo(s[1]+e,s[2]+i,f+e,p+i,c+e,g+i);break;case"s":l=c+s[3],a=g+s[4],f=2*c-f,p=2*g-p,this.bezierCurveTo(f+e,p+i,c+s[1]+e,g+s[2]+i,l+e,a+i),f=c+s[1],p=g+s[2],c=l,g=a;break;case"S":l=s[3],a=s[4],f=2*c-f,p=2*g-p,this.bezierCurveTo(f+e,p+i,s[1]+e,s[2]+i,l+e,a+i),c=l,g=a,f=s[1],p=s[2];break;case"q":l=c+s[3],a=g+s[4],f=c+s[1],p=g+s[2],this.quadraticCurveTo(f+e,p+i,l+e,a+i),c=l,g=a;break;case"Q":l=s[3],a=s[4],this.quadraticCurveTo(s[1]+e,s[2]+i,l+e,a+i),c=l,g=a,f=s[1],p=s[2];break;case"t":l=c+s[1],a=g+s[2],u[0].match(/[QqTt]/)===null?(f=c,p=g):u[0]==="t"?(f=2*c-h,p=2*g-d):u[0]==="q"&&(f=2*c-f,p=2*g-p),h=f,d=p,this.quadraticCurveTo(f+e,p+i,l+e,a+i),c=l,g=a,f=c+s[1],p=g+s[2];break;case"T":l=s[1],a=s[2],f=2*c-f,p=2*g-p,this.quadraticCurveTo(f+e,p+i,l+e,a+i),c=l,g=a;break;case"a":Qf(this,c+e,g+i,[s[1],s[2],s[3],s[4],s[5],s[6]+c+e,s[7]+g+i]),c+=s[6],g+=s[7];break;case"A":Qf(this,c+e,g+i,[s[1],s[2],s[3],s[4],s[5],s[6]+e,s[7]+i]),c=s[6],g=s[7];break;case"z":case"Z":this.closePath()}u=s}}_runCommandList(t,e=0,i=0,o=1,r=1){if(e!==0||i!==0||o!==1||r!==1)for(let s=0,l=t.length;s<l;++s){const a=t[s].slice();switch(a[0]){case qt.L:this.lineToTransform(a,e,i,o,r);break;case qt.M:this.moveToTransform(a,e,i,o,r);break;case qt.C:this.bezierCurveToTransform(a,e,i,o,r);break;case qt.Q:this.quadraticCurveToTransform(a,e,i,o,r);break;case qt.A:this.arcToTransform(a,e,i,o,r);break;case qt.E:this.ellipseTransform(a,e,i,o,r);break;case qt.R:this.rectTransform(a,e,i,o,r);break;case qt.AT:this.arcToTransform(a,e,i,o,r);break;case qt.Z:this.closePath()}}else this.commandList=t.map(s=>s.slice())}_updateBounds(){this.bounds.clear(),qn(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===re.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Jt(t.p0.y-e.p1.y)}if(this.direction===re.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Jt(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 r=0;r<this.curves.length;r++){e=this.curves[r];const s=e.getLength(this.direction);if(i+s>=t)break;i+=s}const o=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(o),angle:e.getAngleAt(o)}}}const Fi=["l",0,0,0,0,0,0,0];function Ww(n,t,e){const i=Fi[0]=n[0];if(i==="a"||i==="A")Fi[1]=t*n[1],Fi[2]=e*n[2],Fi[3]=n[3],Fi[4]=n[4],Fi[5]=n[5],Fi[6]=t*n[6],Fi[7]=e*n[7];else if(i==="h"||i==="H")Fi[1]=t*n[1];else if(i==="v"||i==="V")Fi[1]=e*n[1];else for(let o=1,r=n.length;o<r;++o)Fi[o]=(o%2==1?t:e)*n[o];return Fi}const Nw={alignSelf:"auto"},We={x:0,y:0,z:0,dx:0,dy:0,dz:0,scrollX:0,scrollY:0,scaleX:1,scaleY:1,scaleZ:1,angle:0,alpha:0,beta:0,scaleCenter:[0,0],anchor:[0,0],anchor3d:[0,0],postMatrix:new He},c0={fillOpacity:1,fill:!1,shadowBlur:0,shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0},gu={strokeOpacity:1,lineDash:[],lineDashOffset:0,lineWidth:1,lineCap:"butt",lineJoin:"miter",miterLimit:10,strokeBoundsBuffer:2,stroke:!1},g0=Object.assign({outerBorder:Object.assign(Object.assign({},gu),{distance:0}),innerBorder:Object.assign(Object.assign({},gu),{distance:0})},gu),ki={text:"",maxLineWidth:1/0,textAlign:"left",textBaseline:"alphabetic",fontSize:16,fontFamily:`PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,
|
|
3
3
|
Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol`,fontWeight:"",ellipsis:"…",fontVariant:"",fontStyle:"",lineHeight:void 0,underline:0,lineThrough:0,scaleIn3d:!1,direction:"horizontal",wordBreak:"break-all",ignoreBuf:!1,verticalMode:0,wrap:!1,whiteSpace:"no-wrap",heightLimit:1/0,lineClamp:1/0,suffixPosition:"end",underlineDash:[],underlineOffset:0,disableAutoClipedPoptip:void 0},Vw={pickStrokeBuffer:0},jw=Object.assign(Object.assign(Object.assign(Object.assign({forceBoundsWidth:void 0,forceBoundsHeight:void 0,opacity:1,background:null,backgroundOpacity:1,backgroundCornerRadius:0,texture:null,textureColor:"black",textureSize:10,texturePadding:2,backgroundMode:"no-repeat",backgroundFit:!0,blur:0,cursor:null,html:null,react:null},c0),g0),Nw),Vw),f0={connectedType:"none",connectedStyle:{},connectedX:NaN,connectedY:NaN},_e=Object.assign(Object.assign(Object.assign({strokeSeg:null,renderable:!0,pickable:!0,shadowGraphic:void 0,childrenPickable:!0,fillPickable:!0,strokePickable:!0,visible:!0,zIndex:0,layout:null,boundsPadding:0,fillStrokeOrder:0,renderStyle:"default",pickMode:"accurate",customPickShape:null,boundsMode:"accurate",keepDirIn3d:!0,shadowRootIdx:1,globalZIndex:1,globalCompositeOperation:"",overflow:"hidden",shadowPickMode:"graphic"},{_debug_bounds:!1}),jw),We),Gw=Object.assign(Object.assign({},_e),{startAngle:0,endAngle:Gt,innerRadius:0,outerRadius:1,innerPadding:0,outerPadding:0,cornerRadius:0,padRadius:0,padAngle:0,cap:!1,forceShowCap:!1}),Uw=Object.assign(Object.assign(Object.assign({},_e),f0),{points:[],segments:[],curveType:"linear",clipRange:1,closePath:!1,curveTension:1}),Kw=Object.assign(Object.assign({},_e),{radius:1,startAngle:0,endAngle:Gt}),$w=Object.assign(Object.assign({},_e),{width:0,height:0,cornerRadius:0,path:[],clip:!1,visibleAll:!0,display:"relative",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",alignItems:"flex-start",alignContent:"flex-start",baseOpacity:1}),Yw=Object.assign(Object.assign({},_e),{path:"",width:0,height:0,cornerRadius:0,clip:!1}),Xw=Object.assign(Object.assign(Object.assign({},_e),f0),{points:[],segments:[],curveType:"linear",clipRange:1,clipRangeByDimension:"default",closePath:!1,curveTension:1}),qw=Object.assign(Object.assign({},_e),{path:new Ue,fillStrokeOrder:1,customPath:()=>{ne.getInstance().warn("空函数")}}),Zw=Object.assign(Object.assign({},_e),{points:[],cornerRadius:0,closePath:!0}),Jw=Object.assign(Object.assign({},_e),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},_e),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Qw=Object.assign(Object.assign({},_e),{symbolType:"circle",size:10,keepDirIn3d:!0}),p0=Object.assign(Object.assign(Object.assign({},_e),ki),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Tn=Object.assign(Object.assign(Object.assign({},_e),ki),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),ls=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},_e),{fill:!0,cornerRadius:0}),tS=Object.assign(Object.assign({},ls),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});class eS{}const X=new eS,fu={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"}},v0={fontSize:16,fontFamily:"sans-serif",fill:!0,stroke:!1,fontWeight:"normal",lineHeight:"normal",fontStyle:"normal",textDecoration:"none",textAlign:"left",script:"normal"},Nl=/\w|\(|\)|-/,m0=/[.?!,;:/,。?!、;:]/,iS=/\S/,b0=(n,t)=>{let e=t.fontSize||16;switch(t.script){case"super":case"sub":e*=.8}n.setTextStyle({textAlign:"left",textBaseline:t.textBaseline||"alphabetic",fontStyle:t.fontStyle||"",fontWeight:t.fontWeight||"",fontSize:e,fontFamily:t.fontFamily||"sans-serif"})};function nS(n,t){const e=t&&t.fill||v0.fill;if(!e)return void(n.globalAlpha=0);const{fillOpacity:i=1,opacity:o=1}=t;n.globalAlpha=i*o,n.fillStyle=e,b0(n,t)}function oS(n,t){const e=t&&t.stroke||v0.stroke;if(!e)return void(n.globalAlpha=0);const{strokeOpacity:i=1,opacity:o=1}=t;n.globalAlpha=i*o,n.lineWidth=t&&typeof t.lineWidth=="number"?t.lineWidth:1,n.strokeStyle=e,b0(n,t)}function pu(n,t,e,i,o){if(!t||t<=0)return 0;const r=X.graphicUtil.textMeasure;let s=i,l=n.slice(0,s),a=Math.floor(r.measureText(l,e).width),h=n.slice(0,s+1),d=Math.floor(r.measureText(h,e).width);for(;a>t||d<=t;){if(a>t?s--:s++,s>n.length){s=n.length;break}if(s<0){s=0;break}l=n.slice(0,s),a=Math.floor(r.measureText(l,e).width),h=n.slice(0,s+1),d=Math.floor(r.measureText(h,e).width)}return o&&(s=Vl(n,s)),s}function Vl(n,t,e=!1){let i=t;for(;Nl.test(n[i-1])&&Nl.test(n[i])||m0.test(n[i]);)if(i--,i<=0)return e?rS(n,t):t;return i}function rS(n,t){let e=t;for(;Nl.test(n[e-1])&&Nl.test(n[e])||m0.test(n[e]);)if(e++,e>=n.length)return e;return e}function lr(n,t){const e=X.graphicUtil.textMeasure.measureText(n,t),i={ascent:0,height:0,descent:0,width:0};return typeof e.actualBoundingBoxAscent!="number"||typeof e.actualBoundingBoxDescent!="number"?(i.width=Math.floor(e.width),i.height=t.fontSize||0,i.ascent=i.height,i.descent=0):(i.width=Math.floor(e.width),i.height=Math.floor(e.actualBoundingBoxAscent+e.actualBoundingBoxDescent),i.ascent=Math.floor(e.actualBoundingBoxAscent),i.descent=i.height-i.ascent),i}var sS=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s};let vu=class{configure(n,t){this.canvas=n.canvas,this.context=n.context,n.bindTextMeasure(this)}measureTextWidth(n,t){return this.context?(this.context.setTextStyleWithoutAlignBaseline(t),this.context.measureText(n).width):this.estimate(n,t).width}estimate(n,{fontSize:t=p0.fontSize}){let e=0,i=0;for(let o=0;o<n.length;o++)n.charCodeAt(o)<128?e++:i++;return{width:~~(.8*e*t+i*t),height:t}}measureTextPixelHeight(n,t){var e;if(!this.context)return(e=t.fontSize)!==null&&e!==void 0?e:ki.fontSize;this.context.setTextStyleWithoutAlignBaseline(t);const i=this.context.measureText(n);return Math.abs(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)}measureTextBoundHieght(n,t){var e;if(!this.context)return(e=t.fontSize)!==null&&e!==void 0?e:ki.fontSize;this.context.setTextStyleWithoutAlignBaseline(t);const i=this.context.measureText(n);return Math.abs(i.fontBoundingBoxAscent-i.fontBoundingBoxDescent)}measureText(n,t){return this.context?(this.context.setTextStyleWithoutAlignBaseline(t),this.context.measureText(n)):this.estimate(n,t)}clipTextVertical(n,t,e,i){if(n.length===0)return{verticalList:n,width:0};const{fontSize:o=12}=t;n.forEach(a=>{a.width=a.direction===0?o:this.measureTextWidth(a.text,t)});const r=[];let s=0,l=0;for(;l<n.length&&s+n[l].width<e;l++)s+=n[l].width,r.push(n[l]);if(n[l]&&n[l].text.length>1){const a=this._clipText(n[l].text,t,e-s,0,n[l].text.length-1,"end",!1);if(i&&a.str!==n[l].text){let h="",d=0;for(let g=0;g<l;g++){const f=n[g];h+=f.text,d+=f.text.length}h+=n[l].text;const u=d+a.str.length;let c=Vl(h,u);c-=d,c!==a.str.length-1&&(a.str=a.str.substring(0,c),a.width=this.measureTextWidth(a.str,t))}r.push(Object.assign(Object.assign({},n[l]),{text:a.str,width:a.width})),s+=a.width}return{verticalList:r,width:s}}clipText(n,t,e,i,o){if(n.length===0)return{str:"",width:0};let r=this.measureTextWidth(n,t);if(r<=e)return{str:n,width:r};if(r=this.measureTextWidth(n[0],t),r>e)return{str:"",width:0};const s=this._clipText(n,t,e,0,n.length-1,"end",!1);if(i&&s.str!==n){let l=Vl(n,s.str.length,o);l!==s.str.length&&(l>s.str.length&&(s.wordBreaked=l,l=s.str.length),s.str=n.substring(0,l),s.width=this.measureTextWidth(s.str,t))}return s}_clipText(n,t,e,i,o,r,s){let l;if(r==="start")l=this._clipTextStart(n,t,e,i,o),s&&(l.result=s+l.str);else if(r==="middle"){const a=this._clipTextMiddle(n,t,e,"","",0,0,1);l={str:"none",width:a.width,result:a.left+s+a.right}}else l=this._clipTextEnd(n,t,e,i,o),s&&(l.result=l.str+s);return l}_clipTextEnd(n,t,e,i,o){if(i===o){ne.getInstance().warn(`【_clipTextEnd】不应该走到这里${n}, ${i}, ${o}`);const h=n.substring(0,o+1);return{str:h,width:this.measureTextWidth(h,t)}}const r=Math.floor((i+o)/2),s=n.substring(0,r+1),l=this.measureTextWidth(s,t);let a;if(l>e){if(s.length<=1)return{str:"",width:0};const h=n.substring(0,r);return a=this.measureTextWidth(h,t),a<=e?{str:h,width:a}:this._clipTextEnd(n,t,e,i,r)}if(l<e){if(r>=n.length-1)return{str:n,width:this.measureTextWidth(n,t)};const h=n.substring(0,r+2);return a=this.measureTextWidth(h,t),a>=e?{str:s,width:l}:this._clipTextEnd(n,t,e,r,o)}return{str:s,width:l}}_clipTextStart(n,t,e,i,o){const r=Math.ceil((i+o)/2),s=n.substring(r-1,n.length),l=this.measureTextWidth(s,t);let a;if(l>e){if(s.length<=1)return{str:"",width:0};const h=n.substring(r,n.length);return a=this.measureTextWidth(h,t),a<=e?{str:h,width:a}:this._clipTextStart(n,t,e,r,n.length)}if(l<e){if(r<=0)return{str:n,width:this.measureTextWidth(n,t)};const h=n.substring(r-2,n.length);return a=this.measureTextWidth(h,t),a>=e?{str:s,width:l}:this._clipTextStart(n,t,e,i,r)}return{str:s,width:l}}_clipTextMiddle(n,t,e,i,o,r,s,l){const a=n.substring(0,l),h=this.measureTextWidth(a,t);if(h+s>e)return{left:i,right:o,width:r+s};const d=n.substring(n.length-l,n.length),u=this.measureTextWidth(d,t);return h+u>e?{left:a,right:o,width:h+s}:this._clipTextMiddle(n,t,e,a,d,h,u,l+1)}clipTextWithSuffixVertical(n,t,e,i,o,r){if(i==="")return this.clipTextVertical(n,t,e,o);if(n.length===0)return{verticalList:n,width:0};const s=this.clipTextVertical(n,t,e,o);if(s.verticalList.length===n.length&&s.verticalList[s.verticalList.length-1].width===n[n.length-1].width)return s;const l=this.measureTextWidth(i,t);if(l>e)return s;let a;if(e-=l,r==="start"){const h=this.revertVerticalList(n);a=this.clipTextVertical(h,t,e,o);const d=this.revertVerticalList(a.verticalList);d.unshift({text:i,direction:1,width:l}),a.verticalList=d}else if(r==="middle"){const h=this.clipTextVertical(n,t,e/2,o),d=this.revertVerticalList(n),u=this.clipTextVertical(d,t,e/2,o);h.verticalList.push({text:i,direction:1,width:l}),this.revertVerticalList(u.verticalList).forEach(c=>h.verticalList.push(c)),a={verticalList:h.verticalList,width:h.width+u.width}}else a=this.clipTextVertical(n,t,e,o),a.verticalList.push({text:i,direction:1,width:l});return a.width+=l,a}revertVerticalList(n){return n.reverse().map(t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})})}clipTextWithSuffix(n,t,e,i,o,r,s=!1){if(i==="")return this.clipText(n,t,e,o);if(n.length===0)return{str:"",width:0};const l=this.measureTextWidth(n,t);if(!s&&l<=e)return{str:n,width:l};const a=this.measureTextWidth(i,t);if(a>e)return{str:"",width:0};if(s&&l+a<=e)return{str:n+i,width:l+a};e-=a;const h=this._clipText(n,t,e,0,n.length-1,r,i);if(o&&h.str!==n){const d=Vl(n,h.str.length);d!==h.str.length&&(h.result=n.substring(0,d),h.width=this.measureTextWidth(h.str,t))}else s&&h.str===n&&(h.result=n+i);return h.str=h.result,h.width+=a,h}};vu=sS([st()],vu);var lS=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s};const Mn=Symbol.for("TextMeasureContribution");let ar=class extends vu{};ar=lS([st()],ar);const Tt=new _1,C0=Symbol.for("CanvasFactory"),aS=Symbol.for("Context2dFactory");function mu(n){return Tt.getNamed(C0,X.global.env)(n)}class hS{constructor(){this.pools=[],this.allocatedCanvas=[]}shareCanvas(){return this.allocatedCanvas.length?this.allocatedCanvas[0]:this.getCommonCanvas()}getCommonCanvas(){return this._commonCanvas||(this._commonCanvas=this.allocate({width:100,height:100,dpr:2})),this._commonCanvas}allocate(t){if(!this.pools.length){const i=mu(Object.assign({nativeCanvas:X.global.createCanvas(t)},t));return this.allocatedCanvas.push(i),i}const e=this.pools.pop();return e.resize(t.width,t.height),e.dpr=t.dpr,e}allocateByObj(t){if(!this.pools.length){const i={width:t.width/t.dpr,height:t.height/t.dpr,dpr:t.dpr},o=mu(Object.assign({nativeCanvas:X.global.createCanvas(i)},i));return this.allocatedCanvas.push(o),o}const e=this.pools.pop();return e.width=t.width,e.height=t.height,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const hr=new hS;var dS=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},uS=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};const as=Symbol.for("VWindow"),bu=Symbol.for("WindowHandlerContribution");let Cu=class{get width(){if(this._handler){const n=this._handler.getWH();return this._width=n.width}return this._width}get height(){if(this._handler){const n=this._handler.getWH();return this._height=n.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new gi(["x","y","width","height"])},this.active=()=>{const n=this.global;!n.env||this.actived||(Tt.getNamed(bu,n.env).configure(this,n),this.actived=!0)},this._uid=Te.GenAutoIncrementId(),this.global=X.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var n;return(n=this._handler.getStyle())!==null&&n!==void 0?n:{}}set style(n){this._handler.setStyle(n)}create(n){var t,e;this._handler.createWindow(n);const i=this._handler.getWH();this._width=i.width,this._height=i.height,n.viewBox?this.setViewBox(n.viewBox):n.canvasControled!==!1?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:(t=n.width)!==null&&t!==void 0?t:this._width,y2:(e=n.height)!==null&&e!==void 0?e:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(n){this._handler=n}setDpr(n){return this._handler.setDpr(n)}resize(n,t){return this._handler.resizeWindow(n,t)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(n){return this._handler.getImageBuffer?this._handler.getImageBuffer(n):null}addEventListener(n,t,e){return this._handler.addEventListener(n,t,e)}removeEventListener(n,t,e){return this._handler.removeEventListener(n,t,e)}dispatchEvent(n){return this._handler.dispatchEvent(n)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(n){this._handler.clearViewBox(n)}setViewBox(n){this._handler.setViewBox(n)}setViewBoxTransform(n,t,e,i,o,r){this._handler.setViewBoxTransform(n,t,e,i,o,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(n,t){const e=this._handler.getViewBox(),i={x:n,y:t};return this._handler.getViewBoxTransform().transformPoint({x:n,y:t},i),i.x-=e.x1,i.y-=e.y1,i}hasSubView(){const n=this._handler.getViewBox();return!(n.x1===0&&n.y1===0&&qi(this.width,n.width())&&qi(this.height,n.height()))}isVisible(n){return this._handler.isVisible(n)}onVisibleChange(n){return this._handler.onVisibleChange(n)}getTopLeft(n){return this._handler.getTopLeft(n)}};Cu=dS([st(),uS("design:paramtypes",[])],Cu);var _0=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},y0=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},w0=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let _u=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(n){this.contributions=n,this.configured=!1,this.global=X.global,this.global.hooks.onSetEnv.tap("graphic-util",(t,e,i)=>{this.configured=!1,this.configure(i,e)})}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(n,t){this.configured||(this.contributions.getContributions().forEach(e=>{e.configure(this,t)}),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const n=hr.shareCanvas();this._canvas=n,this._context=n.getContext("2d")}}bindTextMeasure(n){this._textMeasure=n}measureText(n,t,e="native"){var i;this.configure(this.global,this.global.env);const o=this.global.measureTextMethod;this.global.measureTextMethod=e;const r={width:this._textMeasure.measureTextWidth(n,t),height:(i=t.fontSize)!==null&&i!==void 0?i:ki.fontSize};return this.global.measureTextMethod=o,r}createTextMeasureInstance(n,t,e){return this.configure(this.global,this.global.env),new Oe(Object.assign({defaultFontParams:{fontFamily:ki.fontFamily,fontSize:ki.fontSize},getCanvasForMeasure:e||(()=>this.canvas),getTextBounds:void 0,specialCharSet:`-/: .,@%'"~`+Oe.ALPHABET_CHAR_SET+Oe.ALPHABET_CHAR_SET.toUpperCase()},t??{}),n)}drawGraphicToCanvas(n,t,e){if(!t.defaultLayer)return null;const i=Tt.get(as),o=n.AABBBounds,r=o.width(),s=o.height(),l=-o.x1,a=-o.y1;i.create({viewBox:{x1:l,y1:a,x2:o.x2,y2:o.y2},width:r,height:s,canvas:e,dpr:t.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=t.params.optimize.disableCheckGraphicWidthOutRange;t.params.optimize.disableCheckGraphicWidthOutRange=!0,t.defaultLayer.getNativeHandler().drawTo(i,[n],{transMatrix:i.getViewBoxTransform(),viewBox:i.getViewBox(),stage:t,layer:t.defaultLayer,renderService:t.renderService,background:"transparent",clear:!0,updateBounds:!1}),t.params.optimize.disableCheckGraphicWidthOutRange=h;const d=i.getNativeHandler();return d.nativeCanvas?d.nativeCanvas:null}};_u=_0([st(),w0(0,Ot(Me)),w0(0,Ie(Mn)),y0("design:paramtypes",[Object])],_u);var Zn;(function(n){n[n.transform=0]="transform",n[n.matrix=1]="matrix"})(Zn||(Zn={}));const Ee=new He;let yu=class{constructor(){this.matrix=new He}init(n){return this.mode=Zn.transform,this.originTransform=n,this.matrix.reset(),this}fromMatrix(n,t){return this.mode=Zn.matrix,this.outSourceMatrix=n,this.outTargetMatrix=t,this}scaleMatrix(n,t,e){const i=this.outSourceMatrix;if(Ee.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:o,y:r}=e;this.outTargetMatrix.translate(o,r),this.outTargetMatrix.scale(n,t),this.outTargetMatrix.translate(-o,-r)}else this.outTargetMatrix.scale(n,t);return this.outTargetMatrix.multiply(Ee.a,Ee.b,Ee.c,Ee.d,Ee.e,Ee.f),this}rotateMatrix(n,t){const e=this.outSourceMatrix;if(Ee.setValue(e.a,e.b,e.c,e.d,e.e,e.f),this.outTargetMatrix.reset(),t){const{x:i,y:o}=t;this.outTargetMatrix.translate(i,o),this.outTargetMatrix.rotate(n),this.outTargetMatrix.translate(-i,-o)}else this.outTargetMatrix.rotate(n);return this.outTargetMatrix.multiply(Ee.a,Ee.b,Ee.c,Ee.d,Ee.e,Ee.f),this}scale(n,t,e){return this.mode===Zn.matrix?this.scaleMatrix(n,t,e):this}rotate(n,t){return this.mode===Zn.matrix?this.rotateMatrix(n,t):this}translateMatrix(n,t){const e=this.outSourceMatrix;return Ee.setValue(e.a,e.b,e.c,e.d,e.e,e.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(n,t),this.outTargetMatrix.multiply(Ee.a,Ee.b,Ee.c,Ee.d,Ee.e,Ee.f),this}translate(n,t){return this.mode===Zn.matrix?this.translateMatrix(n,t):this}simplify(n){return this.mode===Zn.matrix?this.simplifyMatrix(n):this}simplifyMatrix(n){return this}};yu=_0([st(),y0("design:paramtypes",[])],yu);const ai={arc:Gw,area:Uw,circle:Kw,line:Xw,path:qw,symbol:Qw,text:p0,rect:Jw,polygon:Zw,richtext:Tn,richtextIcon:tS,image:ls,group:$w,glyph:Yw},wu=Object.keys(ai);function cS(){return{arc:Object.assign({},ai.arc),area:Object.assign({},ai.area),circle:Object.assign({},ai.circle),line:Object.assign({},ai.line),path:Object.assign({},ai.path),symbol:Object.assign({},ai.symbol),text:Object.assign({},ai.text),rect:Object.assign({},ai.rect),polygon:Object.assign({},ai.polygon),richtext:Object.assign({},ai.richtext),richtextIcon:Object.assign({},ai.richtextIcon),image:Object.assign({},ai.image),group:Object.assign({},ai.group),glyph:Object.assign({},ai.glyph)}}function jl(n,t){Object.keys(t).forEach(e=>{n[e]=t[e]})}const S0=cS();class hs{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wu.forEach(t=>{this._defaultTheme[t]=Object.create(S0[t])}),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e,i=!1){if(this.dirty){const o=this.getParentWithTheme(t);if(o){const r=o.theme;(r.dirty||i)&&r.applyTheme(o,e,!0)}this.userTheme?this.doCombine(o&&o.theme.combinedTheme):(o?this.combinedTheme=o.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,ne.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wu.forEach(o=>{const r=Object.create(S0[o]);t&&t[o]&&jl(r,t[o]),i[o]&&jl(r,i[o]),e[o]&&jl(r,e[o]),this.combinedTheme[o]=r}),e.common&&wu.forEach(o=>{jl(this.combinedTheme[o],e.common)}),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach(o=>{i[o]?Object.assign(i[o],t[o]):i[o]=Object.assign({},t[o])}):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren(e=>{e.isContainer&&(e.theme&&(e.theme.dirty=!0),this.dirtyChildren(e))})}}const x0=new hs;function Ht(n,t){return n.glyphHost?Ht(n.glyphHost):t?(n.isContainer,t):gS(n)||n.attachedThemeGraphic&&Ht(n.attachedThemeGraphic)||x0.getTheme()}function gS(n){let t;if(t=n.isContainer?n:n.parent,t){for(;t&&!t.theme;)t=t.parent;return t?(t.theme||t.createTheme(),t.theme.getTheme(t)):x0.getTheme()}return null}var fS=globalThis&&globalThis.__awaiter||function(n,t,e,i){return new(e||(e=Promise))(function(o,r){function s(h){try{a(i.next(h))}catch(d){r(d)}}function l(h){try{a(i.throw(h))}catch(d){r(d)}}function a(h){var d;h.done?o(h.value):(d=h.value,d instanceof e?d:new e(function(u){u(d)})).then(s,l)}a((i=i.apply(n,t||[])).next())})};class pS extends _o{get previousSibling(){return this._prev}get nextSibling(){return this._next}get children(){return this.getChildren()}get firstChild(){return this._firstChild}get lastChild(){return this._lastChild}get count(){return this._count}get childrenCount(){return this._idMap?this._idMap.size:0}constructor(){super(),this._uid=Te.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){let i=this._lastChild,o=0;for(;i;){if(t(i,o++))return;i=i._prev}}else{let i=this._firstChild,o=0;for(;i;){if(t(i,o++))return;i=i._next}}}forEachChildrenAsync(t,e=!1){return fS(this,void 0,void 0,function*(){if(e){let i=this._lastChild,o=0;for(;i;){let r=t(i,o++);if(r.then&&(r=yield r),r)return;i=i._prev}}else{let i=this._firstChild,o=0;for(;i;){let r=t(i,o++);if(r.then&&(r=yield r),r)return;i=i._next}}})}forEach(t){return this.forEachChildren(t)}appendChild(t,e=!0){if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&ne.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,e===0)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let o=0;o<e;o++){if(!i)return null;o>0&&(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 r=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,r)}let i;this._nodeList[e]=t;for(let r=e-1;r>=0&&(i=this._nodeList[r],!i);r--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const o=this.insertInto(t,0);return this._ignoreWarn=!1,o}removeChild(t){if(!this._idMap||!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex(i=>i===t);e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const i=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=i}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t,e=!1){let i=null;return this.forEachChildren((o,r)=>!(o===this||!t(o,r))&&(i=o,!0)),e&&this.forEachChildren(o=>{if(o.isContainer){const r=o.find(t,!0);if(r)return i=r,!0}return!1}),i}findAll(t,e=!1){let i=[];return this.forEachChildren((o,r)=>{o!==this&&t(o,r)&&i.push(o)}),e&&this.forEachChildren(o=>{if(o.isContainer){const r=o.findAll(t,!0);r.length&&(i=i.concat(r))}}),i}getElementById(t){return this.find(e=>e.id===t,!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll(e=>e.name===t,!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll(e=>e.type===t,!0)}getChildByName(t,e=!1){return this.find(i=>i.name===t,e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i<t;i++){if(!e._next)return null;e=e._next}return e}at(t){return this.getChildAt(t)}containNode(t){if(!this._idMap)return!1;if(this._idMap.has(t._uid))return!0;let e=this._firstChild;for(;e;){if(e.containNode(t))return!0;e=e._next}return!1}getRootNode(){let t=this.parent;for(;t!=null&&t.parent;)t=t.parent;return t||this}hasChildNodes(){return this._firstChild!==null}addChild(t){return this.appendChild(t)}add(t){return this.appendChild(t)}getChildren(){const t=[];let e=this._firstChild;for(;e;)t.push(e),e=e._next;return t}isChildOf(t){return!!this.parent&&this.parent._uid===t._uid}isParentOf(t){return t.isChildOf(this)}isDescendantsOf(t){let e=this.parent;if(!e)return!1;do{if(e._uid===t._uid)return!0;e=e.parent}while(e!==null);return!1}isAncestorsOf(t){return t.isDescendantsOf(this)}getAncestor(t){throw new Error("暂不支持")}setAllDescendantsProps(t,e){let i=this._firstChild;for(;i;)i[t]=e,i.setAllDescendantsProps(t,e),i=i._next}setCount(t){this._count+=t;let e=this.parent;if(e)do e._count+=t,e=e.parent;while(e!==null)}clone(){throw new Error("暂不支持")}cloneTo(t){throw new Error("暂不支持")}getParent(){return this.parent}del(t){return this.removeChild(t)}addEventListener(t,e,i){const o=ze(i,!0)&&i||$t(i)&&i.capture,r=$t(i)&&i.once,s=jt(e)?void 0:e;return t=o?`${t}capture`:t,e=jt(e)?e:e.handleEvent,r?super.once(t,e,s):super.on(t,e,s),this}on(t,e,i){return this.addEventListener(t,e,i)}removeEventListener(t,e,i){const o=ze(i,!0)&&i||$t(i)&&i.capture,r=jt(e)?void 0:e;t=o?`${t}capture`:t,e=jt(e)?e:e.handleEvent;const s=$t(i)&&i.once;return super.off(t,e,r,s),this}off(t,e,i){return this.removeEventListener(t,e,i)}once(t,e,i){return $t(i)?(i.once=!0,this.addEventListener(t,e,i)):this.addEventListener(t,e,{once:!0})}removeAllEventListeners(){return super.removeAllListeners(),this}removeAllListeners(){return this.removeAllEventListeners()}dispatchEvent(t,...e){return super.emit(t.type,t,...e),!t.defaultPrevented}emit(t,e){return this.dispatchEvent(t,e)}release(){this.removeAllListeners()}}class ds{get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get x(){return this.canvas.x}get y(){return this.canvas.y}get canvasX(){return this.canvas.x}get canvasY(){return this.canvas.y}get viewX(){return this.viewport.x}get viewY(){return this.viewport.y}constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=ds.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer={x:0,y:0},this.page={x:0,y:0},this.canvas={x:0,y:0},this.viewport={x:0,y:0},this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}composedPath(){return!this.manager||this.path&&this.path[this.path.length-1]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.composedDetailPath(),this.path}composedDetailPath(){return this.pickParams&&this.pickParams.graphic?(this.detailPath=this.path.slice(),this._composedDetailPath(this.pickParams)):this.detailPath=this.path.slice(),this.detailPath}_composedDetailPath(t){if(t&&t.graphic){const e=this.pickParams.graphic;if(e.stage){const i=e.stage.eventSystem.manager.propagationPath(e);this.detailPath.push(i),this._composedDetailPath(t.params)}}}preventDefault(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault()}catch{this.nativeEvent.preventDefault&&jt(this.nativeEvent.preventDefault)&&this.nativeEvent.preventDefault()}this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){try{this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.stopPropagation()}catch{this.nativeEvent.stopPropagation&&jt(this.nativeEvent.stopPropagation)&&this.nativeEvent.stopPropagation()}this.propagationStopped=!0}initEvent(){}initUIEvent(){}clone(){throw new Error("Method not implemented.")}}class Gl extends ds{constructor(){super(...arguments),this.client={x:0,y:0},this.movement={x:0,y:0},this.offset={x:0,y:0},this.global={x:0,y:0},this.screen={x:0,y:0}}get clientX(){return this.client.x}get clientY(){return this.client.y}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,o,r,s,l,a,h,d,u,c,g,f,p){throw new Error("Method not implemented.")}}class yi extends Gl{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}clone(){var t,e,i;const o=new yi(this.manager);o.eventPhase=o.NONE,o.currentTarget=null,o.path=[],o.detailPath=[],o.target=null,o.nativeEvent=this.nativeEvent,o.originalEvent=this.originalEvent,(t=this.manager)===null||t===void 0||t.copyPointerData(this,o),(e=this.manager)===null||e===void 0||e.copyMouseData(this,o),(i=this.manager)===null||i===void 0||i.copyData(this,o),o.target=this.target,o.path=this.composedPath().slice();const r=this.composedDetailPath();return o.detailPath=r&&r.slice(),o.type=this.type,o}}class Jn extends Gl{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}clone(){var t,e,i;const o=new Jn(this.manager);o.eventPhase=o.NONE,o.currentTarget=null,o.path=[],o.detailPath=[],o.target=null,o.nativeEvent=this.nativeEvent,o.originalEvent=this.originalEvent,(t=this.manager)===null||t===void 0||t.copyWheelData(this,o),(e=this.manager)===null||e===void 0||e.copyMouseData(this,o),(i=this.manager)===null||i===void 0||i.copyData(this,o),o.target=this.target,o.path=this.composedPath().slice();const r=this.composedDetailPath();return o.detailPath=r&&r.slice(),o.type=this.type,o}}Jn.DOM_DELTA_PIXEL=0,Jn.DOM_DELTA_LINE=1,Jn.DOM_DELTA_PAGE=2;class Su extends ds{constructor(t,e){super(),this.type=t,this.detail=e}}const A0="*",Ao=typeof performance=="object"&&performance.now?performance:Date;function Qn(n){return n==="mouse"||n==="pen"}let vS=class{constructor(t,e){this.dispatch=new _o,this.cursorTarget=null,this.pauseNotify=!1,this.mappingState={trackingData:{}},this.eventPool=new Map,this.onPointerDown=(i,o)=>{if(!(i instanceof yi))return void ne.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.createPointerEvent(i,i.type,o);if(this.dispatchEvent(r,"pointerdown"),r.pointerType==="touch")this.dispatchEvent(r,"touchstart");else if(Qn(r.pointerType)){const s=r.button===2;this.dispatchEvent(r,s?"rightdown":"mousedown")}this.trackingData(i.pointerId).pressTargetsByButton[i.button]=r.composedPath(),this.freeEvent(r)},this.onPointerMove=(i,o)=>{var r,s;if(!(i instanceof yi))return void ne.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const l=this.createPointerEvent(i,i.type,o),a=Qn(l.pointerType),h=this.trackingData(i.pointerId),d=this.findMountedTarget(h.overTargets);if(h.overTargets&&d&&d!==this.rootTarget&&d!==l.target){const u=i.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(i,u,d||void 0);if(this.dispatchEvent(c,"pointerout"),a&&this.dispatchEvent(c,"mouseout"),!l.composedPath().includes(d)){const g=this.createPointerEvent(i,"pointerleave",d||void 0);for(g.eventPhase=g.AT_TARGET;g.target&&!l.composedPath().includes(g.target);)g.currentTarget=g.target,this.notifyTarget(g),a&&this.notifyTarget(g,"mouseleave"),g.target=g.target.parent;this.freeEvent(g)}this.freeEvent(c)}if(d!==l.target){const u=i.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(l,u);this.dispatchEvent(c,"pointerover"),a&&this.dispatchEvent(c,"mouseover");let g=d==null?void 0:d.parent;for(;g&&g!==this.rootTarget.parent&&g!==l.target;)g=g.parent;if(!g||g===this.rootTarget.parent){const f=this.clonePointerEvent(l,"pointerenter");f.eventPhase=f.AT_TARGET;let p=f.target;const v=new Set;let m=d;for(;m&&m!==this.rootTarget;)v.add(m),m=m.parent;for(;p&&p!==d&&p!==this.rootTarget.parent;)v.has(p)||(f.currentTarget=p,this.notifyTarget(f),a&&this.notifyTarget(f,"mouseenter")),p=p.parent;this.freeEvent(f)}this.freeEvent(c)}this.dispatchEvent(l,"pointermove"),l.pointerType==="touch"&&this.dispatchEvent(l,"touchmove"),a&&(this.dispatchEvent(l,"mousemove"),this.cursorTarget=l.target,this.cursor=((s=(r=l.target)===null||r===void 0?void 0:r.attribute)===null||s===void 0?void 0:s.cursor)||this.rootTarget.getCursor()),h.overTargets=l.composedPath(),this.freeEvent(l)},this.onPointerOver=(i,o)=>{var r,s;if(!(i instanceof yi))return void ne.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const l=this.trackingData(i.pointerId),a=this.createPointerEvent(i,i.type,o),h=Qn(a.pointerType);this.dispatchEvent(a,"pointerover"),h&&this.dispatchEvent(a,"mouseover"),a.pointerType==="mouse"&&(this.cursorTarget=a.target,this.cursor=((s=(r=a.target)===null||r===void 0?void 0:r.attribute)===null||s===void 0?void 0:s.cursor)||this.rootTarget.getCursor());const d=this.clonePointerEvent(a,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),h&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;l.overTargets=a.composedPath(),this.freeEvent(a),this.freeEvent(d)},this.onPointerOut=(i,o)=>{if(!(i instanceof yi))return void ne.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(i.pointerId);if(r.overTargets){const s=Qn(i.pointerType),l=this.findMountedTarget(r.overTargets),a=this.createPointerEvent(i,"pointerout",l||void 0);this.dispatchEvent(a),s&&this.dispatchEvent(a,"mouseout");const h=this.createPointerEvent(i,"pointerleave",l||void 0);for(h.eventPhase=h.AT_TARGET;h.target&&h.target!==this.rootTarget.parent;)h.currentTarget=h.target,this.notifyTarget(h),s&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;r.overTargets=[],this.freeEvent(a),this.freeEvent(h)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(i,o)=>{var r;if(!(i instanceof yi))return void ne.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Ao.now(),l=this.createPointerEvent(i,i.type,o);if(this.dispatchEvent(l,"pointerup"),l.pointerType==="touch")this.dispatchEvent(l,"touchend");else if(Qn(l.pointerType)){const u=l.button===2;this.dispatchEvent(l,u?"rightup":"mouseup")}const a=this.trackingData(i.pointerId),h=this.findMountedTarget(a.pressTargetsByButton[i.button]);let d=h;if(h&&!l.composedPath().includes(h)){let u=h;for(;u&&!l.composedPath().includes(u);){if(l.currentTarget=u,this.notifyTarget(l,"pointerupoutside"),l.pointerType==="touch")this.notifyTarget(l,"touchendoutside");else if(Qn(l.pointerType)){const c=l.button===2;this.notifyTarget(l,c?"rightupoutside":"mouseupoutside")}u=u.parent}delete a.pressTargetsByButton[i.button],d=u}if(d){const u=this.clonePointerEvent(l,"click");u.target=d,u.path=[],u.detailPath=[],a.clicksByButton[i.button]||(a.clicksByButton[i.button]={clickCount:0,target:u.target,timeStamp:s});const c=a.clicksByButton[i.button];c.target===u.target&&s-c.timeStamp<((r=this._config.clickInterval)!==null&&r!==void 0?r:200)?++c.clickCount:c.clickCount=1,c.target=u.target,c.timeStamp=s,u.detail=c.clickCount,Qn(u.pointerType)?(this.dispatchEvent(u,"click"),c.clickCount===2&&this.dispatchEvent(u,"dblclick")):u.pointerType==="touch"&&this._config.supportsTouchEvents&&(this.dispatchEvent(u,"tap"),c.clickCount===2&&this.dispatchEvent(u,"dbltap")),this.dispatchEvent(u,"pointertap"),this.freeEvent(u)}this.freeEvent(l)},this.onPointerUpOutside=(i,o)=>{if(!(i instanceof yi))return void ne.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const r=this.trackingData(i.pointerId),s=this.findMountedTarget(r.pressTargetsByButton[i.button]),l=this.createPointerEvent(i,i.type,o);if(s){let a=s;for(;a;)l.currentTarget=a,this.notifyTarget(l,"pointerupoutside"),l.pointerType==="touch"?this.notifyTarget(l,"touchendoutside"):Qn(l.pointerType)&&this.notifyTarget(l,l.button===2?"rightupoutside":"mouseupoutside"),a=a.parent;delete r.pressTargetsByButton[i.button]}this.freeEvent(l)},this.onWheel=(i,o)=>{if(!(i instanceof Jn))return void ne.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const r=this.createWheelEvent(i,o);this.dispatchEvent(r),this.freeEvent(r)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((i,o)=>i.priority-o.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,o,r,s,l,a;if(!this.rootTarget)return;const h=this.mappingTable[t.type];let d;const u=`${t.canvasX}-${t.canvasY}`;if(!((e=this._prePointTargetCache)===null||e===void 0)&&e[u]&&(!((o=(i=this._prePointTargetCache)===null||i===void 0?void 0:i[u])===null||o===void 0)&&o.stage)&&((s=(r=this._prePointTargetCache)===null||r===void 0?void 0:r[u])===null||s===void 0?void 0:s.stage.renderCount)===((l=this._prePointTargetCache)===null||l===void 0?void 0:l.stageRenderCount)?d=this._prePointTargetCache[u]:(d=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[u]:d,stageRenderCount:(a=d==null?void 0:d.stage.renderCount)!==null&&a!==void 0?a:-1})),h)for(let c=0,g=h.length;c<g;c++)h[c].fn(t,d);else ne.getInstance().warn(`[EventManager]: Event mapping not defined for ${t.type}`)}propagate(t,e){if(!t.target)return;const i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let o=0,r=i.length-1;o<r;o++)if(t.currentTarget=i[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(let o=i.length-2;o>=0;o--)if(t.currentTarget=i[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=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<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){var o,r;const s=this.allocateEvent(yi);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=i||this.pickTarget((o=s.viewX)!==null&&o!==void 0?o:s.global.x,(r=s.viewY)!==null&&r!==void 0?r:s.global.y,s),typeof e=="string"&&(s.type=e),s}createWheelEvent(t,e){var i,o;const r=this.allocateEvent(Jn);return this.copyWheelData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=e||this.pickTarget((i=r.viewX)!==null&&i!==void 0?i:r.global.x,(o=r.viewY)!==null&&o!==void 0?o:r.global.y,r),r}clonePointerEvent(t,e){const i=this.allocateEvent(yi);i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice();const o=t.composedDetailPath();return i.detailPath=o&&o.slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof yi&&e instanceof yi&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Gl&&e instanceof Gl&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.shiftKey=t.shiftKey,e.metaKey=t.metaKey,["client","movement","canvas","screen","global","offset","viewport"].forEach(i=>{e[i].x=t[i].x,e[i].y=t[i].y}))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=Ao.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=((e=this.eventPool.get(t))===null||e===void 0?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),(e=this.eventPool.get(i))===null||e===void 0||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let o=0,r=i.length;o<r&&!t.propagationImmediatelyStopped;o++)i[o].once&&t.currentTarget.removeEventListener(e,i[o].fn,{once:!0}),i[o].fn.call(i[o].context,t);this.emitDelegation(t,e)}emitDelegation(t,e){const i=t.currentTarget._events[A0];if(i)if("fn"in i)i.fn.call(i.context,t,e);else for(let o=0,r=i.length;o<r&&!t.propagationImmediatelyStopped;o++)i[o].fn.call(i[o].context,t,e)}pickTarget(t,e,i){let o;const r=this.rootTarget.pick(t,e);return o=r&&r.graphic?r.graphic:r&&r.group?r.group:this.rootTarget.AABBBounds.contains(t,e)?this.rootTarget:null,i&&(i.pickParams=r.params),o}release(){this.dispatch.removeAllListeners(),this.eventPool.clear(),this.rootTarget=null,this.mappingTable=null,this.mappingState=null,this.cursorTarget=null}};const mS={dispatchEvent(n){var t;if(!(n instanceof ds))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return n.defaultPrevented=!1,n.path=[],n.detailPath&&(n.detailPath=[]),n.target=this,(t=n==null?void 0:n.manager)===null||t===void 0||t.dispatchEvent(n),!n.defaultPrevented},emit(n,t){return this.dispatchEvent(new Su(n,t))}},bS={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class CS{constructor(t){this.resolution=1,this.onPointerDown=d=>{if(this.supportsTouchEvents&&d.pointerType==="touch")return;const u=this.normalizeToPointerData(d);this.autoPreventDefault&&u[0].isNormalized&&(d.cancelable||!("cancelable"in d))&&d.preventDefault();for(let c=0,g=u.length;c<g;c++){const f=u[c],p=this.bootstrapEvent(this.rootPointerEvent,f);this.manager.mapEvent(p)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onPointerMove=d=>{if(this.supportsTouchEvents&&d.pointerType==="touch"||this.isEventOutsideOfTargetElement(d))return;const u=this.normalizeToPointerData(d);for(let c=0,g=u.length;c<g;c++){const f=this.bootstrapEvent(this.rootPointerEvent,u[c]);this.manager.mapEvent(f)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onPointerUp=d=>{if(this.supportsTouchEvents&&d.pointerType==="touch")return;const u=this.isEventOutsideOfTargetViewPort(d)?"outside":"",c=this.normalizeToPointerData(d);for(let g=0,f=c.length;g<f;g++){const p=this.bootstrapEvent(this.rootPointerEvent,c[g]);p.type+=u,this.manager.mapEvent(p)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onPointerOverOut=d=>{if(this.supportsTouchEvents&&d.pointerType==="touch")return;const u=this.normalizeToPointerData(d);for(let c=0,g=u.length;c<g;c++){const f=this.bootstrapEvent(this.rootPointerEvent,u[c]);this.manager.mapEvent(f)}this.setCursor(this.manager.cursor,this.manager.cursorTarget),this.rootPointerEvent.nativeEvent=null},this.onWheel=d=>{const u=this.normalizeWheelEvent(d);this.manager.mapEvent(u)};const{targetElement:e,resolution:i,rootNode:o,global:r,autoPreventDefault:s=!1,clickInterval:l,supportsTouchEvents:a=r.supportsTouchEvents,supportsPointerEvents:h=r.supportsPointerEvents}=t;this.manager=new vS(o,{clickInterval:l,supportsTouchEvents:a}),this.globalObj=r,this.supportsPointerEvents=h,this.supportsTouchEvents=a,this.supportsMouseEvents=r.supportsMouseEvents,this.applyStyles=r.applyStyles,this.autoPreventDefault=s,this.eventsAdded=!1,this.rootPointerEvent=new yi,this.rootWheelEvent=new Jn,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:o}=this;if(this.currentCursor===t)return;this.currentCursor=t;const r=this.cursorStyles[t];r?typeof r=="string"&&i?o.style.cursor=r:typeof r=="function"?r(t):typeof r=="object"&&i&&Object.assign(o.style,r):i&&Qt(t)&&!Ef(this.cursorStyles,t)&&(o.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const o=(e=this.globalObj)===null||e===void 0?void 0:e.mapToCanvasPoint(t,this.domElement);if(o)return o;let r=0,s=0;if(t.changedTouches){const a=(i=t.changedTouches[0])!==null&&i!==void 0?i:{};r=a.clientX||0,s=a.clientY||0}else r=t.clientX||0,s=t.clientY||0;const l=this.domElement.getBoundingClientRect();return{x:r-l.left,y:s-l.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,o=t.changedTouches.length;i<o;i++){const r=t.changedTouches[i];be(r.button)&&(r.button=0),be(r.buttons)&&(r.buttons=1),be(r.isPrimary)&&(r.isPrimary=t.touches.length===1&&t.type==="touchstart"),be(r.width)&&(r.width=r.radiusX||1),be(r.height)&&(r.height=r.radiusY||1),be(r.tiltX)&&(r.tiltX=0),be(r.tiltY)&&(r.tiltY=0),be(r.pointerType)&&(r.pointerType="touch"),be(r.pointerId)&&(r.pointerId=r.identifier||0),be(r.pressure)&&(r.pressure=r.force||.5),be(r.twist)&&(r.twist=0),be(r.tangentialPressure)&&(r.tangentialPressure=0),be(r.layerX)&&(r.layerX=r.offsetX=r.clientX),be(r.layerY)&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=t.type,e.push(r)}else if(this.globalObj.supportsMouseEvents&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof PointerEvent))e.push(t);else{const i=t;be(i.isPrimary)&&(i.isPrimary=!0),be(i.width)&&(i.width=1),be(i.height)&&(i.height=1),be(i.tiltX)&&(i.tiltX=0),be(i.tiltY)&&(i.tiltY=0),be(i.pointerType)&&(i.pointerType="mouse"),be(i.pointerId)&&(i.pointerId=1),be(i.pressure)&&(i.pressure=.5),be(i.twist)&&(i.twist=0),be(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}return e}normalizeWheelEvent(t){const e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;const{x:i,y:o}=this.mapToCanvasPoint(t);e.canvas.x=i,e.canvas.y=o,e.global.x=i,e.global.y=o,e.offset.x=i,e.offset.y=o;const{x:r,y:s}=this.mapToViewportPoint(e);return e.viewport.x=r,e.viewport.y=s,e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:i,y:o}=this.mapToCanvasPoint(e);t.canvas.x=i,t.canvas.y=o,t.global.x=i,t.global.y=o,t.offset.x=i,t.offset.y=o;const{x:r,y:s}=this.mapToViewportPoint(t);return t.viewport.x=r,t.viewport.y=s,t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=bS[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=Ao.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.shiftKey=e.shiftKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null}isEventOutsideOfTargetViewPort(t){if(this.isEventOutsideOfTargetElement(t))return!0;if(this.domElement.getViewBox){const e=this.mapToViewportPoint(this.mapToCanvasPoint(t)),i=this.domElement.getViewBox(),o=i.width(),r=i.height();return!(e.x<o&&e.y<r&&e.x>0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var Ii;(function(n){n[n.INITIAL=0]="INITIAL",n[n.RUNNING=1]="RUNNING",n[n.PAUSE=2]="PAUSE"})(Ii||(Ii={}));class us{static Avaliable(){return!!X.global.getRequestAnimationFrame()}avaliable(){return us.Avaliable()}tick(t,e){X.global.getRequestAnimationFrame()(()=>{this.released||e(this)})}release(){this.released=!0}getTime(){return Date.now()}}class Ul{static Avaliable(){return!0}avaliable(){return Ul.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 R0{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(t=[]){this.handleTick=(e,i)=>{const{once:o=!1}=i??{};this.ifCanStop()?this.stop():(this._handlerTick(e),o||e.tick(this.interval,this.handleTick))},this._handlerTick=e=>{const i=this.tickerHandler.getTime();let o=0;this.lastFrameTime>=0&&(o=i-this.lastFrameTime),this.lastFrameTime=i,this.status===Ii.RUNNING&&(this.tickCounts++,this.timelines.forEach(r=>{r.tick(o)}))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=Ii.INITIAL,X.global.hooks.onSetEnv.tap("default-ticker",()=>{this.initHandler()}),X.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:us},{mode:"timeout",cons:Ul}];for(let e=0;e<t.length;e++)if(t[e].cons.Avaliable()){this.mode=t[e].mode;break}return null}setupTickHandler(){let t;switch(this._mode){case"raf":t=new us;break;case"timeout":t=new Ul;break;default:ne.getInstance().warn("非法的计时器模式"),t=new us}return!!t.avaliable()&&(this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0)}setInterval(t){this.interval=t}getInterval(){return this.interval}setFPS(t){this.setInterval(1e3/t)}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,e=>{this.handleTick(e,{once:!0})})}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,e=>{this.handleTick(e,{once:!0})})}pause(){return this.status!==Ii.INITIAL&&(this.status=Ii.PAUSE,!0)}resume(){return this.status!==Ii.INITIAL&&(this.status=Ii.RUNNING,!0)}ifCanStop(){return!!(this.autoStop&&(!this.timelines.length||this.timelines.reduce((t,e)=>t+e.animateCount,0)===0))}start(t=!1){return this.status===Ii.RUNNING||!this.tickerHandler||!t&&(this.status===Ii.PAUSE||!this.timelines.length||this.timelines.reduce((e,i)=>e+i.animateCount,0)===0)?!1:(this.status=Ii.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0)}stop(){this.status=Ii.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}}class Dt{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 t===0?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 t===0?0:Math.pow(2,10*t-10)}static expoOut(t){return t===1?1:1-Math.pow(2,-10*t)}static expoInOut(t){return t===0?0:t===1?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-Dt.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Dt.bounceIn(2*t):.5*Dt.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(i===0||i===1)return i;const o=e/Gt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-o)*Gt/e)}}static getElasticOut(t,e){return function(i){if(i===0||i===1)return i;const o=e/Gt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-o)*Gt/e)+1}}static getElasticInOut(t,e){return function(i){const o=e/Gt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-o)*Gt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-o)*Gt/e)*.5+1}}}Dt.quadIn=Dt.getPowIn(2),Dt.quadOut=Dt.getPowOut(2),Dt.quadInOut=Dt.getPowInOut(2),Dt.cubicIn=Dt.getPowIn(3),Dt.cubicOut=Dt.getPowOut(3),Dt.cubicInOut=Dt.getPowInOut(3),Dt.quartIn=Dt.getPowIn(4),Dt.quartOut=Dt.getPowOut(4),Dt.quartInOut=Dt.getPowInOut(4),Dt.quintIn=Dt.getPowIn(5),Dt.quintOut=Dt.getPowOut(5),Dt.quintInOut=Dt.getPowInOut(5),Dt.backIn=Dt.getBackIn(1.7),Dt.backOut=Dt.getBackOut(1.7),Dt.backInOut=Dt.getBackInOut(1.7),Dt.elasticIn=Dt.getElasticIn(1,.3),Dt.elasticOut=Dt.getElasticOut(1,.3),Dt.elasticInOut=Dt.getElasticInOut(1,.3*1.5);class xu{constructor(){this.id=Te.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===ni.END?this.removeAnimate(e):e.status===ni.RUNNING||e.status===ni.INITIAL?(this.animateCount++,e.advance(t)):e.status===ni.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,e=!0){t._onRemove&&t._onRemove.forEach(i=>i()),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const T0=new xu;class M0{constructor(t,e,i,o,r){this.from=t,this.to=e,this.duration=i,this.easing=o,this.params=r,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}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({},(t=this.step.prev.getLastProps())!==null&&t!==void 0?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(this.updateCount===0){this.onFirstRun();const o=this.step.getLastProps();Object.keys(o).forEach(r=>{this.subAnimate.animate.validAttr(r)&&(i[r]=o[r])})}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class _S extends M0{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class Bn{constructor(t=Te.GenAutoIncrementId(),e=T0,i){this.id=t,this.timeline=e,this.status=ni.INITIAL,this.tailAnimate=new B0(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce((t,e)=>t+e.totalDuration,0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach(i=>{e=Xn(i.getDuration(),e)}),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){Bn.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this.subAnimates.length===1&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t,e=Bn.mode){t&&e&Ol.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:fi.ANIMATE_PLAY})}runCb(t){const e=new _S(()=>{t(this,e.step.prev)});return this.tailAnimate.play(e),this}customInterpolate(t,e,i,o,r,s){const l=Bn.interpolateMap.get(t)||Bn.interpolateMap.get("");return!!l&&l(t,e,i,o,r,s)}pause(){this.status===ni.RUNNING&&(this.status=ni.PAUSED)}resume(){this.status===ni.PAUSED&&(this.status=ni.RUNNING)}to(t,e,i,o){if(this.tailAnimate.to(t,e,i,o),this.target){const r=this.target.stage;r&&r.renderNextFrame()}return this}from(t,e,i,o){if(this.tailAnimate.from(t,e,i,o),this.target){const r=this.target.stage;r&&r.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const e=this.target.stage;e&&e.renderNextFrame()}return this}subAnimate(){const t=new B0(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(e=>this.preventAttr(e))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach(e=>{e.bind(t)}),this}advance(t){if(this._duringTime<this._startTime){if(this._duringTime+t*this.timeScale<this._startTime)return void(this._duringTime+=t*this.timeScale);t=this._duringTime+t*this.timeScale-this._startTime,this._duringTime=this._startTime}this.status===ni.INITIAL&&(this.status=ni.RUNNING,this._onStart&&this._onStart.forEach(e=>e())),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===ni.RUNNING&&(this.status=ni.END,this._onEnd&&this._onEnd.forEach(e=>e()))}setPosition(t){let e,i=0;const o=this.rawPosition,r=this.subAnimates.reduce((l,a)=>l+a.totalDuration,0);t<0&&(t=0);const s=t>=r;if(s&&(t=r),t===o)return s;for(let l=0;l<this.subAnimates.length&&(e=this.subAnimates[l],!(i+e.totalDuration>=t));l++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),s}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=ni.END}stop(t){t||this.target.onStop(),t==="start"?this.target.onStop(this.getStartProps()):t==="end"?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}Bn.mode=Ol.NORMAL,Bn.interpolateMap=new Map;class B0{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 P0(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;(e==null||e<0)&&(e=0);const i=t.easing,o=typeof i=="string"?Dt[i]:i,r=this._addStep(e,null,o);return r.type=rr.customAnimate,this._appendProps(t.getEndProps(),r,!1),this._appendCustomAnimate(t,r),this}to(t,e,i,o){(e==null||e<0)&&(e=0);const r=typeof i=="string"?Dt[i]:i,s=this._addStep(e,null,r);return s.type=rr.to,this._appendProps(t,s,!!o&&o.tempProps),s.propKeys||(s.propKeys=Object.keys(s.props)),o&&o.noPreventAttrs||this.target.animates.forEach(l=>{l.id!==this.animate.id&&l.preventAttrs(s.propKeys)}),this}from(t,e,i,o){this.to(t,0,i,o);const r={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach(s=>{r[s]=this.getLastPropByName(s,this.stepTail)}),this.to(r,e,i,o),this.stepTail.type=rr.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return(t=this.stepHead)===null||t===void 0?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=rr.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 o=new P0(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(o),this.stepTail=o,o}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let o=e.prev;const r=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach(l=>{e.props[l]===void 0&&(e.props[l]=this.target.getDefaultAttribute(l))});o.prev;)o.props&&(o.propKeys||(o.propKeys=Object.keys(o.props)),o.propKeys.forEach(l=>{r[l]===void 0&&(r[l]=o.props[l])})),e.propKeys=Object.keys(e.props),o=o.prev;const s=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(r)),e.propKeys.forEach(l=>{if(s[l]===void 0){const a=this.animate.getStartProps();s[l]=a[l]=this.target.getComputedAttribute(l)}}),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,o=this.loop,r=this.rawPosition;let s,l,a=!1;const h=(e=this._startAt)!==null&&e!==void 0?e:0;if(t<0&&(t=0),t<h)return this.rawPosition=t,!1;if(t-=h,i<=0&&(a=!0,i<0)||(s=Math.floor(t/i),l=t-s*i,a=t>=o*i+i,a&&(l=i,s=o,t=l*s+i),t===r))return a;const d=!this.reversed!=!(this.bounce&&s%2);return d&&(l=i-l),this._deltaPosition=l-this.position,this.position=l,this.rawPosition=t+h,this.updatePosition(a,d),a}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const o=this.position,r=this.duration;if(this.target&&i){let s=i.next;for(;s&&s.position<=o;)i=s,s=i.next;let l=t?r===0?1:o/r:(o-i.position)/i.duration;i.easing&&(l=i.easing(l)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,l,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach(a=>a(i,l))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let o=e.prev;for(;o&&o!==t;)o.customAnimate&&(o.customAnimate.onStart&&o.customAnimate.onStart(),o.customAnimate.onEnd&&o.customAnimate.onEnd()),o=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let o=e.next;for(;o&&o!==t;)o.customAnimate&&(o.customAnimate.onStart&&o.customAnimate.onStart(),o.customAnimate.onEnd&&o.customAnimate.onEnd()),o=o.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&&i.props[t]!==void 0)return i.props[t];if(i.customAnimate){const o=i.customAnimate.getEndProps()[t];if(o!==void 0)return o}i=i.prev}return ne.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){t.props==null&&t.customAnimate==null||this.target.onStep(this,this.animate,t,e,i)}}class P0{constructor(t,e,i,o){this.duration=e,this.position=t,this.props=i,this.easing=o}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 H0={duration:200,easing:"cubicOut"};var E0;(function(n){n[n.Top=1]="Top",n[n.Right=2]="Right",n[n.Bottom=4]="Bottom",n[n.Left=8]="Left",n[n.ALL=15]="ALL"})(E0||(E0={}));const Pn=[!1,!1,!1,!1],yS=n=>{var t;let e=!0;if(ze(n,!0)){for(let i=0;i<4;i++)Pn[i]=n,e&&(e=!((t=Pn[i])!==null&&t!==void 0&&!t));e=n}else if(Array.isArray(n))for(let i=0;i<4;i++)Pn[i]=!!n[i],e&&(e=!!Pn[i]);else Pn[0]=!1,Pn[1]=!1,Pn[2]=!1,Pn[3]=!1;return{isFullStroke:e,stroke:Pn}},cs=[0,0,0,0],gs=n=>n?it(n)?n.length===0?0:n.length===1?n[0]:n.length===2?(cs[0]=n[0],cs[2]=n[0],cs[1]=n[1],cs[3]=n[1],cs):n:n:0,dr=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Kl=[1,2,3,0,1,2,3,0];function Au(n,t,e,i){for(;n>=Gt;)n-=Gt;for(;n<0;)n+=Gt;for(;n>t;)t+=Gt;dr[0].x=e,dr[1].y=e,dr[2].x=-e,dr[3].y=-e;const o=Math.ceil(n/Ei)%4,r=Math.ceil(t/Ei)%4;if(i.add(Pe(n)*e,pe(n)*e),i.add(Pe(t)*e,pe(t)*e),o!==r||t-n>oe){let s=!1;for(let l=0;l<Kl.length;l++)if(s||o!==Kl[l]){if(s&&r===Kl[l])break;if(s){const a=dr[Kl[l]];i.add(a.x,a.y)}}else{s=!0;const a=dr[o];i.add(a.x,a.y)}}}function L0(n,t,e){const{x:i,y:o}=Vf(n.x,n.y,t.x,t.y,e),{x:r,y:s}=Vf(n.x1,n.y1,t.x1,t.y1,e),l=new ye(i,o,r,s);return l.defined=t.defined,l}function F0(n,t,e){if(!n||!t)return[];Array.isArray(n)||(n=[n]),Array.isArray(t)||(t=[t]);let i=[];if(n.length>t.length){i=t.map(o=>{const r=new ye(o.x,o.y,o.x1,o.y1);return r.defined=o.defined,r});for(let o=0;o<t.length;o++)i[o]=L0(n[o],t[o],e)}else{i=t.map(o=>{const r=new ye(o.x,o.y,o.x1,o.y1);return r.defined=o.defined,r});for(let o=0;o<n.length;o++)i[o]=L0(n[o],t[o],e)}return i}function $l(n,t){if(it(n)){let e;for(let i=0;i<n.length&&e===void 0;i++)e=n[i][t];return e}return n[t]}class Yl{constructor(t=Yl.TimeOut){this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout(()=>{this.appendDuration(Date.now()-this.lastDate),t(0)},this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce((e,i)=>e+i,0)/this.durations.length,1e3/60),1e3/30)}}Yl.TimeOut=1e3/60;const k0=new Yl,Hn=(n,t)=>Qt(n)&&n[n.length-1]==="%"?t*(Number.parseFloat(n.substring(0,n.length-1))/100):n,wS=n=>{if(!n)return{x:0,y:0,width:0,height:0};let t=ct(n.width)?n.x1-n.x:n.width,e=ct(n.height)?n.y1-n.y:n.height,i=0,o=0;return t<0?(i=t,t=-t):Number.isNaN(t)&&(t=0),e<0?(o=e,e=-e):Number.isNaN(e)&&(e=0),{x:i,y:o,width:t,height:e}};var En;(function(n){n[n.Color255=0]="Color255",n[n.Color1=1]="Color1"})(En||(En={}));class Ne{static Get(t,e=En.Color1,i=[0,0,0,1]){if(e===En.Color1){const s=Ne.store1[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const l=_i.parseColorString(t);if(l){const a=[l.r/255,l.g/255,l.b/255,l.opacity];Ne.store1[t]=a,Ne.store255[t]=[l.r,l.g,l.b,l.opacity],i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3]}return i}const o=Ne.store255[t];if(o)return i[0]=o[0],i[1]=o[1],i[2]=o[2],i[3]=o[3],i;const r=_i.parseColorString(t);return r&&(Ne.store1[t]=[r.r/255,r.g/255,r.b/255,r.opacity],Ne.store255[t]=[r.r,r.g,r.b,r.opacity],i[0]=r.r,i[1]=r.g,i[2]=r.b,i[3]=r.opacity),i}static Set(t,e,i){if(e===En.Color1){if(Ne.store1[t])return;Ne.store1[t]=i,Ne.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Ne.store255[t])return;Ne.store255[t]=i,Ne.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}Ne.store255={},Ne.store1={};function Xl(n,t=!1){return Array.isArray(n)&&nt(n[0])?t?`rgb(${Math.round(n[0])},${Math.round(n[1])},${Math.round(n[2])},${n[3].toFixed(2)})`:`rgb(${Math.round(n[0])},${Math.round(n[1])},${Math.round(n[2])})`:n}function ur(n,t,e,i,o){return Array.isArray(n)&&!nt(n[0])||Array.isArray(t)&&!nt(t[0])?new Array(4).fill(0).map((r,s)=>I0(it(n)?n[s]:n,it(t)?t[s]:t,e,i)):I0(n,t,e,i,o)}function I0(n,t,e,i,o){if(!n||!t)return n&&Xl(n)||t&&Xl(t)||!1;let r,s,l=!1,a=!1;if(Array.isArray(n)?r=n:typeof n=="string"?r=Ne.Get(n,En.Color255):l=!0,Array.isArray(t)?s=t:typeof t=="string"?s=Ne.Get(t,En.Color255):a=!0,l!==a){const h=l?n:t,d=l?t:n,u=Object.assign(Object.assign({},h),{stops:h.stops.map(c=>Object.assign(Object.assign({},c),{color:Xl(d)}))});return l?ur(h,u,e,i,o):ur(u,h,e,i,o)}if(l){if(n.gradient===t.gradient){const h=n,d=t,u=h.stops,c=d.stops;if(u.length!==c.length)return!1;if(h.gradient==="linear")return SS(h,d,e);if(h.gradient==="radial")return xS(h,d,e);if(h.gradient==="conical")return AS(h,d,e)}return!1}return o&&o(r,s),Xl(RS(r,s,e),i)}function SS(n,t,e){const i=n.stops,o=t.stops;return{gradient:"linear",x0:n.x0+(t.x0-n.x0)*e,x1:n.x1+(t.x1-n.x1)*e,y0:n.y0+(t.y0-n.y0)*e,y1:n.y1+(t.y1-n.y1)*e,stops:new Array(i.length).fill(0).map((r,s)=>({color:Ru(i[s].color,o[s].color,e),offset:i[s].offset+(o[s].offset-i[s].offset)*e}))}}function xS(n,t,e){const i=n.stops,o=t.stops;return{gradient:"radial",x0:n.x0+(t.x0-n.x0)*e,x1:n.x1+(t.x1-n.x1)*e,y0:n.y0+(t.y0-n.y0)*e,y1:n.y1+(t.y1-n.y1)*e,r0:n.r0+(t.r0-n.r0)*e,r1:n.r1+(t.r1-n.r1)*e,stops:new Array(i.length).fill(0).map((r,s)=>({color:Ru(i[s].color,o[s].color,e),offset:i[s].offset+(o[s].offset-i[s].offset)*e}))}}function AS(n,t,e){const i=n.stops,o=t.stops;return{gradient:"conical",startAngle:n.startAngle+(t.startAngle-n.startAngle)*e,endAngle:n.endAngle+(t.endAngle-n.endAngle)*e,x:n.x+(t.x-n.x)*e,y:n.y+(t.y-n.y)*e,stops:new Array(i.length).fill(0).map((r,s)=>({color:Ru(i[s].color,o[s].color,e),offset:i[s].offset+(o[s].offset-i[s].offset)*e}))}}function RS(n,t,e){return[n[0]+(t[0]-n[0])*e,n[1]+(t[1]-n[1])*e,n[2]+(t[2]-n[2])*e,n[3]+(t[3]-n[3])*e]}const Ln=[0,0,0,0],fs=[0,0,0,0];function Ru(n,t,e){return Ne.Get(n,En.Color255,Ln),Ne.Get(t,En.Color255,fs),`rgba(${Math.round(Ln[0]+(fs[0]-Ln[0])*e)},${Math.round(Ln[1]+(fs[1]-Ln[1])*e)},${Math.round(Ln[2]+(fs[2]-Ln[2])*e)},${Ln[3]+(fs[3]-Ln[3])*e})`}class ee{static GetImage(t,e){var i;const o=ee.cache.get(t);o?o.loadState==="fail"?X.global.getRequestAnimationFrame()(()=>{e.imageLoadFail(t)}):o.loadState==="init"||o.loadState==="loading"?(i=o.waitingMark)===null||i===void 0||i.push(e):e&&e.imageLoadSuccess(t,o.data):ee.loadImage(t,e)}static GetSvg(t,e){var i;let o=ee.cache.get(t);o?o.loadState==="fail"?X.global.getRequestAnimationFrame()(()=>{e.imageLoadFail(t)}):o.loadState==="init"||o.loadState==="loading"?(i=o.waitingMark)===null||i===void 0||i.push(e):e&&e.imageLoadSuccess(t,o.data):(o={type:"image",loadState:"init"},ee.cache.set(t,o),o.dataPromise=X.global.loadSvg(t),o.dataPromise?(o.waitingMark=[e],o.dataPromise.then(r=>{var s;o.loadState=r!=null&&r.data?"success":"fail",o.data=r==null?void 0:r.data,(s=o.waitingMark)===null||s===void 0||s.map((l,a)=>{r!=null&&r.data?(o.loadState="success",o.data=r.data,l.imageLoadSuccess(t,r.data)):(o.loadState="fail",l.imageLoadFail(t))}),o.waitingMark&&(o.waitingMark=[])})):(o.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=ee.cache.get(t);return i?i.loadState==="fail"?Promise.reject():i.loadState==="init"||i.loadState==="loading"?i.dataPromise.then(o=>o.data):Promise.resolve(i.data):(i={type:e,loadState:"init"},ee.cache.set(t,i),e==="arrayBuffer"?i.dataPromise=X.global.loadArrayBuffer(t):e==="blob"?i.dataPromise=X.global.loadBlob(t):e==="json"&&(i.dataPromise=X.global.loadJson(t)),i.dataPromise.then(o=>o.data))}static loading(){setTimeout(()=>{if(!ee.isLoading&&ee.toLoadAueue.length){ee.isLoading=!0;const t=ee.toLoadAueue.splice(0,10),e=[];t.forEach(i=>{const{url:o,marks:r}=i,s={type:"image",loadState:"init"};if(ee.cache.set(o,s),s.dataPromise=X.global.loadImage(o),s.dataPromise){s.waitingMark=r;const l=s.dataPromise.then(a=>{var h;s.loadState=a!=null&&a.data?"success":"fail",s.data=a==null?void 0:a.data,(h=s.waitingMark)===null||h===void 0||h.map((d,u)=>{a!=null&&a.data?(s.loadState="success",s.data=a.data,d.imageLoadSuccess(o,a.data)):(s.loadState="fail",d.imageLoadFail(o))}),s.waitingMark&&(s.waitingMark=[])});e.push(l)}else s.loadState="fail",r.forEach(l=>l.imageLoadFail(o))}),Promise.all(e).then(()=>{ee.isLoading=!1,this.onLoadSuccessCb.forEach(i=>i()),ee.loading()}).catch(i=>{console.error(i),ee.isLoading=!1,this.onLoadSuccessCb.forEach(o=>o()),ee.loading()})}},0)}static loadImage(t,e){const i=z0(t,ee.toLoadAueue);if(i!==-1)return ee.toLoadAueue[i].marks.push(e),void ee.loading();ee.toLoadAueue.push({url:t,marks:[e]}),ee.loading()}static improveImageLoading(t){const e=z0(t,ee.toLoadAueue);if(e!==-1){const i=ee.toLoadAueue.splice(e,1);ee.toLoadAueue.unshift(i[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function z0(n,t){for(let e=0;e<t.length;e++)if(t[e].url===n)return e;return-1}ee.cache=new Map,ee.isLoading=!1,ee.toLoadAueue=[],ee.onLoadSuccessCb=[];const TS=new He,D0=new he,zi=["lineWidth","scaleX","scaleY","angle","anchor","visible"],O0=["x","y"],W0=["scaleX","scaleY"],N0=["angle"],ps=new ye,Ji={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class pi extends pS{static mixin(t){const e=Object.keys(t);for(let i=0;i<e.length;++i){const o=e[i];Object.defineProperty(pi.prototype,o,Object.getOwnPropertyDescriptor(t,o))}}get AABBBounds(){return this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise")}get OBBBounds(){return this.tryUpdateOBBBounds()}get globalAABBBounds(){return this.tryUpdateGlobalAABBBounds()}get transMatrix(){return this.tryUpdateLocalTransMatrix(!0)}get globalTransMatrix(){return this.tryUpdateGlobalTransMatrix(!0)}constructor(t={}){var e;super(),this._AABBBounds=new he,this._updateTag=te.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage((e=t.background.background)!==null&&e!==void 0?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){t==="3d"?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t,e=!1){var i,o;const{dx:r=t.dx,dy:s=t.dy}=this.attribute;if(e&&this.parent){const l=this.parent.attribute;ps.x=r+((i=l.scrollX)!==null&&i!==void 0?i:0),ps.y=s+((o=l.scrollY)!==null&&o!==void 0?o:0)}else ps.x=r,ps.y=s;return ps}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;X.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return X.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new tw),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,o=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:r=e.boundsPadding}=i,s=gs(r);return s&&o.expand(s),this.clearUpdateBoundTag(),o}updatePathProxyAABBBounds(t){const e=typeof this.pathProxy=="function"?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new ou(t);return qn(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(t=!0){if(this._globalTransMatrix){if(this.parent){const e=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(t=!0){return this._transMatrix||(this._transMatrix=new He),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&te.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&X.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&te.UPDATE_BOUNDS)&&X.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&te.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&te.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&te.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite(((t=i.x)!==null&&t!==void 0?t:0)+((e=i.y)!==null&&e!==void 0?e:0))}_validNumber(t){return t==null||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&te.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=te.CLEAR_SHAPE}containsPoint(t,e,i,o){if(!o)return!1;if(i===rs.GLOBAL){const r=new ye(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(r,r),t=r.x,e=r.y}return o.containsPoint(this,{x:t,y:e})}setAttributes(t,e=!1,i){(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t,e=!1,i){const o=Object.keys(t);for(let r=0;r<o.length;r++){const s=o[r];this.attribute[s]=t[s]}this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(o)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i)}setAttribute(t,e,i,o){var r;const s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,o);s?this._setAttributes(s,i,o):ct((r=this.normalAttrs)===null||r===void 0?void 0:r[t])?(this.attribute[t]=e,this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(o)):this.normalAttrs[t]=e,t==="background"?this.loadImage(e,!0):t==="shadowGraphic"&&this.setShadowGraphic(e)}needUpdateTags(t,e=zi){for(let i=0;i<e.length;i++){const o=e[i];if(t.indexOf(o)!==-1)return!0}return!1}needUpdateTag(t,e=zi){for(let i=0;i<e.length;i++)if(t===e[i])return!0;return!1}initAttributes(t){const e={type:fi.INIT};t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,e)||t,this.attribute=t,t.background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._updateTag=te.INIT,this.valid=this.isValid(),this.onAttributeUpdate(e)}translate(t,e){var i,o;if(t===0&&e===0)return this;const r={type:fi.TRANSLATE},s=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,O0,r);s&&(t=s.x,e=s.y,delete s.x,delete s.y,this._setAttributes(s));const l=this.attribute,a=l.postMatrix;return a?X.transformUtil.fromMatrix(a,a).translate(t,e):(l.x=((i=l.x)!==null&&i!==void 0?i:We.x)+t,l.y=((o=l.y)!==null&&o!==void 0?o:We.y)+e),this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(r),this}translateTo(t,e){const i=this.attribute;if(i.x===t&&i.y===e)return this;const o={type:fi.TRANSLATE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({x:t,y:e},this.attribute,O0,o);return r?(this._setAttributes(r,!1,o),this):(i.x=t,i.y=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(o),this)}scale(t,e,i){var o,r;if(t===1&&e===1)return this;const s={type:fi.SCALE},l=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e,scaleCenter:i},this.attribute,W0,s);l&&(t=l.scaleX,e=l.scaleY,delete l.scaleX,delete l.scaleY,this._setAttributes(l));const a=this.attribute;if(i){let{postMatrix:h}=this.attribute;h||(h=new He,a.postMatrix=h),X.transformUtil.fromMatrix(h,h).scale(t,e,i)}else a.scaleX=((o=a.scaleX)!==null&&o!==void 0?o:We.scaleX)*t,a.scaleY=((r=a.scaleY)!==null&&r!==void 0?r:We.scaleY)*e;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(s),this}scaleTo(t,e){const i=this.attribute;if(i.scaleX===t&&i.scaleY===e)return this;const o={type:fi.SCALE_TO},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({scaleX:t,scaleY:e},this.attribute,W0,o);return r?(this._setAttributes(r,!1,o),this):(i.scaleX=t,i.scaleY=e,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(o),this)}rotate(t,e){var i;if(t===0)return this;const o={type:fi.ROTATE},r=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({angle:t,rotateCenter:e},this.attribute,N0,o);r&&(delete r.angle,this._setAttributes(r,!1,o));const s=this.attribute;if(e){let{postMatrix:l}=this.attribute;l||(l=new He,s.postMatrix=l),X.transformUtil.fromMatrix(l,l).rotate(t,e)}else s.angle=((i=s.angle)!==null&&i!==void 0?i:We.angle)+t;return this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(o),this}rotateTo(t){const e=this.attribute;if(e.angle===t)return this;const i={type:fi.ROTATE_TO},o=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,N0,i);return o?(this._setAttributes(o,!1,i),this):(e.angle=t,this.addUpdatePositionTag(),this.addUpdateBoundTag(),this.addUpdateLayoutTag(),this.onAttributeUpdate(i),this)}skewTo(t,e){return this}animate(t){this.animates||(this.animates=new Map);const e=new Bn(t==null?void 0:t.id,this.stage&&this.stage.getTimeline(),t==null?void 0:t.slience);if(e.bind(this),t){const{onStart:i,onFrame:o,onEnd:r,onRemove:s}=t;i!=null&&e.onStart(i),o!=null&&e.onFrame(o),r!=null&&e.onEnd(r),s!=null&&e.onRemove(s),e.interpolateFunc=t.interpolate}return this.animates.set(e.id,e),e.onRemove(()=>{this.animates.delete(e.id)}),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(X.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise"),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds(this.attribute.boundsMode==="imprecise"),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!ct(t)||this.currentStates.includes(t))}getState(t){var e;return(e=this.states)===null||e===void 0?void 0:e[t]}applyStateAttrs(t,e,i,o){var r,s,l,a;if(i){const h=Object.keys(t),d=this.getNoWorkAnimateAttr(),u={};let c;h.forEach(f=>{d[f]?(c||(c={}),c[f]=t[f]):u[f]=o&&t[f]===void 0?this.getDefaultAttribute(f):t[f]});const g=this.animate({slience:!0});g.stateNames=e,g.to(u,(s=(r=this.stateAnimateConfig)===null||r===void 0?void 0:r.duration)!==null&&s!==void 0?s:H0.duration,(a=(l=this.stateAnimateConfig)===null||l===void 0?void 0:l.easing)!==null&&a!==void 0?a:H0.easing),c&&this.setAttributes(c,!1,{type:fi.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:fi.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach(i=>{i in this.normalAttrs?(e[i]=this.normalAttrs[i],delete this.normalAttrs[i]):e[i]=this.getNormalAttribute(i)}),Object.keys(this.normalAttrs).forEach(i=>{t[i]=this.normalAttrs[i]})):Object.keys(t).forEach(i=>{e[i]=this.getNormalAttribute(i)}),this.normalAttrs=e}stopStateAnimates(t="end"){this.animates&&this.animates.forEach(e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))})}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach(i=>{if(i.stateNames){const o=i.getEndProps();Ef(o,t)&&(e=o[t])}}),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter(o=>o!==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 o;if(this.currentStates&&this.currentStates.includes(t)&&(e||this.currentStates.length===1))return;const r=e&&(!((o=this.currentStates)===null||o===void 0)&&o.length)?this.currentStates.concat([t]):[t];this.useStates(r,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if(!(((i=this.currentStates)===null||i===void 0?void 0:i.length)!==t.length||t.some((r,s)=>this.currentStates[s]!==r)))return;const o={};t.forEach(r=>{var s;const l=this.stateProxy?this.stateProxy(r,t):(s=this.states)===null||s===void 0?void 0:s[r];l&&Object.assign(o,l)}),this.updateNormalAttrs(o),this.currentStates=t,this.applyStateAttrs(o,t,e)}addUpdateBoundTag(){this._updateTag|=te.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=te.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=te.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&te.UPDATE_SHAPE_AND_BOUNDS)===te.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=te.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=te.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=te.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=te.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=te.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=te.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=te.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&te.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],o=()=>{if(e.b)return e.b;const{scaleX:r,scaleY:s,angle:l}=this.attribute;return D0.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(D0),this.setAttributes({scaleX:r,scaleY:s,angle:l}),e.b};if(typeof t[0]=="string"){const r=parseFloat(t[0])/100,s=o();i[0]=s.x1+(s.x2-s.x1)*r}else i[0]=t[0];if(typeof t[1]=="string"){const r=parseFloat(t[1])/100,s=o();i[1]=s.y1+(s.y2-s.y1)*r}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=We.x,y:e=We.y,scaleX:i=We.scaleX,scaleY:o=We.scaleY,angle:r=We.angle,scaleCenter:s,anchor:l,postMatrix:a}=this.attribute;let h=[0,0];const d={};if(l&&(h=this.getAnchor(l,d)),!s||i===1&&o===1)ew(this._transMatrix,this._transMatrix.reset(),t,e,i,o,r,l&&h);else{const c=this._transMatrix;c.reset(),c.translate(h[0],h[1]),c.rotate(r),c.translate(-h[0],-h[1]),c.translate(t,e),h=this.getAnchor(s,d),X.transformUtil.fromMatrix(c,c).scale(i,o,{x:h[0],y:h[1]})}const u=this.getOffsetXY(We);if(this._transMatrix.e+=u.x,this._transMatrix.f+=u.y,a){const c=TS.setValue(a.a,a.b,a.c,a.d,a.e,a.f),g=this._transMatrix;c.multiply(g.a,g.b,g.c,g.d,g.e,g.f),g.setValue(c.a,c.b,c.c,c.d,c.e,c.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const i=t.getTimeline();this.animates.forEach(o=>{o.setTimeline(i)})}this._onSetStage&&this._onSetStage(this,t,e),X.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:fi.ANIMATE_END})}onStep(t,e,i,o,r){const s={};if(i.customAnimate)i.customAnimate.update(r,o,s);else{const l=i.props,a=i.parsedProps,h=i.propKeys;this.stepInterpolate(t,e,s,i,o,r,l,void 0,a,h)}this.setAttributes(s,!1,{type:fi.ANIMATE_UPDATE,animationState:{ratio:o,end:r,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,o,r,s,l,a,h,d){d||(d=Object.keys(l),o.propKeys=d),s?o.propKeys.forEach(u=>{e.validAttr(u)&&(i[u]=l[u])}):d.forEach(u=>{var c;if(!e.validAttr(u))return;const g=l[u],f=(c=a&&a[u])!==null&&c!==void 0?c:t.getLastPropByName(u,o);if(g==null||f==null||g===f)return void(i[u]=g);let p;p=e.interpolateFunc&&e.interpolateFunc(u,r,f,g,i),p||(p=e.customInterpolate(u,r,f,g,this,i),p||this.defaultInterpolate(g,f,u,i,h,r)||this._interpolate(u,r,f,g,i))}),o.parsedProps=h}defaultInterpolate(t,e,i,o,r,s){if(Number.isFinite(t))return o[i]=e+(t-e)*s,!0;if(i==="fill"){r||(r={});const l=r.fillColorArray,a=ur(e,l??t,s,!1,(h,d)=>{r.fillColorArray=d});return a&&(o[i]=a),!0}if(i==="stroke"){r||(r={});const l=r.strokeColorArray,a=ur(e,l??t,s,!1,(h,d)=>{r.strokeColorArray=d});return a&&(o[i]=a),!0}if(i==="shadowColor"){r||(r={});const l=r.shadowColorArray,a=ur(e,l??t,s,!0,(h,d)=>{r.shadowColorArray=d});return a&&(o[i]=a),!0}return!1}_interpolate(t,e,i,o,r){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return(e=this.attribute[t])!==null&&e!==void 0?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=t??X.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 Qt(t,!0)?this.pathProxy=new Ue().fromString(t):this.pathProxy=new Ue,this.pathProxy}loadImage(t,e=!1){if(!t||e&&MS(t))return;const i=t;this.resources||(this.resources=new Map);const o={data:"init",state:null};this.resources.set(i,o),typeof t=="string"?(o.state="loading",t.startsWith("<svg")?(ee.GetSvg(t,this),this.backgroundImg=this.backgroundImg||e):(T1(t)||t.includes("/")||M1(t))&&(ee.GetImage(t,this),this.backgroundImg=this.backgroundImg||e)):$t(t)?(o.state="success",o.data=t,this.backgroundImg=this.backgroundImg||e):o.state="fail"}setShadowGraphic(t){t?this.attachShadow().add(t):this.detachShadow()}imageLoadSuccess(t,e,i){if(!this.resources)return;const o=this.resources.get(t);o&&(o.state="success",o.data=e,i&&i(),this.addUpdateBoundTag(),this.stage&&this.stage.renderNextFrame())}imageLoadFail(t,e){if(!this.resources)return;const i=this.resources.get(t);i&&(i.state="fail",e&&e())}_stopAnimates(t){t&&t.forEach(e=>{e.stop()})}stopAnimates(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren(e=>{e.stopAnimates(t)})}release(){this.releaseStatus="released",X.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,o;if(this._events&&t in this._events){const r=new Su(t,e);r.bubbles=!1,r.manager=(o=(i=this.stage)===null||i===void 0?void 0:i.eventSystem)===null||o===void 0?void 0:o.manager,this.dispatchEvent(r)}}}function MS(n){return!(!n.fill&&!n.stroke)}pi.mixin(mS);function BS(n,t){const e=[];let i=t.exec(n);for(;i;){const o=[];o.startIndex=t.lastIndex-i[0].length;const r=i.length;for(let s=0;s<r;s++)o.push(i[s]);e.push(o),i=t.exec(n)}return e}class Tu{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function V0(n,t,e,i){const o=n.indexOf(t,e);if(o===-1)throw new Error(i);return o+t.length-1}function PS(n,t,e=">"){let i,o="";for(let r=t;r<n.length;r++){let s=n[r];if(i)s===i&&(i="");else if(s==='"'||s==="'")i=s;else if(s===e[0]){if(!e[1])return{data:o,index:r};if(n[r+1]===e[1])return{data:o,index:r}}else s===" "&&(s=" ");o+=s}}function j0(n,t,e,i=">"){const o=PS(n,t+1,i);if(!o)return;let r=o.data;const s=o.index,l=r.search(/\s/);let a=r,h=!0;l!==-1&&(a=r.substr(0,l).replace(/\s\s*$/,""),r=r.substr(l+1));const d=a;if(e){const u=a.indexOf(":");u!==-1&&(a=a.substr(u+1),h=a!==o.data.substr(u+1))}return{tagName:a,tagExp:r,closeIndex:s,attrExpPresent:h,rawTagName:d}}const HS=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");class ES{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const o=e.tagname;typeof o=="string"&&(e.tagname=o),t.addChild(e)}buildAttributesMap(t,e,i){const o={};if(!t)return;const r=BS(t,HS),s=r.length;for(let l=0;l<s;l++){const a=r[l][1],h=r[l][4],d=a;a&&(o[d]=h===void 0||(isNaN(h)?h:Number(h)))}return o}parseXml(t){t=t.replace(/\r\n?/g,`
|
|
4
4
|
`);const e=new Tu("!xml");let i=e,o="",r="";for(let s=0;s<t.length;s++)if(t[s]==="<")if(t[s+1]==="/"){const l=V0(t,">",s,"Closing Tag is not closed."),a=r.lastIndexOf(".");r=r.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&o&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=o),o="",s=l}else if(t[s+1]==="?")s=j0(t,s,!1,"?>").closeIndex+1;else if(t.substr(s+1,3)==="!--")s=V0(t,"-->",s+4,"Comment is not closed.");else{const l=j0(t,s,!1);let a=l.tagName,h=l.tagExp;const d=l.attrExpPresent,u=l.closeIndex;if(a!==e.tagname&&(r+=r?"."+a:a),h.length>0&&h.lastIndexOf("/")===h.length-1){a[a.length-1]==="/"?(a=a.substr(0,a.length-1),r=r.substr(0,r.length-1),h=a):h=h.substr(0,h.length-1);const c=new Tu(a);a!==h&&d&&(c[":@"]=this.buildAttributesMap(h,r,a)),this.addChild(i,c,r),r=r.substr(0,r.lastIndexOf("."))}else{const c=new Tu(a);this.tagsNodeStack.push(i),a!==h&&d&&(c[":@"]=this.buildAttributesMap(h,r,a)),this.addChild(i,c,r),i=c}o="",s=u}else o+=t[s];return e.child}}function LS(n,t){return G0(n)}function G0(n,t){const e={};for(let i=0;i<n.length;i++){const o=n[i],r=FS(o);if(r!==void 0&&o[r]){const s=G0(o[r]);IS(s),o[":@"]&&kS(s,o[":@"]),e[r]!==void 0&&e.hasOwnProperty(r)?(Array.isArray(e[r])||(e[r]=[e[r]]),e[r].push(s)):e[r]=s}}return e}function FS(n){const t=Object.keys(n);for(let e=0;e<t.length;e++){const i=t[e];if(i!==":@")return i}}function kS(n,t,e){if(t){const i=Object.keys(t),o=i.length;for(let r=0;r<o;r++){const s=i[r];n[s]=t[s]}}}function IS(n){return Object.keys(n).length===0}class ql{constructor(t){this.options=Object.assign({},ql.defaultOptions,t)}valid(t){return t.startsWith("<")}parse(t){if(!this.valid)return!1;const e=new ES(this.options).parseXml(t);return LS(e,this.options)}}ql.defaultOptions={};function zS(n){return n.startsWith("<svg")||n.startsWith("<?xml")}globalThis&&globalThis.__awaiter;function Zl(n,t,e,i=0){return n.expand(t+(i/2+(e?DS(e,t):0))),n}function DS(n,t){return n?t:0}let OS=0;function Xe(){return OS++}var Ro;(function(n){n[n.HORIZONTAL=0]="HORIZONTAL",n[n.VERTICAL=1]="VERTICAL"})(Ro||(Ro={}));function U0(n){const t=[];let e=0,i="";for(let o=0;o<n.length;o++)VS(n[o])?e?i+=n[o]:(e=1,i=n[o]):(e&&(t.push({text:i,direction:Ro.VERTICAL}),i="",e=0),t.push({text:n[o],direction:Ro.HORIZONTAL}));return i&&t.push({text:i,direction:Ro.VERTICAL}),t}const WS=["…","(",")","—","【","】","「","」","《","》"],K0=new Map;WS.forEach(n=>K0.set(n,!0));const NS=[""],$0=new Map;function VS(n){if(K0.has(n))return!0;if($0.has(n))return!1;let t=!1;return n.codePointAt(0)<256&&(t=!0),t}NS.forEach(n=>$0.set(n,!0));const Jl=Xe(),jS=Xe(),Y0=Xe(),Ql=Xe();Xe();const Mu=Xe(),ta=Xe(),vs=Xe(),ea=Xe(),ia=Xe();Xe();const Bu=Xe();Xe();const Pu=Xe(),na=Xe(),oa=Xe(),X0=Symbol.for("GraphicService"),q0=Symbol.for("GraphicCreator"),Z0={"stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-width":"lineWidth","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity",stroke:"stroke",fill:"fill"},GS=Object.keys(Z0);var J0;(function(n){n[n.LESS_GROUP=0]="LESS_GROUP",n[n.MORE_GROUP=1]="MORE_GROUP"})(J0||(J0={}));let Qi=class ff extends pi{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Mu,this._childUpdateTag=te.UPDATE_BOUNDS}setMode(t){t==="3d"?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new hs),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new hs)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren(e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)})}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===rs.GLOBAL){const o=new ye(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(o,o),this.AABBBounds.contains(o.x,o.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&te.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;X.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),X.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=We.x,y:e=We.y,dx:i=We.dx,dy:o=We.dy,scaleX:r=We.scaleX,scaleY:s=We.scaleY,angle:l=We.angle,postMatrix:a}=this.attribute;if(t!==0||e!==0||i!==0||o!==0||r!==1||s!==1||l!==0||a)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Ht(this).group}updateAABBBounds(t,e,i){const o=i;i=i.clone();const{width:r,height:s,path:l,clip:a=e.clip,display:h}=t;return l&&l.length?l.forEach(d=>{i.union(d.AABBBounds)}):r!=null&&s!=null&&i.set(0,0,Math.max(0,r),Math.max(0,s)),a||this.forEachChildren(d=>{i.union(d.AABBBounds)}),X.graphicService.updateTempAABBBounds(i),X.graphicService.transformAABBBounds(t,i,e,!1,this),o.copy(i),o}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=te.CLEAR_BOUNDS,this._childUpdateTag&=te.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=te.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&te.UPDATE_BOUNDS||(this._childUpdateTag|=te.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(),X.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),X.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,X.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren(e=>{X.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)}),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),X.graphicService.onSetStage(this,t),this.forEachChildren(i=>{i.setStage(t,this.layer)}))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren(t=>{t.isContainer&&t.addUpdateGlobalPositionTag()})}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren(t=>{t.isContainer&&t.addUpdateGlobalPositionTag()})}tryUpdateGlobalTransMatrix(t=!0){if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const e=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.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&te.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find(i=>i.name===t,e)}createOrUpdateChild(t,e,i){let o=this._getChildByName(t);return o?o.setAttributes(e):(o=X.graphicService.creator[i](e),o.name=t,this.add(o)),o}clone(){return new ff(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ff.NOWORK_ANIMATE_ATTR}};Qi.NOWORK_ANIMATE_ATTR=Ji;function ra(n){return new Qi(n)}class US extends Qi{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,o){var r;super({}),this.stage=t,this.global=e,this.window=i,this.main=o.main,this.layerHandler=o.layerHandler,this.layerHandler.init(this,i,{main:o.main,canvasId:o.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:(r=o.zIndex)!==null&&r!==void 0?r:0}),this.layer=this,this.subLayers=new Map,this.theme=new hs,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!0){const e=Array.from(this.subLayers.values()).sort((i,o)=>i.zIndex-o.zIndex);this.layerHandler.merge(e.map(i=>(i.layer.subLayers.size&&i.layer.combineSubLayer(t),i.layer.getNativeHandler()))),t&&e.forEach(i=>{i.group&&(i.group.incremental=0)}),e.forEach(i=>{X.layerService.releaseLayer(this.stage,i.layer)}),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach(i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)})}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:(i=t.background)!==null&&i!==void 0?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach(o=>o(this)),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach(t=>{X.layerService.releaseLayer(this.stage,t.layer)})}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:(i=e.background)!==null&&i!==void 0?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach(o=>o(this))}}const Q0=Symbol.for("TransformUtil"),tp=Symbol.for("GraphicUtil"),Hu=Symbol.for("LayerService"),ep=Symbol.for("StaticLayerHandlerContribution"),KS=Symbol.for("DynamicLayerHandlerContribution"),$S=Symbol.for("VirtualLayerHandlerContribution");var ms,YS=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},XS=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};let bs=ms=class{static GenerateLayerId(){return`${ms.idprefix}_${ms.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=X.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(n){return this.layerMap.get(n)}getRecommendedLayerType(n){return n||(this.staticLayerCountInEnv!==0?"static":this.dynamicLayerCountInEnv!==0?"dynamic":"virtual")}getLayerHandler(n){let t;return t=n==="static"?Tt.get(ep):n==="dynamic"?Tt.get(KS):Tt.get($S),t}createLayer(n,t={main:!1}){var e;this.tryInit();let i=this.getRecommendedLayerType(t.layerMode);i=t.main||t.canvasId?"static":i;const o=this.getLayerHandler(i),r=new US(n,this.global,n.window,Object.assign(Object.assign({main:!1},t),{layerMode:i,canvasId:(e=t.canvasId)!==null&&e!==void 0?e:ms.GenerateLayerId(),layerHandler:o})),s=this.layerMap.get(n)||[];return s.push(r),this.layerMap.set(n,s),this.staticLayerCountInEnv--,r}prepareStageLayer(n){let t;n.forEachChildren(e=>{const i=e.getNativeHandler();i.type==="virtual"?(i.mainHandler=t,t.secondaryHandlers.push(i)):(t=i,t.secondaryHandlers=[])})}releaseLayer(n,t){t.release();const e=this.layerMap.get(n)||[];this.layerMap.set(n,e.filter(i=>i!==t))}layerCount(n){return(this.layerMap.get(n)||[]).length}restLayerCount(n){return this.global.env==="browser"?10:0}releaseStage(n){this.layerMap.delete(n)}};bs.idprefix="visactor_layer",bs.prefix_count=0,bs=ms=YS([st(),XS("design:paramtypes",[])],bs);const qS=new Bt(n=>{n(Nd).to(Vd).inSingletonScope(),n(as).to(Cu),n(tp).to(_u).inSingletonScope(),n(Q0).to(yu).inSingletonScope(),n(Hu).to(bs).inSingletonScope()});function cr(n,t){return!(!n&&!t)}function Cs(n,t){let e;return e=it(n)?n.some(i=>i||i===void 0):!!n,e&&t>0}function To(n,t,e){return e&&n*t>0}function ip(n,t,e,i,o){return o&&n*t>0&&e!==0&&i!==0}function Eu(n,t){return n*t>0}function np(n,t,e,i){return n*t>0&&e!==0&&i!==0}function ZS(n,t,e,i,o,r,s,l){if(!n.pathProxy)return!1;const a=Ht(n,r==null?void 0:r.theme)[n.type.replace("3d","")],{fill:h=a.fill,stroke:d=a.stroke,opacity:u=a.opacity,fillOpacity:c=a.fillOpacity,lineWidth:g=a.lineWidth,strokeOpacity:f=a.strokeOpacity,visible:p=a.visible,x:v=a.x,y:m=a.y}=n.attribute,b=To(u,c,h),w=Eu(u,f),C=cr(h),_=Cs(d,g);if(!p||!C&&!_||!(b||w||s||l))return!0;t.beginPath();const y=typeof n.pathProxy=="function"?n.pathProxy(n.attribute):n.pathProxy;return qn(y.commandList,t,e,i),t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,a),_&&(l?l(t,n.attribute,a):w&&(t.setStrokeStyle(n,n.attribute,e-v,i-m,a),t.stroke())),C&&(s?s(t,n.attribute,a):b&&(t.setCommonStyle(n,n.attribute,e-v,i-m,a),t.fill())),!0}function JS(n,t,e,i,o,r,s,l){const a=e-n,h=i-t,d=s-o,u=l-r;let c=u*a-d*h;return c*c<ae?[]:(c=(d*(t-r)-u*(n-o))/c,[n+c*a,t+c*h])}function to(n,t,e,i,o,r,s){const l=n-e,a=t-i,h=(s?r:-r)/Math.sqrt(l*l+a*a),d=h*a,u=-h*l,c=n+d,g=t+u,f=e+d,p=i+u,v=(c+f)/2,m=(g+p)/2,b=f-c,w=p-g,C=b*b+w*w,_=o-r,y=c*p-f*g,x=(w<0?-1:1)*Math.sqrt(Math.max(0,_*_*C-y*y));let S=(y*w-b*x)/C,A=(-y*b-w*x)/C;const R=(y*w+b*x)/C,T=(-y*b+w*x)/C,M=S-v,P=A-m,k=R-v,B=T-m;return M*M+P*P>k*k+B*B&&(S=R,A=T),{cx:S,cy:A,x01:-d,y01:-u,x11:S*(o/_-1),y11:A*(o/_-1)}}function op(n,t,e,i,o){const r=Jt(e-t),s=n.getParsedCornerRadius(),l=it(s),{outerDeltaAngle:a,innerDeltaAngle:h,outerStartAngle:d,outerEndAngle:u,innerEndAngle:c,innerStartAngle:g}=n.getParsePadAngle(t,e),f=l?s[0]:s,p=l?s[1]:s,v=l?s[2]:s,m=l?s[3]:s,b=Math.max(p,f),w=Math.max(v,m);let C=b,_=w;const y=o*Pe(d),x=o*pe(d),S=i*Pe(c),A=i*pe(c);let R,T,M,P;if((w>ae||b>ae)&&(R=o*Pe(u),T=o*pe(u),M=i*Pe(g),P=i*pe(g),r<oe)){const k=JS(y,x,M,P,R,T,S,A);if(k){const B=y-k[0],H=x-k[1],E=R-k[0],F=T-k[1],L=1/pe(Y1((B*E+H*F)/(Zi(B*B+H*H)*Zi(E*E+F*F)))/2),z=Zi(k[0]*k[0]+k[1]*k[1]);_=ii(w,(i-z)/(L-1)),C=ii(b,(o-z)/(L+1))}}return{outerDeltaAngle:a,xors:y,yors:x,xirs:M,yirs:P,xore:R,yore:T,xire:S,yire:A,limitedOcr:C,limitedIcr:_,outerCornerRadiusStart:f,outerCornerRadiusEnd:p,maxOuterCornerRadius:b,maxInnerCornerRadius:w,outerStartAngle:d,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:c,innerStartAngle:g,innerCornerRadiusStart:m,innerCornerRadiusEnd:v}}function Lu(n,t,e,i,o,r,s){const{startAngle:l,endAngle:a}=n.getParsedAngle(),h=Jt(a-l),d=a>l;let u=!1;if(o<r){const c=o;o=r,r=c}if(o<=ae)t.moveTo(e,i);else if(h>=Gt-ae)t.moveTo(e+o*Pe(l),i+o*pe(l)),t.arc(e,i,o,l,a,!d),r>ae&&(t.moveTo(e+r*Pe(a),i+r*pe(a)),t.arc(e,i,r,a,l,d));else{const{outerDeltaAngle:c,xors:g,yors:f,xirs:p,yirs:v,limitedOcr:m,outerCornerRadiusStart:b,outerCornerRadiusEnd:w,maxOuterCornerRadius:C,xore:_,yore:y,xire:x,yire:S,outerStartAngle:A,outerEndAngle:R,limitedIcr:T,innerDeltaAngle:M,innerEndAngle:P,innerStartAngle:k,innerCornerRadiusStart:B,innerCornerRadiusEnd:H,maxInnerCornerRadius:E}=op(n,l,a,r,o);if(c<.001)s&&(s[3]||s[1])&&t.moveTo(e+g,i+f),u=!0;else if(m>ae){const F=ii(b,m),L=ii(w,m),z=to(p,v,g,f,o,F,Number(d)),D=to(_,y,x,S,o,L,Number(d));m<C&&F===L?!s||s[0]?(t.moveTo(e+z.cx+z.x01,i+z.cy+z.y01),t.arc(e+z.cx,i+z.cy,m,Xt(z.y01,z.x01),Xt(D.y01,D.x01),!d)):t.moveTo(e+z.cx+m*Pe(Xt(D.y01,D.x01)),i+z.cy+m*pe(Xt(D.y01,D.x01))):!s||s[0]?(t.moveTo(e+z.cx+z.x01,i+z.cy+z.y01),F>0&&t.arc(e+z.cx,i+z.cy,F,Xt(z.y01,z.x01),Xt(z.y11,z.x11),!d),t.arc(e,i,o,Xt(z.cy+z.y11,z.cx+z.x11),Xt(D.cy+D.y11,D.cx+D.x11),!d),L>0&&t.arc(e+D.cx,i+D.cy,L,Xt(D.y11,D.x11),Xt(D.y01,D.x01),!d)):L>0?t.moveTo(e+D.cx+L*Pe(Xt(D.y01,D.x01)),i+D.cy+L*pe(Xt(D.y01,D.x01))):t.moveTo(e+_,i+o*pe(R))}else!s||s[0]?(t.moveTo(e+g,i+f),t.arc(e,i,o,A,R,!d)):t.moveTo(e+o*Pe(R),i+o*pe(R));if(!(r>ae)||M<.001)!s||s[1]?t.lineTo(e+x,i+S):t.moveTo(e+x,i+S),u=!0;else if(T>ae){const F=ii(B,T),L=ii(H,T),z=to(x,S,_,y,r,-L,Number(d)),D=to(g,f,p,v,r,-F,Number(d));if(!s||s[1]?t.lineTo(e+z.cx+z.x01,i+z.cy+z.y01):t.moveTo(e+z.cx+z.x01,i+z.cy+z.y01),T<E&&F===L){const N=Xt(D.y01,D.x01);!s||s[2]?t.arc(e+z.cx,i+z.cy,T,Xt(z.y01,z.x01),N,!d):t.moveTo(e+z.cx+Pe(N),i+z.cy+pe(N))}else!s||s[2]?(L>0&&t.arc(e+z.cx,i+z.cy,L,Xt(z.y01,z.x01),Xt(z.y11,z.x11),!d),t.arc(e,i,r,Xt(z.cy+z.y11,z.cx+z.x11),Xt(D.cy+D.y11,D.cx+D.x11),d),F>0&&t.arc(e+D.cx,i+D.cy,F,Xt(D.y11,D.x11),Xt(D.y01,D.x01),!d)):F>0?t.moveTo(e+D.cx+F*Pe(Xt(D.y01,D.x01)),i+D.cy+F*pe(Xt(D.y01,D.x01))):t.moveTo(e+p,i+v)}else!s||s[1]?t.lineTo(e+x,i+S):t.moveTo(e+x,i+S),!s||s[2]?t.arc(e,i,r,P,k,d):t.moveTo(e+r*Pe(k),i+r*pe(k))}return s?s[3]&&t.lineTo(e+o*Pe(l),i+o*pe(l)):t.closePath(),u}class Di{static GetCanvas(){try{return Di.canvas||(Di.canvas=X.global.createCanvas({})),Di.canvas}catch{return null}}static GetCtx(){if(!Di.ctx){const t=Di.GetCanvas();Di.ctx=t.getContext("2d")}return Di.ctx}}class Mo extends iw{static getInstance(){return Mo._instance||(Mo._instance=new Mo),Mo._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Di.GetCanvas(),o=Di.GetCtx();if(i.width=e,i.height=1,!o)return;if(o.translate(0,0),!o)throw new Error("获取ctx发生错误");const r=o.createLinearGradient(0,0,e,0);t.forEach(s=>{r.addColorStop(s[0],s[1])}),o.fillStyle=r,o.fillRect(0,0,e,1),this.rgbaSet=o.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,o,r=[],s=100){let l=`${t}${e}${i}${o}`;r.forEach(h=>l+=h.join()),l+=s;let a=this.dataMap.get(l);return a||(a={data:new Mo(r,s),timestamp:[]},this.addLimitedTimestamp(a,Date.now(),{}),this.dataMap.set(l,a)),this.clearCache(this.dataMap,this.cacheParams),a.data}}class oi{static GetSize(t){for(let e=0;e<oi.ImageSize.length;e++)if(oi.ImageSize[e]>=t)return oi.ImageSize[e];return t}static Get(t,e,i,o,r,s,l){const a=oi.GenKey(t,e,i,o,r),h=oi.cache[a];if(!h||h.length===0)return null;for(let d=0;d<h.length;d++)if(h[d].width>=s&&h[d].height>=l)return h[d].pattern;return null}static Set(t,e,i,o,r,s,l,a){const h=oi.GenKey(t,e,i,o,r);oi.cache[h]?oi.cache[h].push({width:l,height:a,pattern:s}):oi.cache[h]=[{width:l,height:a,pattern:s}]}static GenKey(t,e,i,o,r){return`${e},${i},${o},${r},${t.join()}`}}oi.cache={},oi.ImageSize=[20,40,80,160,320,640,1280,2560];function QS(n,t,e,i){const{stops:o,startAngle:r,endAngle:s}=i;for(;e<0;)e+=Gt;for(;e>Gt;)e-=Gt;if(e<r||e>s)return o[0].color;let l,a,h=(e-r)/(s-r);for(let d=0;d<o.length;d++)if(o[d].offset>=h){l=o[d-1],a=o[d];break}return h=(h-l.offset)/(a.offset-l.offset),ur(l.color,a.color,h,!1)}function tx(n,t,e,i,o,r,s,l,a){const h=Math.floor(180*o/Math.PI),d=Di.GetCanvas(),u=Di.GetCtx();if(!u)return null;const c=oi.GetSize(l),g=oi.GetSize(a);let f=oi.Get(t,e,i,r,s,c,g);if(f)return f;const p=Math.sqrt(Math.max(Math.max(Math.pow(e,2)+Math.pow(i,2),Math.pow(c-e,2)+Math.pow(i,2)),Math.max(Math.pow(c-e,2)+Math.pow(g-i,2),Math.pow(e,2)+Math.pow(g-i,2)))),v=h+1,m=o/Math.max(1,v-1),b=Mo.getInstance().GetOrCreate(e,i,c,g,t,v),w=2*Math.PI*p/360;d.width=c,d.height=g,u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,c,g),u.translate(e,i),u.rotate(r);for(let _=0,y=v-1;_<y&&!(r+_*m>s);_++){const x=b.getColor(_);u.beginPath(),u.rotate(m),u.moveTo(0,0),u.lineTo(p,-2*w),u.lineTo(p,0),u.fillStyle=x,u.closePath(),u.fill()}const C=u.getImageData(0,0,c,g);return d.width=C.width,d.height=C.height,u.putImageData(C,0,0),f=n.createPattern(d,"no-repeat"),f&&oi.Set(t,e,i,r,s,f,c,g),f}const Fu=Symbol.for("ArcRenderContribution"),ex=Symbol.for("AreaRenderContribution"),ku=Symbol.for("CircleRenderContribution"),tn=Symbol.for("GroupRenderContribution"),Bo=Symbol.for("ImageRenderContribution"),Iu=Symbol.for("PathRenderContribution"),zu=Symbol.for("PolygonRenderContribution"),Po=Symbol.for("RectRenderContribution"),Du=Symbol.for("SymbolRenderContribution"),sa=Symbol.for("TextRenderContribution"),Ou=Symbol.for("InteractiveSubRenderContribution");function ix(n,t){return n==="top"?Math.ceil(.79*t):n==="middle"?Math.round(.3*t):n==="bottom"?Math.round(-.21*t):0}function fn(n,t){return n==="end"||n==="right"?-t:n==="center"?-t/2:0}function pn(n,t,e,i=0){return n==="middle"?-t/2:n==="top"?0:n==="bottom"?i-t:n&&n!=="alphabetic"?0:(e||(e=t),-(t-e)/2-.79*e)}function rp(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function nx(n,t,e){const i=Math.sin(e),o=Math.cos(e),r=t[4],s=t[5],l=t[6],a=t[7],h=t[8],d=t[9],u=t[10],c=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=r*o+h*i,n[5]=s*o+d*i,n[6]=l*o+u*i,n[7]=a*o+c*i,n[8]=h*o-r*i,n[9]=d*o-s*i,n[10]=u*o-l*i,n[11]=c*o-a*i,n}function ox(n,t,e){const i=Math.sin(e),o=Math.cos(e),r=t[0],s=t[1],l=t[2],a=t[3],h=t[8],d=t[9],u=t[10],c=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=r*o-h*i,n[1]=s*o-d*i,n[2]=l*o-u*i,n[3]=a*o-c*i,n[8]=r*i+h*o,n[9]=s*i+d*o,n[10]=l*i+u*o,n[11]=a*i+c*o,n}function rx(n,t,e){const i=Math.sin(e),o=Math.cos(e),r=t[0],s=t[1],l=t[2],a=t[3],h=t[4],d=t[5],u=t[6],c=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=r*o+h*i,n[1]=s*o+d*i,n[2]=l*o+u*i,n[3]=a*o+c*i,n[4]=h*o-r*i,n[5]=d*o-s*i,n[6]=u*o-l*i,n[7]=c*o-a*i,n}function _s(n,t,e){const i=e[0],o=e[1],r=e[2];let s,l,a,h,d,u,c,g,f,p,v,m;return t===n?(n[12]=t[0]*i+t[4]*o+t[8]*r+t[12],n[13]=t[1]*i+t[5]*o+t[9]*r+t[13],n[14]=t[2]*i+t[6]*o+t[10]*r+t[14],n[15]=t[3]*i+t[7]*o+t[11]*r+t[15]):(s=t[0],l=t[1],a=t[2],h=t[3],d=t[4],u=t[5],c=t[6],g=t[7],f=t[8],p=t[9],v=t[10],m=t[11],n[0]=s,n[1]=l,n[2]=a,n[3]=h,n[4]=d,n[5]=u,n[6]=c,n[7]=g,n[8]=f,n[9]=p,n[10]=v,n[11]=m,n[12]=s*i+d*o+f*r+t[12],n[13]=l*i+u*o+p*r+t[13],n[14]=a*i+c*o+v*r+t[14],n[15]=h*i+g*o+m*r+t[15]),n}function Wu(n,t){n[0]=t.a,n[1]=t.b,n[2]=0,n[3]=0,n[4]=t.c,n[5]=t.d,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=t.e,n[13]=t.f,n[14]=0,n[15]=1}function sx(n,t,e){const i=e[0],o=e[1],r=e[2];return n[0]=t[0]*i,n[1]=t[1]*i,n[2]=t[2]*i,n[3]=t[3]*i,n[4]=t[4]*o,n[5]=t[5]*o,n[6]=t[6]*o,n[7]=t[7]*o,n[8]=t[8]*r,n[9]=t[9]*r,n[10]=t[10]*r,n[11]=t[11]*r,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n}function ys(n,t,e){const i=t[0],o=t[1],r=t[2],s=t[3],l=t[4],a=t[5],h=t[6],d=t[7],u=t[8],c=t[9],g=t[10],f=t[11],p=t[12],v=t[13],m=t[14],b=t[15];let w=e[0],C=e[1],_=e[2],y=e[3];return n[0]=w*i+C*l+_*u+y*p,n[1]=w*o+C*a+_*c+y*v,n[2]=w*r+C*h+_*g+y*m,n[3]=w*s+C*d+_*f+y*b,w=e[4],C=e[5],_=e[6],y=e[7],n[4]=w*i+C*l+_*u+y*p,n[5]=w*o+C*a+_*c+y*v,n[6]=w*r+C*h+_*g+y*m,n[7]=w*s+C*d+_*f+y*b,w=e[8],C=e[9],_=e[10],y=e[11],n[8]=w*i+C*l+_*u+y*p,n[9]=w*o+C*a+_*c+y*v,n[10]=w*r+C*h+_*g+y*m,n[11]=w*s+C*d+_*f+y*b,w=e[12],C=e[13],_=e[14],y=e[15],n[12]=w*i+C*l+_*u+y*p,n[13]=w*o+C*a+_*c+y*v,n[14]=w*r+C*h+_*g+y*m,n[15]=w*s+C*d+_*f+y*b,n}function en(n,t,e){const i=t[0],o=t[1],r=t[2];let s=e[3]*i+e[7]*o+e[11]*r+e[15];return s=s||1,n[0]=(e[0]*i+e[4]*o+e[8]*r+e[12])/s,n[1]=(e[1]*i+e[5]*o+e[9]*r+e[13])/s,n[2]=(e[2]*i+e[6]*o+e[10]*r+e[14])/s,n}function sp(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}class lx{constructor(){this.pools=[]}allocate(t,e,i,o,r,s){if(!this.pools.length)return new He(t,e,i,o,r,s);const l=this.pools.pop();return l.a=t,l.b=e,l.c=i,l.d=o,l.e=r,l.f=s,l}allocateByObj(t){if(!this.pools.length)return new He(t.a,t.b,t.c,t.d,t.e,t.f);const e=this.pools.pop();return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}class Nu{constructor(){this.pools=[]}static identity(t){return rp(t)}allocate(){if(!this.pools.length)return sp();const t=this.pools.pop();return Nu.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():sp();for(let i=0;i<e.length;i++)e[i]=t[i];return e}free(t){t&&this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const wi=new lx,Le=new Nu;var ax=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},hx=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},dx=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};function lp(n,t,e){var i;const{x:o=e.x,y:r=e.y,z:s=e.z,dx:l=e.dx,dy:a=e.dy,dz:h=e.dz,scaleX:d=e.scaleX,scaleY:u=e.scaleY,scaleZ:c=e.scaleZ,alpha:g=e.alpha,beta:f=e.beta,angle:p=e.angle,anchor3d:v=t.attribute.anchor,anchor:m}=t.attribute,b=[0,0,0];if(v){if(typeof v[0]=="string"){const w=parseFloat(v[0])/100,C=t.AABBBounds;b[0]=C.x1+(C.x2-C.x1)*w}else b[0]=v[0];if(typeof v[1]=="string"){const w=parseFloat(v[1])/100,C=t.AABBBounds;b[1]=C.x1+(C.x2-C.x1)*w}else b[1]=v[1];b[2]=(i=v[2])!==null&&i!==void 0?i:0}if(rp(n),_s(n,n,[o+l,r+a,s+h]),_s(n,n,[b[0],b[1],b[2]]),nx(n,n,f),ox(n,n,g),_s(n,n,[-b[0],-b[1],b[2]]),sx(n,n,[d,u,c]),p){const w=Le.allocate(),C=[0,0];if(m){if(typeof v[0]=="string"){const _=parseFloat(v[0])/100,y=t.AABBBounds;C[0]=y.x1+(y.x2-y.x1)*_}else C[0]=v[0];if(typeof v[1]=="string"){const _=parseFloat(v[1])/100,y=t.AABBBounds;C[1]=y.x1+(y.x2-y.x1)*_}else C[1]=v[1]}_s(w,w,[C[0],C[1],0]),rx(w,w,p),_s(w,w,[-C[0],-C[1],0]),ys(n,n,w)}}function ux(n){const{alpha:t,beta:e}=n.attribute;return t||e}let Vu=class{constructor(n){this.creator=n,this.hooks={onAttributeUpdate:new gi(["graphic"]),onSetStage:new gi(["graphic","stage"]),onRemove:new gi(["graphic"]),onRelease:new gi(["graphic"]),onAddIncremental:new gi(["graphic","group","stage"]),onClearIncremental:new gi(["graphic","group","stage"]),beforeUpdateAABBBounds:new gi(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new gi(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new gi(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new he,this.tempAABBBounds2=new he}onAttributeUpdate(n){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(n)}onSetStage(n,t){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(n,t)}onRemove(n){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(n)}onRelease(n){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(n)}onAddIncremental(n,t,e){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(n,t,e)}onClearIncremental(n,t){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(n,t)}beforeUpdateAABBBounds(n,t,e,i){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(n,t,e,i)}afterUpdateAABBBounds(n,t,e,i,o){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(n,t,e,i,o)}clearAABBBounds(n,t,e){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(n,t,e)}updatePathProxyAABBBounds(n,t){const e=typeof t.pathProxy=="function"?t.pathProxy(t.attribute):t.pathProxy;if(!e)return!1;const i=new ou(n);return qn(e.commandList,i,0,0),!0}updateHTMLTextAABBBounds(n,t,e,i){const{textAlign:o,textBaseline:r}=n;if(n.forceBoundsHeight!=null){const s=nt(n.forceBoundsHeight)?n.forceBoundsHeight:n.forceBoundsHeight(),l=pn(r,s,s);e.set(e.x1,l,e.x2,l+s)}if(n.forceBoundsWidth!=null){const s=nt(n.forceBoundsWidth)?n.forceBoundsWidth:n.forceBoundsWidth(),l=fn(o,s);e.set(l,e.y1,l+s,e.y2)}}combindShadowAABBBounds(n,t){if(t&&t.shadowRoot){const e=t.shadowRoot.AABBBounds;n.union(e)}}transformAABBBounds(n,t,e,i,o){if(!t.empty()){const{scaleX:l=e.scaleX,scaleY:a=e.scaleY,stroke:h=e.stroke,shadowBlur:d=e.shadowBlur,lineWidth:u=e.lineWidth,pickStrokeBuffer:c=e.pickStrokeBuffer,strokeBoundsBuffer:g=e.strokeBoundsBuffer}=n,f=this.tempAABBBounds1,p=this.tempAABBBounds2;if(h&&u){const v=(u+c)/Math.abs(l+a);Zl(f,v,i,g),t.union(f),f.setValue(p.x1,p.y1,p.x2,p.y2)}if(d){const{shadowOffsetX:v=e.shadowOffsetX,shadowOffsetY:m=e.shadowOffsetY}=n,b=d/Math.abs(l+a)*2;Zl(f,b,!1,g+1),f.translate(v,m),t.union(f)}}if(this.combindShadowAABBBounds(t,o),t.empty())return;let r=!0;const s=o.transMatrix;o&&o.isContainer&&(r=!(s.a===1&&s.b===0&&s.c===0&&s.d===1&&s.e===0&&s.f===0)),r&&Qd(t,t,s)}validCheck(n,t,e,i){if(!i||n.forceBoundsHeight!=null||n.forceBoundsWidth!=null||i.shadowRoot||i.isContainer)return!0;const{visible:o=t.visible}=n;return!(!i.valid||!o)||(e.empty()||(i.parent&&e.transformWithMatrix(i.parent.globalTransMatrix),X.graphicService.clearAABBBounds(i,i.stage,e),e.clear()),!1)}updateTempAABBBounds(n){const t=this.tempAABBBounds1,e=this.tempAABBBounds2;return t.setValue(n.x1,n.y1,n.x2,n.y2),e.setValue(n.x1,n.y1,n.x2,n.y2),{tb1:t,tb2:e}}};Vu=ax([st(),dx(0,Ot(q0)),hx("design:paramtypes",[Object])],Vu);const we={x:0,y:0,z:0,lastModelMatrix:null};class vi{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach(e=>this._renderContribitions.push(e)),this._renderContribitions.length&&(this._renderContribitions.sort((e,i)=>i.order-e.order),this._beforeRenderContribitions=this._renderContribitions.filter(e=>e.time===Ut.beforeFillStroke),this._afterRenderContribitions=this._renderContribitions.filter(e=>e.time===Ut.afterFillStroke))}beforeRenderStep(t,e,i,o,r,s,l,a,h,d,u,c,g){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach(f=>{f.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(f.supportedAppName)?f.supportedAppName:[f.supportedAppName]).includes(t.stage.params.context.appName)||f.drawShape(t,e,i,o,r,s,l,a,h,d,u,c,g)})}afterRenderStep(t,e,i,o,r,s,l,a,h,d,u,c,g){this._afterRenderContribitions&&this._afterRenderContribitions.forEach(f=>{f.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(f.supportedAppName)?f.supportedAppName:[f.supportedAppName]).includes(t.stage.params.context.appName)||f.drawShape(t,e,i,o,r,s,l,a,h,d,u,c,g)})}valid(t,e,i,o){const{fill:r=e.fill,background:s,stroke:l=e.stroke,opacity:a=e.opacity,fillOpacity:h=e.fillOpacity,lineWidth:d=e.lineWidth,strokeOpacity:u=e.strokeOpacity,visible:c=e.visible}=t.attribute,g=To(a,h,r),f=Eu(a,u),p=cr(r,s),v=Cs(l,d);return!(!t.valid||!c)&&!(!p&&!v)&&!!(g||f||i||o||s)&&{fVisible:g,sVisible:f,doFill:p,doStroke:v}}transform(t,e,i,o=!1){const{x:r=e.x,y:s=e.y,z:l=e.z,scaleX:a=e.scaleX,scaleY:h=e.scaleY,angle:d=e.angle,postMatrix:u}=t.attribute,c=i.modelMatrix,g=i.camera;we.x=r,we.y=s,we.z=l,we.lastModelMatrix=c;const f=g&&(o||ux(t)),p=f?t.transMatrix.onlyTranslate()&&!u:a===1&&h===1&&d===0&&!u;if(f){const v=Le.allocate(),m=Le.allocate();lp(m,t,e),ys(v,c||v,m),we.x=0,we.y=0,we.z=0,i.modelMatrix=v,i.setTransform(1,0,0,1,0,0,!0),Le.free(m)}if(p&&!c){const v=t.getOffsetXY(e);we.x+=v.x,we.y+=v.y,we.z=l,i.setTransformForCurrent()}else if(f)we.x=0,we.y=0,we.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const v=t.getOffsetXY(e);we.x+=v.x,we.y+=v.y,this.transformWithoutTranslate(i,we.x,we.y,we.z,a,h,d)}else i.transformFromMatrix(t.transMatrix,!0),we.x=0,we.y=0,we.z=0;return we}transformUseContext2d(t,e,i,o){const r=o.camera;if(this.camera=r,r){const s=t.AABBBounds,l=s.x2-s.x1,a=s.y2-s.y1,h=o.project(0,0,i),d=o.project(l,0,i),u=o.project(l,a,i),c={x:0,y:0},g={x:l,y:0},f={x:l,y:a};o.camera=null;const p=1/(c.x*(f.y-g.y)-g.x*f.y+f.x*g.y+(g.x-f.x)*c.y),v=-(c.y*(u.x-d.x)-g.y*u.x+f.y*d.x+(g.y-f.y)*h.x)*p,m=(g.y*u.y+c.y*(d.y-u.y)-f.y*d.y+(f.y-g.y)*h.y)*p,b=(c.x*(u.x-d.x)-g.x*u.x+f.x*d.x+(g.x-f.x)*h.x)*p,w=-(g.x*u.y+c.x*(d.y-u.y)-f.x*d.y+(f.x-g.x)*h.y)*p,C=(c.x*(f.y*d.x-g.y*u.x)+c.y*(g.x*u.x-f.x*d.x)+(f.x*g.y-g.x*f.y)*h.x)*p,_=(c.x*(f.y*d.y-g.y*u.y)+c.y*(g.x*u.y-f.x*d.y)+(f.x*g.y-g.x*f.y)*h.y)*p;o.setTransform(v,m,b,w,C,_,!0)}}restoreTransformUseContext2d(t,e,i,o){this.camera&&(o.camera=this.camera)}transformWithoutTranslate(t,e,i,o,r,s,l){const a=t.project(e,i,o);t.translate(a.x,a.y,!1),t.scale(r,s,!1),t.rotate(l,!1),t.translate(-a.x,-a.y,!1),t.setTransformForCurrent()}_draw(t,e,i,o,r){const{context:s}=o;if(!s)return;const{renderable:l}=t.attribute;if(l===!1)return;s.highPerformanceSave();const a=this.transform(t,e,s,i),{x:h,y:d,z:u,lastModelMatrix:c}=a;this.z=u,ZS(t,s,h,d,o,r)||(this.drawShape(t,s,h,d,o,r),this.z=0,s.modelMatrix!==c&&Le.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}}const cx=function(){const n={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let t="";function e(C){const _=new Error(t+": "+C);throw _.source=t,_}function i(){const C=g(o);return t.length>0&&e("Invalid input not EOF"),C}function o(){return r("linear",n.linearGradient,s)||r("radial",n.radialGradient,a)||r("conic",n.conicGradient,l)}function r(C,_,y){return function(x,S){const A=b(x);if(A){b(n.startCall)||e("Missing (");const R=S(A);return b(n.endCall)||e("Missing )"),R}}(_,function(x){const S=y();return S&&(b(n.comma)||e("Missing comma before color stops")),{type:C,orientation:S,colorStops:g(f)}})}function s(){return m("directional",n.sideOrCorner,1)||m("angular",n.angleValue,1)}function l(){return m("angular",n.fromAngleValue,1)}function a(){let C,_,y=h();return y&&(C=[],C.push(y),_=t,b(n.comma)&&(y=h(),y?C.push(y):t=_)),C}function h(){let C=function(){const _=m("shape",/^(circle)/i,0);return _&&(_.style=v()||d()),_}()||function(){const _=m("shape",/^(ellipse)/i,0);return _&&(_.style=p()||d()),_}();if(C)C.at=u();else{const _=d();if(_){C=_;const y=u();y&&(C.at=y)}else{const y=c();y&&(C={type:"default-radial",at:y})}}return C}function d(){return m("extent-keyword",n.extentKeywords,1)}function u(){if(m("position",/^at/,0)){const C=c();return C||e("Missing positioning value"),C}}function c(){const C={x:p(),y:p()};if(C.x||C.y)return{type:"position",value:C}}function g(C){let _=C();const y=[];if(_)for(y.push(_);b(n.comma);)_=C(),_?y.push(_):e("One extra comma");return y}function f(){const C=m("hex",n.hexColor,1)||m("rgba",n.rgbaColor,1)||m("rgb",n.rgbColor,1)||m("literal",n.literalColor,0);return C||e("Expected color definition"),C.length=p(),C}function p(){return m("%",n.percentageValue,1)||m("position-keyword",n.positionKeywords,1)||v()}function v(){return m("px",n.pixelValue,1)||m("em",n.emValue,1)}function m(C,_,y){const x=b(_);if(x)return{type:C,value:x[y]}}function b(C){const _=/^[\n\r\t\s]+/.exec(t);_&&w(_[0].length);const y=C.exec(t);return y&&w(y[0].length),y}function w(C){t=t.substr(C)}return function(C){return t=C.toString(),i()}}();class gr{static IsGradient(t){return!(typeof t=="string"&&!t.includes("gradient"))}static IsGradientStr(t){return typeof t=="string"&&t.includes("gradient")}static Parse(t){if(gr.IsGradientStr(t))try{const e=cx(t)[0];if(e){if(e.type==="linear")return gr.ParseLinear(e);if(e.type==="radial")return gr.ParseRadial(e);if(e.type==="conic")return gr.ParseConic(e)}}catch{return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,o=oe/2,r=parseFloat(e.value)/180*oe-o;return{gradient:"conical",x:.5,y:.5,startAngle:r,endAngle:r+Gt,stops:i.map(s=>({color:s.value,offset:parseFloat(s.length.value)/100}))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map(i=>({color:i.value,offset:parseFloat(i.length.value)/100}))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,o=oe/2;let r=e.type==="angular"?parseFloat(e.value)/180*oe:0;for(;r<0;)r+=Gt;for(;r>Gt;)r-=Gt;let s=0,l=0,a=0,h=0;return r<o?(s=0,l=1,a=Math.sin(r),h=Math.cos(r)):r<oe?(s=0,l=0,a=Math.cos(r-o),h=Math.sin(r-o)):r<oe+o?(s=1,l=0,a=s-Math.sin(r-oe),h=Math.cos(r-oe)):(s=1,a=s-Math.cos(r-o-oe),h-=Math.sin(r-o-oe)),{gradient:"linear",x0:s,y0:l,x1:a,y1:h,stops:i.map(d=>({color:d.value,offset:parseFloat(d.length.value)/100}))}}}function Fn(n,t,e){let i=t;const{a:o,b:r,c:s,d:l}=n.currentMatrix,a=Math.sign(o)*Math.sqrt(o*o+r*r),h=Math.sign(l)*Math.sqrt(s*s+l*l);return a+h===0?0:(i=i/Math.abs(a+h)*2*e,i)}function ju(n,t,e,i=0,o=0){if(!t||t===!0)return"black";let r,s;if(it(t))for(let l=0;l<t.length&&(s=t[l],!s);l++);else s=t;if(s=gr.Parse(s),typeof s=="string")return s;if(e.AABBBounds&&(!e.attribute||e.attribute.scaleX!==0||e.attribute.scaleY!==0)){const l=e.AABBBounds;let a=l.x2-l.x1,h=l.y2-l.y1,d=l.x1-i,u=l.y1-o;if(e.attribute){const{scaleX:c=1,scaleY:g=1}=e.attribute;a/=c,h/=g,d/=c,u/=g}s.gradient==="linear"?r=gx(n,s,d,u,a,h):s.gradient==="conical"?r=px(n,s,d,u,a,h):s.gradient==="radial"&&(r=fx(n,s,d,u,a,h))}return r||"orange"}function gx(n,t,e,i,o,r){var s,l,a,h;const d=n.createLinearGradient(e+((s=t.x0)!==null&&s!==void 0?s:0)*o,i+((l=t.y0)!==null&&l!==void 0?l:0)*r,e+((a=t.x1)!==null&&a!==void 0?a:1)*o,i+((h=t.y1)!==null&&h!==void 0?h:0)*r);return t.stops.forEach(u=>{d.addColorStop(u.offset,u.color)}),d}function fx(n,t,e,i,o,r){var s,l,a,h,d,u;const c=n.createRadialGradient(e+((s=t.x0)!==null&&s!==void 0?s:.5)*o,i+((l=t.y0)!==null&&l!==void 0?l:.5)*r,Math.max(o,r)*((a=t.r0)!==null&&a!==void 0?a:0),e+((h=t.x1)!==null&&h!==void 0?h:.5)*o,i+((d=t.y1)!==null&&d!==void 0?d:.5)*r,Math.max(o,r)*((u=t.r1)!==null&&u!==void 0?u:.5));return t.stops.forEach(g=>{c.addColorStop(g.offset,g.color)}),c}function px(n,t,e,i,o,r){var s,l;const a=n.createConicGradient(e+((s=t.x)!==null&&s!==void 0?s:0)*o,i+((l=t.y)!==null&&l!==void 0?l:0)*r,t.startAngle,t.endAngle);return t.stops.forEach(h=>{a.addColorStop(h.offset,h.color)}),a.GetPattern(o+e,r+i,void 0)}var vx=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mx=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},ap=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};class ws{constructor(){this.time=Ut.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,o,r,s,l,a,h,d,u,c,g){var f;const{background:p,backgroundOpacity:v=(f=t.attribute.fillOpacity)!==null&&f!==void 0?f:h.backgroundOpacity,opacity:m=h.opacity,backgroundMode:b=h.backgroundMode,backgroundFit:w=h.backgroundFit}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const C=t.resources.get(p);if(C.state!=="success"||!C.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const y=Ht(t.parent).group,{scrollX:x=y.scrollX,scrollY:S=y.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(x,S)}e.clip();const _=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,o,h),e.globalAlpha=v*m,this.doDrawImage(e,C.data,_,b,w),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,o,h),e.globalAlpha=v*m,e.fillStyle=p,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,o,r){if(o==="no-repeat")t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=i.width(),l=i.height();let a=s,h=l;if(r&&o!=="repeat"&&(e.width||e.height)){const c=e.width,g=e.height;o==="repeat-x"?(a=c*(l/g),h=l):o==="repeat-y"&&(h=g*(s/c),a=s);const f=t.dpr,p=hr.allocate({width:a,height:h,dpr:f}),v=p.getContext("2d");v&&(v.inuse=!0,v.clearMatrix(),v.setTransformForCurrent(!0),v.clearRect(0,0,a,h),v.drawImage(e,0,0,a,h),e=p.nativeCanvas),hr.free(p)}const d=t.dpr,u=t.createPattern(e,o);u.setTransform&&u.setTransform(new DOMMatrix([1/d,0,0,1/d,0,0])),t.fillStyle=u,t.translate(i.x1,i.y1),t.fillRect(0,0,s,l),t.translate(-i.x1,-i.y1)}}}const Ho=new ws;let nn=class{constructor(n){this.subRenderContribitions=n,this.time=Ut.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(n,t,e,i,o,r,s,l,a,h,d,u,c){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach(g=>{g.render(n,t,e,i,o,r,s,l,a,h,d,u,c)})}};nn=vx([st(),ap(0,Ot(Me)),ap(0,Ie(Ou)),mx("design:paramtypes",[Object])],nn);class Gu{constructor(){this.time=Ut.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,o,r){const s=(t-2*e)/2,l=o.dpr,a=hr.allocate({width:t,height:t,dpr:l}),h=a.getContext("2d");if(!h)return null;h.inuse=!0,h.clearMatrix(),h.setTransformForCurrent(!0),h.clearRect(0,0,t,t),r(s,h);const d=o.createPattern(a.nativeCanvas,"repeat");return d.setTransform&&d.setTransform(new DOMMatrix([1/l,0,0,1/l,0,0])),hr.free(a),d}createCirclePattern(t,e,i,o){return this.createCommonPattern(t,e,i,o,(r,s)=>{s.fillStyle=i,s.arc(r,r,r,0,Gt),s.fill()})}createDiamondPattern(t,e,i,o){return this.createCommonPattern(t,e,i,o,(r,s)=>{const l=t/2,a=l;s.fillStyle=i,s.moveTo(l,a-r),s.lineTo(r+l,a),s.lineTo(l,a+r),s.lineTo(l-r,a),s.closePath(),s.fill()})}createRectPattern(t,e,i,o){return this.createCommonPattern(t,e,i,o,(r,s)=>{const l=e,a=l;s.fillStyle=i,s.fillRect(l,a,2*r,2*r)})}createVerticalLinePattern(t,e,i,o){return this.createCommonPattern(t,e,i,o,(r,s)=>{const l=e;s.fillStyle=i,s.fillRect(l,0,2*r,t)})}createHorizontalLinePattern(t,e,i,o){return this.createCommonPattern(t,e,i,o,(r,s)=>{const l=e;s.fillStyle=i,s.fillRect(0,l,t,2*r)})}createBiasLRLinePattern(t,e,i,o){return this.createCommonPattern(t,e,i,o,(r,s)=>{s.strokeStyle=i,s.lineWidth=r,s.moveTo(0,0),s.lineTo(t,t);const l=t/2,a=-l;s.moveTo(l,a),s.lineTo(l+t,a+t),s.moveTo(-l,-a),s.lineTo(-l+t,-a+t),s.stroke()})}createBiasRLLinePattern(t,e,i,o){return this.createCommonPattern(t,e,i,o,(r,s)=>{s.strokeStyle=i,s.lineWidth=r,s.moveTo(t,0),s.lineTo(0,t);const l=t/2,a=l;s.moveTo(t+l,a),s.lineTo(l,a+t),s.moveTo(t-l,-a),s.lineTo(-l,-a+t),s.stroke()})}createGridPattern(t,e,i,o){return this.createCommonPattern(t,e,i,o,(r,s)=>{const l=e,a=l;s.fillStyle=i,s.fillRect(l,a,r,r),s.fillRect(l+r,a+r,r,r)})}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,o,r,s,l,a,h,d,u,c,g){this.textureMap||this.initTextureMap(e,t.stage);const{texture:f=h.texture,textureColor:p=h.textureColor,textureSize:v=h.textureSize,texturePadding:m=h.texturePadding}=t.attribute;f&&this.drawTexture(f,t,e,i,o,h,p,v,m)}drawTexture(t,e,i,o,r,s,l,a,h){let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(a,h,l,i);break;case"diamond":d=this.createDiamondPattern(a,h,l,i);break;case"rect":d=this.createRectPattern(a,h,l,i);break;case"vertical-line":d=this.createVerticalLinePattern(a,h,l,i);break;case"horizontal-line":d=this.createHorizontalLinePattern(a,h,l,i);break;case"bias-lr":d=this.createBiasLRLinePattern(a,h,l,i);break;case"bias-rl":d=this.createBiasRLLinePattern(a,h,l,i);break;case"grid":d=this.createGridPattern(a,h,l,i)}d&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,o,r,s),i.fillStyle=d,i.fill(),i.highPerformanceRestore())}}const fr=new Gu;class bx{constructor(){this.time=Ut.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,o,r,s,l,a,h,d,u,c){const{outerBorder:g,innerBorder:f}=t.attribute,p=g&&g.visible!==!1,v=f&&f.visible!==!1;if(!p&&!v)return;const{innerPadding:m=h.innerPadding,outerPadding:b=h.outerPadding,startAngle:w=h.startAngle,endAngle:C=h.endAngle,opacity:_=h.opacity,x:y=h.x,y:x=h.y,scaleX:S=h.scaleX,scaleY:A=h.scaleY}=t.attribute;let{innerRadius:R=h.innerRadius,outerRadius:T=h.outerRadius}=t.attribute;T+=b,R-=m;const M=(P,k)=>{const B=!(!P||!P.stroke),{distance:H=h[k].distance}=P,E=Fn(e,H,e.dpr),F=H/T,L=k==="outerBorder"?1:-1;if(t.setAttributes({outerRadius:T+L*E,innerRadius:R-L*E,startAngle:w-L*F,endAngle:C+L*F}),e.beginPath(),Lu(t,e,i,o,T+L*E,R-L*E),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,P,h[k]);else if(B){const z=h[k].opacity;h[k].opacity=_,e.setStrokeStyle(t,P,(y-i)/S,(x-o)/A,h[k]),h[k].opacity=z,e.stroke()}};p&&M(g,"outerBorder"),v&&M(f,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:R,startAngle:w,endAngle:C})}}const Cx=new bx,_x=fr,yx=Ho;class wx{constructor(){this.time=Ut.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,o,r,s,l,a,h,d,u,c){const{outerBorder:g,innerBorder:f}=t.attribute,p=g&&g.visible!==!1,v=f&&f.visible!==!1;if(!p&&!v)return;const{radius:m=h.radius,startAngle:b=h.startAngle,endAngle:w=h.endAngle,opacity:C=h.opacity,x:_=h.x,y=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,A=(R,T)=>{const M=!(!R||!R.stroke),{distance:P=h[T].distance}=R,k=Fn(e,P,e.dpr),B=T==="outerBorder"?1:-1;if(e.beginPath(),e.arc(i,o,m+B*k,b,w),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,R,h[T]);else if(M){const H=h[T].opacity;h[T].opacity=C,e.setStrokeStyle(t,R,(_-i)/x,(y-o)/S,h[T]),h[T].opacity=H,e.stroke()}};p&&A(g,"outerBorder"),v&&A(f,"innerBorder")}}const Sx=new wx,xx=fr,Ax=Ho;class Rx extends ws{constructor(){super(...arguments),this.time=Ut.beforeFillStroke}drawShape(t,e,i,o,r,s,l,a,h,d,u,c){const{background:g,backgroundMode:f=h.backgroundMode,backgroundFit:p=h.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const v=t.resources.get(g);if(v.state!=="success"||!v.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const m=t.AABBBounds;this.doDrawImage(e,v.data,m,f,p),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=g,e.fill(),e.highPerformanceRestore()}}const Tx=new Rx,la=oe/2;function on(n,t,e,i,o,r,s){let l;if(i<0&&(t+=i,i=-i),o<0&&(e+=o,o=-o),nt(r,!0))l=[r=Jt(r),r,r,r];else if(Array.isArray(r)){const y=r;let x,S;switch(y.length){case 0:l=[0,0,0,0];break;case 1:x=Jt(y[0]),l=[x,x,x,x];break;case 2:case 3:x=Jt(y[0]),S=Jt(y[1]),l=[x,S,x,S];break;default:l=y,l[0]=Jt(l[0]),l[1]=Jt(l[1]),l[2]=Jt(l[2]),l[3]=Jt(l[3])}}else l=[0,0,0,0];if(i<0||l[0]+l[1]+l[2]+l[3]<1e-12)return n.rect(t,e,i,o);const[a,h,d,u]=[[t,e],[t+i,e],[t+i,e+o],[t,e+o]],c=Math.min(i/2,o/2),g=[Math.min(c,l[0]),Math.min(c,l[1]),Math.min(c,l[2]),Math.min(c,l[3])],f=[a[0]+g[0],a[1]],p=[a[0],a[1]+g[0]],v=[h[0]-g[1],h[1]],m=[h[0],h[1]+g[1]],b=[d[0]-g[2],d[1]],w=[d[0],d[1]-g[2]],C=[u[0]+g[3],u[1]],_=[u[0],u[1]-g[3]];if(n.moveTo(f[0],f[1]),s&&s[0]?s[0](f[0],f[1],v[0],v[1]):n.lineTo(v[0],v[1]),!is(v,m)){s&&s[0]&&n.moveTo(v[0],v[1]);const y=v[0],x=v[1]+g[1];n.arc(y,x,g[1],-la,0,!1)}if(s&&s[1]?s[1](m[0],m[1],w[0],w[1]):n.lineTo(w[0],w[1]),!is(b,w)){const y=w[0]-g[2],x=w[1];s&&s[1]&&n.moveTo(w[0],w[1]),n.arc(y,x,g[2],0,la,!1)}if(s&&s[2]?s[2](b[0],b[1],C[0],C[1]):n.lineTo(C[0],C[1]),!is(C,_)){const y=C[0],x=C[1]-g[3];s&&s[2]&&n.moveTo(C[0],C[1]),n.arc(y,x,g[3],la,oe,!1)}if(s&&s[3]?s[3](_[0],_[1],p[0],p[1]):n.lineTo(p[0],p[1]),!is(f,p)){const y=f[0],x=f[1]+g[0];s&&s[3]&&n.moveTo(p[0],p[1]),n.arc(y,x,g[0],oe,oe+la,!1)}return!s&&n.closePath(),n}var hp=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s};class dp{constructor(){this.time=Ut.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,o,r,s,l,a,h,d,u,c){const{outerBorder:g,innerBorder:f}=t.attribute,p=g&&g.visible!==!1,v=f&&f.visible!==!1;if(!p&&!v)return;const{cornerRadius:m=h.cornerRadius,opacity:b=h.opacity,x:w=h.x,y:C=h.y,scaleX:_=h.scaleX,scaleY:y=h.scaleY,x1:x,y1:S}=t.attribute;let{width:A,height:R}=t.attribute;A=(A??x-i)||0,R=(R??S-o)||0;const T=(M,P)=>{const k=!(!M||!M.stroke),B=P==="outerBorder"?-1:1,{distance:H=h[P].distance}=M,E=Fn(e,H,e.dpr),F=i+B*E,L=o+B*E,z=2*E;if(m===0||it(m)&&m.every(D=>D===0)?(e.beginPath(),e.rect(F,L,A-B*z,R-B*z)):(e.beginPath(),on(e,F,L,A-B*z,R-B*z,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,M,h[P]);else if(k){const D=h[P].opacity;h[P].opacity=b,e.setStrokeStyle(t,M,(w-i)/_,(C-o)/y,h[P]),h[P].opacity=D,e.stroke()}};p&&T(g,"outerBorder"),v&&T(f,"innerBorder")}}let pr=class{constructor(){this.time=Ut.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,o,r,s,l,a,h,d,u,c,g){const{stroke:f=h.stroke}=t.attribute;Array.isArray(f)&&f.some(p=>p===!1)&&(g.doStroke=!1)}};pr=hp([st()],pr);let vr=class{constructor(){this.time=Ut.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,o,r,s,l,a,h,d,u,c){const{x1:g,y1:f,x:p=h.x,y:v=h.y,stroke:m=h.stroke,cornerRadius:b=h.cornerRadius}=t.attribute;let{width:w,height:C}=t.attribute;if(w=(w??g-p)||0,C=(C??f-v)||0,Array.isArray(m)&&m.some(_=>_===!1)){if(e.setStrokeStyle(t,t.attribute,i,o,h),!(b===0||it(b)&&b.every(_=>_===0))){let _,y=0;return on(e,i,o,w,C,b,new Array(4).fill(0).map((x,S)=>(A,R,T,M)=>{m[S]&&(y===S-1&&m[S]===_||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[S]}),i,o,h),e.beginPath(),e.moveTo(A,R),_=m[S]),y=S,e.lineTo(T,M),e.stroke(),S===3&&e.beginPath())})),void e.stroke()}if(e.beginPath(),e.moveTo(i,o),m[0]?e.lineTo(i+w,o):e.moveTo(i+w,o),m[1]?e.lineTo(i+w,o+C):e.moveTo(i+w,o+C),m[2]?e.lineTo(i,o+C):e.moveTo(i,o+C),m[3]){const _=m[0]?o-e.lineWidth/2:o;e.lineTo(i,_)}else e.moveTo(i,o);e.stroke()}}};vr=hp([st()],vr);const Mx=new dp,Bx=fr,Px=Ho;class Hx extends ws{constructor(){super(...arguments),this.time=Ut.beforeFillStroke}drawShape(t,e,i,o,r,s,l,a,h,d,u,c){const{background:g,backgroundMode:f=h.backgroundMode,backgroundFit:p=h.backgroundFit}=t.attribute;if(g)if(t.backgroundImg){const v=t.resources.get(g);if(v.state!=="success"||!v.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const b=Ht(t.parent).group,{scrollX:w=b.scrollX,scrollY:C=b.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(w,C)}const m=t.AABBBounds;this.doDrawImage(e,v.data,m,f,p),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if($t(g)){const{stroke:v,fill:m,lineWidth:b=1,cornerRadius:w=0,expandX:C=0,expandY:_=0}=g;if(!v&&!m)return;e.beginPath();const{x:y,y:x,width:S,height:A}=Ex(t);w?on(e,y-C,x-_,S+2*C,A+2*_,w):e.rect(y-C,x-_,S+2*C,A+2*_),e.globalAlpha=1,m&&(e.fillStyle=m,e.fill()),v&&b>0&&(e.lineWidth=b,e.strokeStyle=v,e.stroke())}else{e.beginPath();const v=t.AABBBounds;e.rect(i,o,v.width(),v.height()),e.fillStyle=g,e.globalAlpha=1,e.fill()}}}function Ex(n){const t=gs(n.attribute.boundsPadding),e=n.AABBBounds;let i=e.x1,o=e.y1,r=e.width(),s=e.height();return nt(t)?(i+=t,o+=t,r-=2*t,s-=2*t):(i+=t[3],o+=t[0],r-=t[1]+t[3],s-=t[0]+t[2]),{x:i,y:o,width:r,height:s}}class Lx extends dp{constructor(){super(...arguments),this.time=Ut.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,o,r,s,l,a,h,d,u,c){if(!(t.isGifImage&&t.renderFrame&&t.playing))return super.drawShape(t,e,i,o,r,s,l,a,h,d,u,c);t.renderFrame(e,i,o)}}const Fx=new Lx,kx=new Hx;class Ix{constructor(){this.time=Ut.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,o,r,s,l,a,h,d,u,c){const g=t.getParsedPath();if(!g)return;const{outerBorder:f,innerBorder:p}=t.attribute,v=f&&f.visible!==!1,m=p&&p.visible!==!1;if(!v&&!m)return;const{size:b=h.size,opacity:w=h.opacity,x:C=h.x,y:_=h.y,scaleX:y=h.scaleX,scaleY:x=h.scaleY}=t.attribute,S=(A,R)=>{const T=!(!A||!A.stroke),{distance:M=h[R].distance}=A,P=Fn(e,M,e.dpr),k=R==="outerBorder"?1:-1;if(e.beginPath(),g.drawOffset(e,b,i,o,k*P)===!1&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),c)c(e,A,h[R]);else if(T){const B=h[R].opacity;h[R].opacity=w,e.setStrokeStyle(t,A,(C-i)/y,(_-o)/x,h[R]),h[R].opacity=B,e.stroke()}};v&&S(f,"outerBorder"),m&&S(p,"innerBorder")}}const zx=new Ix,Dx=fr,Ox=Ho;class Wx extends Gu{constructor(){super(...arguments),this.time=Ut.afterFillStroke}drawShape(t,e,i,o,r,s,l,a,h,d,u,c,g){var f,p,v,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:b=t.attribute}=g||{},{texture:w=(f=t.attribute.texture)!==null&&f!==void 0?f:$l(h,"texture"),textureColor:C=(p=t.attribute.textureColor)!==null&&p!==void 0?p:$l(h,"textureColor"),textureSize:_=(v=t.attribute.textureSize)!==null&&v!==void 0?v:$l(h,"textureSize"),texturePadding:y=(m=t.attribute.texturePadding)!==null&&m!==void 0?m:$l(h,"texturePadding")}=b;w&&this.drawTexture(w,t,e,i,o,h,C,_,y)}}var Nx=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Vx=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},up=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let aa=class extends vi{constructor(n){super(),this.arcRenderContribitions=n,this.numberType=Jl,this.builtinContributions=[Cx,yx,_x],this.init(n)}drawArcTailCapPath(n,t,e,i,o,r,s,l){const a=l-s,h=n.getParsedAngle(),d=h.startAngle;let u=h.endAngle;u=l;const c=u>d;let g=!1;if(o<r){const E=o;o=r,r=E}const{outerDeltaAngle:f,xors:p,yors:v,xirs:m,yirs:b,limitedOcr:w,outerCornerRadiusStart:C,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:x,yore:S,xire:A,yire:R,limitedIcr:T,innerDeltaAngle:M,innerStartAngle:P,innerCornerRadiusStart:k,innerCornerRadiusEnd:B,maxInnerCornerRadius:H}=op(n,d,u,r,o);if(w>ae){const E=ii(C,w),F=ii(_,w),L=to(m,b,p,v,o,E,Number(c)),z=to(x,S,A,R,o,F,Number(c));if(w<y&&E===F)t.moveTo(e+L.cx+L.x01,i+L.cy+L.y01),t.arc(e+L.cx,i+L.cy,w,Xt(L.y01,L.x01),Xt(z.y01,z.x01),!c);else{const D=u-a-.03,N=Xt(z.y11,z.x11);t.arc(e,i,o,D,N,!c),F>0&&t.arc(e+z.cx,i+z.cy,F,Xt(z.y11,z.x11),Xt(z.y01,z.x01),!c)}}else t.moveTo(e+p,i+v);if(!(r>ae)||M<.001)t.lineTo(e+A,i+R),g=!0;else if(T>ae){const E=ii(k,T),F=ii(B,T),L=to(A,R,x,S,r,-F,Number(c)),z=to(p,v,m,b,r,-E,Number(c));if(t.lineTo(e+L.cx+L.x01,i+L.cy+L.y01),T<H&&E===F){const D=Xt(z.y01,z.x01);t.arc(e+L.cx,i+L.cy,T,Xt(L.y01,L.x01),D,!c)}else{F>0&&t.arc(e+L.cx,i+L.cy,F,Xt(L.y01,L.x01),Xt(L.y11,L.x11),!c);const D=Xt(L.cy+L.y11,L.cx+L.x11),N=u-a-.03;t.arc(e,i,r,D,N,c)}}else t.lineTo(e+r*Pe(P),i+r*pe(P));return g}drawShape(n,t,e,i,o,r,s,l){const a=Ht(n,r==null?void 0:r.theme).arc,{fill:h=a.fill,stroke:d=a.stroke,x:u=a.x,y:c=a.y,fillStrokeOrder:g=a.fillStrokeOrder}=n.attribute,f=this.valid(n,a,s,l);if(!f)return;const{fVisible:p,sVisible:v,doFill:m,doStroke:b}=f,{outerPadding:w=a.outerPadding,innerPadding:C=a.innerPadding,cap:_=a.cap,forceShowCap:y=a.forceShowCap}=n.attribute;let{outerRadius:x=a.outerRadius,innerRadius:S=a.innerRadius}=n.attribute;x+=w,S-=C;let A=0;const R=(ze(_)&&_||_[0])&&h.gradient==="conical";if(R){const{sc:k,startAngle:B,endAngle:H}=n.getParsedAngle();Jt(H-B)<Gt-ae&&(A=k||0,h.startAngle-=A,h.endAngle-=A)}let T=!1;const{isFullStroke:M,stroke:P}=yS(d);if(m||M){t.beginPath(),Lu(n,t,e,i,x,S),T=!0,t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,a),this.beforeRenderStep(n,t,e,i,m,b,p,v,a,o,s,l);const k=()=>{m&&(s?s(t,n.attribute,a):p&&(t.setCommonStyle(n,n.attribute,u-e,c-i,a),t.fill()))},B=()=>{b&&M&&(l?l(t,n.attribute,a):v&&(t.setStrokeStyle(n,n.attribute,u-e,c-i,a),t.stroke()))};g?(B(),k()):(k(),B())}if(!M&&b&&(t.beginPath(),Lu(n,t,e,i,x,S,P),T||this.beforeRenderStep(n,t,e,i,m,b,p,v,a,o,s,l),l?l(t,n.attribute,a):v&&(t.setStrokeStyle(n,n.attribute,e,i,a),t.stroke())),(ze(_)&&_||_[1])&&y){const{startAngle:k,endAngle:B}=n.getParsedAngle();if(Jt(B-k)>=Gt-ae){t.beginPath();const H=Math.abs(x-S)/2/x,{endAngle:E=a.endAngle,fill:F=a.fill}=n.attribute,L=E;this.drawArcTailCapPath(n,t,e,i,x,S,L,L+H),T||this.beforeRenderStep(n,t,e,i,m,b,p,v,a,o,s,l);const z=()=>{if(m){const N=F;if(N.gradient==="conical"){const V=QS(0,0,E,N);s||To&&(t.setCommonStyle(n,n.attribute,e,i,a),t.fillStyle=V,t.fill())}}},D=()=>{b&&(l||v&&(t.setStrokeStyle(n,n.attribute,e,i,a),t.stroke()))};z(),D()}}this.afterRenderStep(n,t,e,i,m,b,p,v,a,o,s,l),R&&(h.startAngle+=A,h.endAngle+=A)}draw(n,t,e,i){const o=Ht(n,i==null?void 0:i.theme).arc;this._draw(n,o,!1,e,i)}};aa=Nx([st(),up(0,Ot(Me)),up(0,Ie(Fu)),Vx("design:paramtypes",[Object])],aa);var jx=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Gx=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},cp=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let ha=class extends vi{constructor(n){super(),this.circleRenderContribitions=n,this.numberType=Ql,this.builtinContributions=[Sx,Ax,xx],this.init(n)}drawShape(n,t,e,i,o,r,s,l){const a=Ht(n,r==null?void 0:r.theme).circle,{radius:h=a.radius,startAngle:d=a.startAngle,endAngle:u=a.endAngle,x:c=a.x,y:g=a.y,fillStrokeOrder:f=a.fillStrokeOrder}=n.attribute,p=this.valid(n,a,s,l);if(!p)return;const{fVisible:v,sVisible:m,doFill:b,doStroke:w}=p;t.beginPath(),t.arc(e,i,h,d,u),t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,a),this.beforeRenderStep(n,t,e,i,b,w,v,m,a,o,s,l);const C=()=>{b&&(s?s(t,n.attribute,a):v&&(t.setCommonStyle(n,n.attribute,c-e,g-i,a),t.fill()))},_=()=>{w&&(l?l(t,n.attribute,a):m&&(t.setStrokeStyle(n,n.attribute,c-e,g-i,a),t.stroke()))};f?(_(),C()):(C(),_()),this.afterRenderStep(n,t,e,i,b,w,v,m,a,o,s,l)}draw(n,t,e,i){const o=Ht(n,i==null?void 0:i.theme).circle;this._draw(n,o,!1,e,i)}};ha=jx([st(),cp(0,Ot(Me)),cp(0,Ie(ku)),Gx("design:paramtypes",[Object])],ha);function da(n,t,e,i){if(!t.p1)return;const{offsetX:o=0,offsetY:r=0,offsetZ:s=0}=i||{};if(e===1)t.p2&&t.p3?n.bezierCurveTo(o+t.p1.x,r+t.p1.y,o+t.p2.x,r+t.p2.y,o+t.p3.x,r+t.p3.y,s):n.lineTo(o+t.p1.x,r+t.p1.y,s);else if(t.p2&&t.p3){const[l]=lu(t,e);n.bezierCurveTo(o+l.p1.x,r+l.p1.y,o+l.p2.x,r+l.p2.y,o+l.p3.x,r+l.p3.y,s)}else{const l=t.getPointAt(e);n.lineTo(o+l.x,r+l.y,s)}}function gp(n,t,e,i,o,r,s){var l;let a=t.p0,h=i;if(e&&e.originP1===e.originP2&&(a=e.p0),t.defined)i||(n.lineTo(a.x+o,a.y+r,s),h=!i);else{const{originP1:d,originP2:u}=t;let c;if(d&&d.defined!==!1?c=a:d&&u.defined!==!1&&(c=(l=t.p3)!==null&&l!==void 0?l:t.p1),i){h=!i;const g=c?c.x:t.p0.x,f=c?c.y:t.p0.y;n.moveTo(g+o,f+r,s)}else c&&(h=!i,n.lineTo(c.x+o,c.y+r,s))}return h}function Uu(n,t,e,i,o){const{offsetX:r=0,offsetY:s=0,offsetZ:l=0,mode:a="none",drawConnect:h=!1}=o||{};if(h&&a==="none"||!t)return;let d=!0;const{curves:u}=t;if(e>=1){if(h){let m,b=!0;u.forEach((w,C)=>{w.originP1!==w.originP2&&(b=gp(n,w,m,b,r,s,l)),m=w})}else u.forEach(m=>{m.defined?(d&&n.moveTo(m.p0.x+r,m.p0.y+s,l),da(n,m,1,o),d=!1):d=!0});return}if(e<=0)return;let c;i==="x"?c=re.ROW:i==="y"?c=re.COLUMN:i==="auto"&&(c=t.direction);const g=e*t.tryUpdateLength(c);let f=0,p=!0,v=null;for(let m=0,b=u.length;m<b;m++){const w=u[m],C=w.getLength(c),_=(g-f)/C;if(f+=C,_<0)break;if(h){if(w.originP1===w.originP2){v=w;continue}p=gp(n,w,v,p,r,s,l),v=w}else{if(!w.defined){d=!0;continue}d&&n.moveTo(w.p0.x+r,w.p0.y+s,l),da(n,w,ii(_,1),o),d=!1}}}function Ux(n,t,e,i){const{offsetX:o=0,offsetY:r=0}=i||{},s=t?t.points[t.points.length-1]:e.points[0];n.moveTo(s.x+o,s.y+r),e.points.forEach(l=>{l.defined!==!1?n.lineTo(l.x+o,l.y+r):n.moveTo(l.x+o,l.y+r)})}function Kx(n,t,e,i){const{offsetX:o=0,offsetY:r=0}=i||{},{points:s}=e,l=[];for(let a=0;a<s.length;a++)s[a].defined;l.push(s),l.forEach((a,h)=>{var d,u,c,g;const f=t&&h===0?t.points[t.points.length-1]:a[0];n.moveTo(f.x+o,f.y+r),a.forEach(p=>{p.defined!==!1?n.lineTo(p.x+o,p.y+r):n.moveTo(p.x+o,p.y+r)});for(let p=a.length-1;p>=0;p--){const v=a[p];n.lineTo((d=v.x1)!==null&&d!==void 0?d:v.x,(u=v.y1)!==null&&u!==void 0?u:v.y)}n.lineTo((c=f.x1)!==null&&c!==void 0?c:f.x,(g=f.y1)!==null&&g!==void 0?g:f.y),n.closePath()})}var $x=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s};let Ss=class extends vi{constructor(){super(...arguments),this.numberType=vs}draw(n,t,e,i){const o=Ht(n,i==null?void 0:i.theme).line;this._draw(n,o,!1,e,i)}drawSegmentItem(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f){var p,v,m,b,w;if(!t)return;n.beginPath();const C=(p=this.z)!==null&&p!==void 0?p:0;Uu(n.camera?n:n.nativeContext,t,a,h,{offsetX:d,offsetY:u,offsetZ:C}),c.cache&&!it(c.cache)&&c.cache.curves.every(T=>T.defined)&&c.attribute.curveType&&c.attribute.curveType.includes("Closed")&&n.closePath(),n.setShadowBlendStyle&&n.setShadowBlendStyle(c,s,l);const{x:_=0,x:y=0}=s;e!==!1&&(g?g(n,s,l):o&&(n.setCommonStyle(c,s,_-d,y-u,l),n.fill())),i!==!1&&(f?f(n,s,l):r&&(n.setStrokeStyle(c,s,_-d,y-u,l),n.stroke()));let{connectedType:x,connectedX:S,connectedY:A,connectedStyle:R}=s;if(it(l)?(x=(v=x??l[0].connectedType)!==null&&v!==void 0?v:l[1].connectedType,S=(m=S??l[0].connectedX)!==null&&m!==void 0?m:l[1].connectedX,A=(b=A??l[0].connectedY)!==null&&b!==void 0?b:l[1].connectedY,R=(w=R??l[0].connectedStyle)!==null&&w!==void 0?w:l[1].connectedStyle):(x=x??l.connectedType,S=S??l.connectedX,A=A??l.connectedY,R=R??l.connectedStyle),x!=="connect"&&x!=="zero"&&(x="none"),x!=="none"){n.beginPath(),Uu(n.camera?n:n.nativeContext,t,a,h,{offsetX:d,offsetY:u,offsetZ:C,drawConnect:!0,mode:x,zeroX:S,zeroY:A});const T=[];it(l)?l.forEach(M=>T.push(M)):T.push(l),T.push(s),e!==!1&&(g?g(n,s,l):o&&(n.setCommonStyle(c,R,_-d,y-u,T),n.fill())),i!==!1&&(f?f(n,s,l):r&&(n.setStrokeStyle(c,R,_-d,y-u,T),n.stroke()))}return!1}drawLinearLineHighPerformance(n,t,e,i,o,r,s,l,a,h,d,u,c){var g;t.beginPath();const f=(g=this.z)!==null&&g!==void 0?g:0,{points:p}=n.attribute,v=p[0];t.moveTo(v.x+s,v.y+l,f);for(let w=1;w<p.length;w++){const C=p[w];t.lineTo(C.x+s,C.y+l,f)}t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,a);const{x:m=0,x:b=0}=n.attribute;e!==!1&&(u?u(t,n.attribute,a):o&&(t.setCommonStyle(n,n.attribute,m-s,b-l,a),t.fill())),i!==!1&&(c?c(t,n.attribute,a):r&&(t.setStrokeStyle(n,n.attribute,m-s,b-l,a),t.stroke()))}drawShape(n,t,e,i,o,r,s,l){const a=Ht(n,r==null?void 0:r.theme).line,{fill:h=a.fill,stroke:d=a.stroke,fillOpacity:u=a.fillOpacity,strokeOpacity:c=a.strokeOpacity,segments:g,points:f,closePath:p,curveTension:v=a.curveTension}=n.attribute;if(!this.valid(n,a,s,l))return;let{curveType:m=a.curveType}=n.attribute;p&&m==="linear"&&(m="linearClosed");const{clipRange:b=a.clipRange,clipRangeByDimension:w=a.clipRangeByDimension}=n.attribute;if(b===1&&!g&&!f.some(C=>C.defined===!1)&&m==="linear")return this.drawLinearLineHighPerformance(n,t,!!h,!!d,u,c,e,i,a,o,r,s,l);if(n.shouldUpdateShape()){const{points:C,segments:_}=n.attribute,y=C;if(_&&_.length){let x,S;if(n.cache=_.map((A,R)=>{if(A.points.length<=1&&R===0)return A.points[0]&&(S={endX:A.points[0].x,endY:A.points[0].y,curves:[{defined:A.points[0].defined!==!1}]}),null;R===1?x={x:S.endX,y:S.endY,defined:S.curves[S.curves.length-1].defined}:R>1&&(x.x=S.endX,x.y=S.endY,x.defined=S.curves[S.curves.length-1].defined);const T=xo(A.points,m,{startPoint:x,curveTension:v});return S=T,T}).filter(A=>!!A),m==="linearClosed"){let A;for(let R=0;R<n.cache.length;R++){const T=n.cache[R];for(let M=0;M<T.curves.length;M++)if(T.curves[M].defined){A=T.curves[M].p0;break}if(A)break}n.cache[n.cache.length-1]&&n.cache[n.cache.length-1].lineTo(A.x,A.y,!0)}}else{if(!C||!C.length)return n.cache=null,void n.clearUpdateShapeTag();n.cache=xo(y,m,{curveTension:v})}n.clearUpdateShapeTag()}if(Array.isArray(n.cache)){const C=n.attribute.segments.filter(_=>_.points.length);if(C[0].points.length===1&&C.shift(),b===1){let _=!1;n.cache.forEach((y,x)=>{_||(_=this.drawSegmentItem(t,y,!!h,!!d,u,c,C[x],[a,n.attribute],b,w,e,i,n,s,l))})}else{const _=n.cache.reduce((A,R)=>A+R.getLength(),0),y=b*_;let x=0,S=!1;n.cache.forEach((A,R)=>{if(S)return;const T=A.getLength(),M=(y-x)/T;x+=T,M>0&&(S=this.drawSegmentItem(t,A,!!h,!!d,u,c,C[R],[a,n.attribute],ii(M,1),w,e,i,n,s,l))})}}else this.drawSegmentItem(t,n.cache,!!h,!!d,u,c,n.attribute,a,b,w,e,i,n,s,l)}};Ss=$x([st()],Ss);function Yx(n,t,e,i){var o;const{drawConnect:r=!1,mode:s="none"}=i||{};if(r&&s==="none")return;const{top:l,bottom:a}=t;if(l.curves.length!==a.curves.length)return;if(e>=1){const y=[],x=[];let S=!0;if(r){let A,R,T=!0;const M=l.curves.length;l.curves.forEach((P,k)=>{const B=a.curves[M-k-1];let H=P,E=B;if(P.originP1===P.originP2)return A=P,void(R=B);if(A&&A.originP1===A.originP2&&(H=A,E=R),P.defined)T||(y.push(H),x.push(E),mr(n,y,x,i),y.length=0,x.length=0,T=!T);else{const{originP1:F,originP2:L}=P;let z,D;F&&F.defined!==!1?(z=H,D=E):F&&L.defined!==!1&&(z=P,D=B),T?(T=!T,y.push(z||P),x.push(D||B)):z&&(T=!T,y.push(z||P),x.push(D||B),mr(n,y,x,i),y.length=0,x.length=0)}A=P}),mr(n,y,x,i)}else{for(let A=0,R=l.curves.length;A<R;A++){const T=l.curves[A];S!==T.defined?(S?(ua(n,y,x,i),y.length=0,x.length=0):(y.push(T),x.push(a.curves[R-A-1])),S=!S):S&&(y.push(T),x.push(a.curves[R-A-1]))}ua(n,y,x,i)}return}if(e<=0)return;let{direction:h}=i||{};const{curves:d}=l,u=(o=d[d.length-1].p3)!==null&&o!==void 0?o:d[d.length-1].p1,c=Jt(u.x-d[0].p0.x),g=Jt(u.y-d[0].p0.y);h=h??(c>g?re.ROW:re.COLUMN),Number.isFinite(c)||(h=re.COLUMN),Number.isFinite(g)||(h=re.ROW);const f=e*(h===re.ROW?c:g);let p=0,v=!0;const m=[],b=[];let w,C,_=!0;for(let y=0,x=l.curves.length;y<x;y++){const S=l.curves[y],A=S.getLength(h),R=(f-p)/A;if(R<0)break;if(p+=A,r){const T=a.curves[x-y-1];let M=S,P=T;if(S.originP1===S.originP2){w=S,C=T;continue}if(w&&w.originP1===w.originP2&&(M=w,P=C),S.defined)_||(m.push(M),b.push(P),mr(n,m,b,i),m.length=0,b.length=0,_=!_);else{const{originP1:k,originP2:B}=S;let H,E;k&&k.defined!==!1?(H=M,E=P):k&&B.defined!==!1&&(H=S,E=T),_?(_=!_,m.push(H||S),b.push(E||T)):H&&(_=!_,m.push(H||S),b.push(E||T),mr(n,m,b,i),m.length=0,b.length=0)}w=S}else{let T=null,M=null;v!==S.defined?(v?(ua(n,m,b,i),m.length=0,b.length=0):(T=S,M=a.curves[x-y-1]),v=!v):v&&(T=S,M=a.curves[x-y-1]),T&&M&&(R<1&&(T=T.p2&&T.p3?lu(T,R)[0]:n0(T,R)[0],M=M.p2&&M.p3?lu(M,1-R)[1]:n0(M,1-R)[1]),T.defined=v,M.defined=v,m.push(T),b.push(M)),T=null,M=null}}r?mr(n,m,b,i):ua(n,m,b,i)}function mr(n,t,e,i){if(t.length<2)return;const{offsetX:o=0,offsetY:r=0,offsetZ:s=0,mode:l}=i||{};let a=t[0];n.moveTo(a.p0.x+o,a.p0.y+r,s),a=t[t.length-1];let h=a.p3||a.p1;n.lineTo(h.x+o,h.y+r,s),a=e[e.length-1],n.lineTo(a.p0.x+o,a.p0.y+r,s),a=e[0],h=a.p3||a.p1,n.lineTo(h.x+o,h.y+r,s),n.closePath()}function ua(n,t,e,i){const{offsetX:o=0,offsetY:r=0,offsetZ:s=0}=i||{};let l=!0;t.forEach(a=>{a.defined?(l&&n.moveTo(a.p0.x+o,a.p0.y+r,s),da(n,a,1,i),l=!1):l=!0}),l=!0;for(let a=e.length-1;a>=0;a--){const h=e[a];h.defined?(l&&n.lineTo(h.p0.x+o,h.p0.y+r,s),da(n,h,1,i),l=!1):l=!0}n.closePath()}const Xx=new Wx,qx=Ho;var Zx=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Jx=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},fp=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let Ku=class extends vi{constructor(n){super(),this.areaRenderContribitions=n,this.numberType=Y0,this.builtinContributions=[Xx,qx],this.init(n)}drawLinearAreaHighPerformance(n,t,e,i,o,r,s,l,a,h,d,u,c){var g,f,p;const{points:v}=n.attribute;if(v.length<2)return;t.beginPath();const m=(g=this.z)!==null&&g!==void 0?g:0,b=v[0];t.moveTo(b.x+s,b.y+l,m);for(let _=1;_<v.length;_++){const y=v[_];t.lineTo(y.x+s,y.y+l,m)}for(let _=v.length-1;_>=0;_--){const y=v[_];t.lineTo(((f=y.x1)!==null&&f!==void 0?f:y.x)+s,((p=y.y1)!==null&&p!==void 0?p:y.y)+l,m)}t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,a),this.beforeRenderStep(n,t,s,l,!!o,!1,e,!1,a,h,u,null,{attribute:n.attribute});const{x:w=0,x:C=0}=n.attribute;e!==!1&&(u?u(t,n.attribute,a):o&&(t.setCommonStyle(n,n.attribute,w-s,C-l,a),t.fill())),this.afterRenderStep(n,t,s,l,!!o,!1,e,!1,a,h,u,null,{attribute:n.attribute}),(()=>{var _,y;if(i){const{stroke:x=a&&a.stroke}=n.attribute;if(it(x)&&(x[0]||x[2])&&x[1]===!1){if(t.beginPath(),x[0]){t.moveTo(b.x+s,b.y+l,m);for(let S=1;S<v.length;S++){const A=v[S];t.lineTo(A.x+s,A.y+l,m)}}else if(x[2]){const S=v[v.length-1];t.moveTo(S.x+s,S.y+l,m);for(let A=v.length-2;A>=0;A--){const R=v[A];t.lineTo(((_=R.x1)!==null&&_!==void 0?_:R.x)+s,((y=R.y1)!==null&&y!==void 0?y:R.y)+l,m)}}}c?c(t,n.attribute,a):(t.setStrokeStyle(n,n.attribute,w-s,C-l,a),t.stroke())}})()}drawShape(n,t,e,i,o,r,s,l){var a,h,d,u,c,g;const f=Ht(n,r==null?void 0:r.theme).area,{fill:p=f.fill,stroke:v=f.stroke,fillOpacity:m=f.fillOpacity,z:b=f.z,strokeOpacity:w=f.strokeOpacity,curveTension:C=f.curveTension}=n.attribute,_=this.valid(n,f,s,l);if(!_)return;const{doFill:y}=_,x=_.doStroke&&_.sVisible,{clipRange:S=f.clipRange,closePath:A,points:R,segments:T}=n.attribute;let{curveType:M=f.curveType}=n.attribute;if(A&&M==="linear"&&(M="linearClosed"),S===1&&!T&&!R.some(P=>P.defined===!1)&&M==="linear")return this.drawLinearAreaHighPerformance(n,t,!!p,x,m,w,e,i,f,o,r,s,l);if(n.shouldUpdateShape()){if(T&&T.length){let P,k;const B=T.map((F,L)=>{if(F.points.length<=1&&L===0)return F.points[0]&&(k={endX:F.points[0].x,endY:F.points[0].y}),null;L===1?P={x:k.endX,y:k.endY}:L>1&&(P.x=k.endX,P.y=k.endY);const z=xo(F.points,M,{startPoint:P,curveTension:C});return k=z,z}).filter(F=>!!F);let H;const E=[];for(let F=T.length-1;F>=0;F--){const L=T[F].points,z=[];for(let D=L.length-1;D>=0;D--)z.push({x:(a=L[D].x1)!==null&&a!==void 0?a:L[D].x,y:(h=L[D].y1)!==null&&h!==void 0?h:L[D].y});if(F!==0){const D=T[F-1].points,N=D[D.length-1];N&&z.push({x:(d=N.x1)!==null&&d!==void 0?d:N.x,y:(u=N.y1)!==null&&u!==void 0?u:N.y})}z.length>1&&(H=xo(z,M==="stepBefore"?"stepAfter":M==="stepAfter"?"stepBefore":M,{curveTension:C}),E.unshift(H))}n.cacheArea=E.map((F,L)=>({top:B[L],bottom:F}))}else{if(!R||!R.length)return n.cacheArea=null,void n.clearUpdateShapeTag();{const P=R,k=[];for(let E=R.length-1;E>=0;E--)k.push({x:(c=R[E].x1)!==null&&c!==void 0?c:R[E].x,y:(g=R[E].y1)!==null&&g!==void 0?g:R[E].y});const B=xo(P,M,{curveTension:C}),H=xo(k,M==="stepBefore"?"stepAfter":M==="stepAfter"?"stepBefore":M,{curveTension:C});n.cacheArea={top:B,bottom:H}}}n.clearUpdateShapeTag()}if(Array.isArray(n.cacheArea)){const P=n.attribute.segments.filter(k=>k.points.length);if(P[0].points.length===1&&P.shift(),S===1){let k=!1;n.cacheArea.forEach((B,H)=>{k||(k=this.drawSegmentItem(t,B,y,m,x,w,P[H],[f,n.attribute],S,e,i,b,n,o,s,l))})}else{const k=n.cacheArea.reduce((F,L)=>F+L.top.getLength(),0),B=S*k;let H=0,E=!1;n.cacheArea.forEach((F,L)=>{if(E)return;const z=F.top.getLength(),D=(B-H)/z;H+=z,D>0&&(E=this.drawSegmentItem(t,F,y,m,x,w,P[L],[f,n.attribute],ii(D,1),e,i,b,n,o,s,l))})}}else this.drawSegmentItem(t,n.cacheArea,y,m,x,w,n.attribute,f,S,e,i,b,n,o,s,l)}draw(n,t,e,i){const o=Ht(n,i==null?void 0:i.theme).area;this._draw(n,o,!1,e,i)}drawSegmentItem(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p){let v=!1;return v=v||this._drawSegmentItem(n,t,e,i,o,r,s,l,a,h,d,u,c,g,!1,f,p),v=v||this._drawSegmentItem(n,t,e,i,o,r,s,l,a,h,d,u,c,g,!0,f,p),v}_drawSegmentItem(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p,v){var m,b,w,C;if(!(t&&t.top&&t.bottom&&t.top.curves&&t.top.curves.length&&t.bottom.curves&&t.bottom.curves.length))return;let{connectedType:_,connectedX:y,connectedY:x,connectedStyle:S}=s;const A=[];if(f&&(it(l)?(_=(m=_??l[0].connectedType)!==null&&m!==void 0?m:l[1].connectedType,y=(b=y??l[0].connectedX)!==null&&b!==void 0?b:l[1].connectedX,x=(w=x??l[0].connectedY)!==null&&w!==void 0?w:l[1].connectedY,S=(C=S??l[0].connectedStyle)!==null&&C!==void 0?C:l[1].connectedStyle):(_=_??l.connectedType,y=y??l.connectedX,x=x??l.connectedY,S=S??l.connectedStyle),_!=="connect"&&_!=="zero"&&(_="none"),it(l)?l.forEach(L=>A.push(L)):A.push(l),A.push(s)),f&&_==="none")return!1;n.beginPath();const{points:R,segments:T}=c.attribute;let M,P,k=re.ROW;if(T){const L=T[T.length-1];P=T[0].points[0],M=L.points[L.points.length-1]}else P=R[0],M=R[R.length-1];const B=Jt(M.x-P.x),H=Jt(M.y-P.y);k=M.x1==null?re.ROW:M.y1==null?re.COLUMN:Number.isFinite(B+H)?B>H?re.ROW:re.COLUMN:re.ROW,Yx(n.camera?n:n.nativeContext,t,a,{offsetX:h,offsetY:d,offsetZ:u,direction:k,drawConnect:f,mode:_,zeroX:y,zeroY:x}),this.beforeRenderStep(c,n,h,d,!!i,!1,e,!1,l,g,p,null,{attribute:s}),n.setShadowBlendStyle&&n.setShadowBlendStyle(c,s,l);const{x:E=0,x:F=0}=s;return e!==!1&&(p?p(n,s,l):i&&(n.setCommonStyle(c,f?S:s,E-h,F-d,f?A:l),n.fill())),this.afterRenderStep(c,n,h,d,!!i,!1,e,!1,l,g,p,null,{attribute:s}),(()=>{if(o!==!1)if(v)v(n,s,l);else{const{stroke:L=l&&l[1]&&l[1].stroke}=s;it(L)&&(L[0]||L[2])&&L[1]===!1&&(n.beginPath(),Uu(n.camera?n:n.nativeContext,L[0]?t.top:t.bottom,a,k===re.ROW?"x":"y",{offsetX:h,offsetY:d,offsetZ:u,drawConnect:f,mode:_,zeroX:y,zeroY:x})),n.setStrokeStyle(c,f?S:s,E-h,F-d,f?A:l),n.stroke()}})(),!1}};Ku=Zx([st(),fp(0,Ot(Me)),fp(0,Ie(ex)),Jx("design:paramtypes",[Object])],Ku);const Qx=fr,tA=Ho;var eA=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},iA=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},pp=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let ca=class extends vi{constructor(n){super(),this.pathRenderContribitions=n,this.numberType=ea,this.builtinContributions=[tA,Qx],this.init(n)}drawShape(n,t,e,i,o,r,s,l){var a,h,d;const u=(a=this.tempTheme)!==null&&a!==void 0?a:Ht(n,r==null?void 0:r.theme).path,{x:c=u.x,y:g=u.y,fillStrokeOrder:f=u.fillStrokeOrder}=n.attribute,p=(h=this.z)!==null&&h!==void 0?h:0,v=this.valid(n,u,s,l);if(!v)return;const{fVisible:m,sVisible:b,doFill:w,doStroke:C}=v;if(t.beginPath(),n.pathShape)qn(n.pathShape.commandList,t,e,i,1,1,p);else{const x=(d=n.attribute.path)!==null&&d!==void 0?d:u.path;qn(x.commandList,t,e,i,1,1,p)}t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,u),this.beforeRenderStep(n,t,e,i,w,C,m,b,u,o,s,l);const _=()=>{C&&(l?l(t,n.attribute,u):b&&(t.setStrokeStyle(n,n.attribute,c-e,g-i,u),t.stroke()))},y=()=>{w&&(s?s(t,n.attribute,u):m&&(t.setCommonStyle(n,n.attribute,c-e,g-i,u),t.fill()))};f?(_(),y()):(y(),_()),this.afterRenderStep(n,t,e,i,w,C,m,b,u,o,s,l)}draw(n,t,e,i){const o=Ht(n,i==null?void 0:i.theme).path;this.tempTheme=o,this._draw(n,o,!1,e,i),this.tempTheme=null}};ca=eA([st(),pp(0,Ot(Me)),pp(0,Ie(Iu)),iA("design:paramtypes",[Object])],ca);var nA=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},oA=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},vp=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let ga=class extends vi{constructor(n){super(),this.rectRenderContribitions=n,this.type="rect",this.numberType=Bu,this.builtinContributions=[Mx,Px,Bx],this.init(n)}drawShape(n,t,e,i,o,r,s,l){var a;const h=(a=this.tempTheme)!==null&&a!==void 0?a:Ht(n,r==null?void 0:r.theme).rect,{fill:d=h.fill,background:u,stroke:c=h.stroke,cornerRadius:g=h.cornerRadius,opacity:f=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:b=h.visible,x1:w,y1:C,x:_=h.x,y=h.y,fillStrokeOrder:x=h.fillStrokeOrder}=n.attribute;let{width:S,height:A}=n.attribute;S=(S??w-_)||0,A=(A??C-y)||0;const R=ip(f,p,S,A,d),T=np(f,m,S,A),M=cr(d,u),P=Cs(c,v);if(!n.valid||!b||!M&&!P||!(R||T||s||l||u))return;g===0||it(g)&&g.every(E=>E===0)?(t.beginPath(),t.rect(e,i,S,A)):(t.beginPath(),on(t,e,i,S,A,g));const k={doFill:M,doStroke:P};t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,h),this.beforeRenderStep(n,t,e,i,M,P,R,T,h,o,s,l,k);const B=()=>{k.doFill&&(s?s(t,n.attribute,h):R&&(t.setCommonStyle(n,n.attribute,_-e,y-i,h),t.fill()))},H=()=>{k.doStroke&&(l?l(t,n.attribute,h):T&&(t.setStrokeStyle(n,n.attribute,_-e,y-i,h),t.stroke()))};x?(H(),B()):(B(),H()),this.afterRenderStep(n,t,e,i,M,P,R,T,h,o,s,l)}draw(n,t,e,i){const o=Ht(n,i==null?void 0:i.theme).rect;this.tempTheme=o,this._draw(n,o,!1,e,i),this.tempTheme=null}};ga=nA([st(),vp(0,Ot(Me)),vp(0,Ie(Po)),oA("design:paramtypes",[Object])],ga);var rA=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},sA=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},mp=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let fa=class extends vi{constructor(n){super(),this.symbolRenderContribitions=n,this.numberType=na,this.builtinContributions=[zx,Ox,Dx],this.init(n)}drawShape(n,t,e,i,o,r,s,l){var a;const h=Ht(n,r==null?void 0:r.theme).symbol,{size:d=h.size,x:u=h.x,y:c=h.y,scaleX:g=h.scaleX,scaleY:f=h.scaleY,fillStrokeOrder:p=h.fillStrokeOrder}=n.attribute,v=this.valid(n,h,s,l);if(!v)return;const{fVisible:m,sVisible:b,doFill:w,doStroke:C}=v,_=n.getParsedPath();if(!_)return;const{keepDirIn3d:y=h.keepDirIn3d}=n.attribute,x=(a=this.z)!==null&&a!==void 0?a:0;t.beginPath();const S=(T,M)=>{var P,k,B;if(n._parsedPath.svgCache){const F=Object.assign({},M);F.fill=(P=M.fill)!==null&&P!==void 0?P:n.attribute.fill,F.opacity=(k=M.opacity)!==null&&k!==void 0?k:n.attribute.opacity,F.fillOpacity=n.attribute.fillOpacity,F.stroke=(B=M.stroke)!==null&&B!==void 0?B:n.attribute.stroke,M=F}const H=()=>{M.fill&&(s?s(t,n.attribute,h):(t.setCommonStyle(n,M,u-e,c-i,h),t.fill()))},E=()=>{M.stroke&&(l?l(t,n.attribute,h):(t.setStrokeStyle(n,M,(u-e)/g,(c-i)/f,h),t.stroke()))};p?(E(),H()):(H(),E())};if(y&&t.camera&&t.project){const T=t.project(e,i,x),M=t.camera;t.camera=null,_.draw(t,it(d)?[d[0]*g,d[1]*f]:d*g,T.x,T.y,void 0,S)===!1&&t.closePath(),t.camera=M}else _.draw(t,d,e,i,x,S)===!1&&t.closePath();t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,h),this.beforeRenderStep(n,t,e,i,w,C,m,b,h,o,s,l);const A=()=>{w&&!_.isSvg&&(s?s(t,n.attribute,h):m&&(t.setCommonStyle(n,n.attribute,u-e,c-i,h),t.fill()))},R=()=>{C&&!_.isSvg&&(l?l(t,n.attribute,h):b&&(t.setStrokeStyle(n,n.attribute,(u-e)/g,(c-i)/f,h),t.stroke()))};p?(R(),A()):(A(),R()),this.afterRenderStep(n,t,e,i,w,C,m,b,h,o,s,l)}draw(n,t,e,i){const o=Ht(n,i==null?void 0:i.theme).symbol;this._draw(n,o,!1,e,i)}};fa=rA([st(),mp(0,Ot(Me)),mp(0,Ie(Du)),sA("design:paramtypes",[Object])],fa);class lA{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new he)}allocate(t,e,i,o){if(!this.pools.length)return new he().setValue(t,e,i,o);const r=this.pools.pop();return r.x1=t,r.y1=e,r.x2=i,r.y2=o,r}allocateByObj(t){if(!this.pools.length)return new he(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(...t){this.pools=[]}}const pa=new lA;class aA{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}}const bt=new aA;let va;function ma(n){return va||(va=bt.CreateGraphic("text",{})),va.initAttributes(n),va.AABBBounds}class hA extends ws{constructor(){super(...arguments),this.time=Ut.beforeFillStroke}drawShape(t,e,i,o,r,s,l,a,h,d,u,c){var g,f,p,v,m,b,w,C,_,y;const{backgroundMode:x=h.backgroundMode,backgroundFit:S=h.backgroundFit}=t.attribute;let A,{background:R}=t.attribute;if(!R)return;const T=()=>{t.type==="richtext"&&(e.restore(),e.save(),A&&e.setTransformFromMatrix(A,!0,1))};let M;t.type==="richtext"&&(A=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const P=$t(R)&&R.background,k=t.transMatrix.onlyTranslate();if(P){const B=t.AABBBounds,H=((g=R.x)!==null&&g!==void 0?g:B.x1)+((f=R.dx)!==null&&f!==void 0?f:0),E=((p=R.y)!==null&&p!==void 0?p:B.y1)+((v=R.dy)!==null&&v!==void 0?v:0),F=(m=R.width)!==null&&m!==void 0?m:B.width(),L=(b=R.height)!==null&&b!==void 0?b:B.height();if(M=pa.allocate(H,E,H+F,E+L),R=R.background,!k){const z=M.width(),D=M.height();M.set(((w=R.x)!==null&&w!==void 0?w:0)+((C=R.dx)!==null&&C!==void 0?C:0),((_=R.y)!==null&&_!==void 0?_:0)+((y=R.dy)!==null&&y!==void 0?y:0),z,D)}}else M=t.AABBBounds,k||(M=ma(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const B=t.resources.get(R);if(B.state!=="success"||!B.data)return void T();e.highPerformanceSave(),k&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,o,h),this.doDrawImage(e,B.data,M,x,S),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:B}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,o,h),e.fillStyle=R,B?(on(e,M.x1,M.y1,M.width(),M.height(),B),e.fill()):e.fillRect(M.x1,M.y1,M.width(),M.height()),e.highPerformanceRestore()}P&&pa.free(M),T()}}const bp=new hA;var dA=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},uA=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Cp=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let $u=class extends vi{constructor(n){super(),this.textRenderContribitions=n,this.numberType=oa,this.builtinContributions=[bp],this.init(n)}drawShape(n,t,e,i,o,r,s,l){var a,h,d;const u=Ht(n,r==null?void 0:r.theme).text,{text:c,underline:g=u.underline,lineThrough:f=u.lineThrough,keepDirIn3d:p=u.keepDirIn3d,direction:v=u.direction,fontSize:m=u.fontSize,verticalMode:b=u.verticalMode,x:w=u.x,y:C=u.y}=n.attribute;let{textAlign:_=u.textAlign,textBaseline:y=u.textBaseline}=n.attribute;if(!b&&v==="vertical"){const H=_;_=(a=n.getBaselineMapAlign()[y])!==null&&a!==void 0?a:"left",y=(h=n.getAlignMapBaseline()[H])!==null&&h!==void 0?h:"top"}const x=(d=Hn(n.attribute.lineHeight,m))!==null&&d!==void 0?d:m,S=this.valid(n,u,s,l);if(!S)return;const{fVisible:A,sVisible:R,doFill:T,doStroke:M}=S,P=!p,k=this.z||0;t.beginPath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,u),this.beforeRenderStep(n,t,e,i,T,M,A,R,u,o,s,l),P&&this.transformUseContext2d(n,u,k,t);const B=(H,E,F,L)=>{let z=e+E;const D=i+F;if(L){t.highPerformanceSave(),z+=m;const N=wi.allocate(1,0,0,1,0,0);N.rotateByCenter(Math.PI/2,z,D),t.transformFromMatrix(N,!0),wi.free(N)}M&&(l?l(t,n.attribute,u):R&&(t.setStrokeStyle(n,n.attribute,w-e,C-i,u),t.strokeText(H,z,D,k))),T&&(s?s(t,n.attribute,u):A&&(t.setCommonStyle(n,n.attribute,w-e,C-i,u),t.fillText(H,z,D,k),this.drawUnderLine(g,f,n,z,D,k,u,t))),L&&(t.highPerformanceRestore(),t.setTransformForCurrent())};if(n.isMultiLine)if(t.setTextStyleWithoutAlignBaseline(n.attribute,u,k),v==="horizontal"){const{multilineLayout:H}=n;if(!H)return void t.highPerformanceRestore();const{xOffset:E,yOffset:F}=H.bbox;M&&(l?l(t,n.attribute,u):R&&(t.setStrokeStyle(n,n.attribute,w-e,C-i,u),H.lines.forEach(L=>{t.strokeText(L.str,(L.leftOffset||0)+E+e,(L.topOffset||0)+F+i,k)}))),T&&(s?s(t,n.attribute,u):A&&(t.setCommonStyle(n,n.attribute,w-e,C-i,u),H.lines.forEach(L=>{t.fillText(L.str,(L.leftOffset||0)+E+e,(L.topOffset||0)+F+i,k),this.drawUnderLine(g,f,n,(L.leftOffset||0)+E+e,(L.topOffset||0)+F+i-ix("bottom",m)-.05*m,k,u,t,{width:L.width})})))}else{n.tryUpdateAABBBounds();const H=n.cache,{verticalList:E}=H;t.textAlign="left",t.textBaseline="top";const F=x*E.length;let L=0;E.forEach(N=>{const V=N.reduce((G,U)=>G+(U.width||0),0);L=Xn(V,L)});let z=0,D=0;y==="bottom"?D=-F:y==="middle"&&(D=-F/2),_==="center"?z-=L/2:_==="right"&&(z-=L),E.forEach((N,V)=>{const G=N.reduce((q,j)=>q+(j.width||0),0),U=L-G;let Z=z;_==="center"?Z+=U/2:_==="right"&&(Z+=U),N.forEach(q=>{const{text:j,width:rt,direction:ht}=q;B(j,F-(V+1)*x+D,Z,ht),Z+=rt})})}else if(v==="horizontal"){t.setTextStyle(n.attribute,u,k);const H=n.clipedText;let E=0;x!==m&&(y==="top"?E=(x-m)/2:y==="middle"||y==="bottom"&&(E=-(x-m)/2)),B(H,0,E,0)}else{n.tryUpdateAABBBounds();const H=n.cache;if(H){t.setTextStyleWithoutAlignBaseline(n.attribute,u,k);const{verticalList:E}=H;let F=0;const L=E[0].reduce((D,N)=>D+(N.width||0),0);let z=0;y==="bottom"?z=-x:y==="middle"&&(z=-x/2),_==="center"?F-=L/2:_==="right"&&(F-=L),t.textAlign="left",t.textBaseline="top",E[0].forEach(D=>{const{text:N,width:V,direction:G}=D;B(N,z,F,G),F+=V})}}P&&this.restoreTransformUseContext2d(n,u,k,t),this.afterRenderStep(n,t,e,i,T,M,A,R,u,o,s,l)}draw(n,t,e,i){const o=Ht(n,i==null?void 0:i.theme).text,{keepDirIn3d:r=o.keepDirIn3d}=n.attribute,s=!r;this._draw(n,o,s,e,i)}drawUnderLine(n,t,e,i,o,r,s,l,a){if(t+n<=0)return;const{textAlign:h=s.textAlign,textBaseline:d=s.textBaseline,fontSize:u=s.fontSize,fill:c=s.fill,opacity:g=s.opacity,underlineOffset:f=s.underlineOffset,underlineDash:p=s.underlineDash,fillOpacity:v=s.fillOpacity}=e.attribute,m=!ct(a),b=m?a.width:e.clipedWidth,w=m?0:fn(h,b),C=pn(m?"alphabetic":d,u,u),_={lineWidth:0,stroke:c,opacity:g,strokeOpacity:v};let y=m?-3:0;if(n){_.lineWidth=n,l.setStrokeStyle(e,_,i,o,s),p&&l.setLineDash(p),l.beginPath();const x=o+C+u+f+y;l.moveTo(i+w,x,r),l.lineTo(i+w+b,x,r),l.stroke()}if(m&&(y=-1),t){_.lineWidth=t,l.setStrokeStyle(e,_,i,o,s),l.beginPath();const x=o+C+u/2+y;l.moveTo(i+w,x,r),l.lineTo(i+w+b,x,r),l.stroke()}}};$u=dA([st(),Cp(0,Ot(Me)),Cp(0,Ie(sa)),uA("design:paramtypes",[Object])],$u);function _p(n,t,e,i){n.moveTo(t[0].x+e,t[0].y+i);for(let o=1;o<t.length;o++)n.lineTo(t[o].x+e,t[o].y+i)}function cA(n,t,e,i,o,r=!0){var s;if(t.length<3)return void _p(n,t,e,i);let l=0,a=t.length-1;r||(l+=1,a-=1,n.moveTo(t[0].x+e,t[0].y+i));for(let h=l;h<=a;h++){const d=t[h===0?a:(h-1)%t.length],u=t[h%t.length],c=t[(h+1)%t.length],g=u.x-d.x,f=u.y-d.y,p=u.x-c.x,v=u.y-c.y,m=(Math.atan2(f,g)-Math.atan2(v,p))/2,b=Math.abs(Math.tan(m));let w=Array.isArray(o)?(s=o[h%t.length])!==null&&s!==void 0?s:0:o,C=w/b;const _=ba(g,f),y=ba(p,v),x=Math.min(_,y);C>x&&(C=x,w=x*b);const S=Yu(u,C,_,g,f),A=Yu(u,C,y,p,v),R=2*u.x-S.x-A.x,T=2*u.y-S.y-A.y,M=ba(R,T),P=Yu(u,ba(C,w),M,R,T);let k=Math.atan2(S.y-P.y,S.x-P.x);const B=Math.atan2(A.y-P.y,A.x-P.x);let H=B-k;H<0&&(k=B,H=-H),H>Math.PI&&(H-=Math.PI),h===0?n.moveTo(S.x+e,S.y+i):n.lineTo(S.x+e,S.y+i),H&&n.arcTo(u.x+e,u.y+i,A.x+e,A.y+i,w),n.lineTo(A.x+e,A.y+i)}r||n.lineTo(t[a+1].x+e,t[a+1].y+i)}function ba(n,t){return Math.sqrt(n*n+t*t)}function Yu(n,t,e,i,o){const r=t/e;return{x:n.x-i*r,y:n.y-o*r}}const gA=fr,fA=Ho;var pA=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},vA=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},yp=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let Xu=class extends vi{constructor(n){super(),this.polygonRenderContribitions=n,this.numberType=ia,this.builtinContributions=[fA,gA],this.init(n)}drawShape(n,t,e,i,o,r,s,l){const a=Ht(n,r==null?void 0:r.theme).polygon,{points:h=a.points,cornerRadius:d=a.cornerRadius,x:u=a.x,y:c=a.y,closePath:g=a.closePath,fillStrokeOrder:f=a.fillStrokeOrder}=n.attribute,p=this.valid(n,a,s,l);if(!p)return;const{fVisible:v,sVisible:m,doFill:b,doStroke:w}=p;t.beginPath(),d<=0||it(d)&&d.every(y=>y===0)?_p(t.camera?t:t.nativeContext,h,e,i):cA(t.camera?t:t.nativeContext,h,e,i,d,g),g&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,a),this.beforeRenderStep(n,t,e,i,b,w,v,m,a,o,s,l);const C=()=>{b&&(s?s(t,n.attribute,a):v&&(t.setCommonStyle(n,n.attribute,u-e,c-i,a),t.fill()))},_=()=>{w&&(l?l(t,n.attribute,a):m&&(t.setStrokeStyle(n,n.attribute,u-e,c-i,a),t.stroke()))};f?(_(),C()):(C(),_()),this.afterRenderStep(n,t,e,i,b,w,v,m,a,o,s,l)}draw(n,t,e,i){const o=Ht(n,i==null?void 0:i.theme).polygon;this._draw(n,o,!1,e,i)}};Xu=pA([st(),yp(0,Ot(Me)),yp(0,Ie(zu)),vA("design:paramtypes",[Object])],Xu);var mA=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},bA=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},wp=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};let qu=class{constructor(n){this.groupRenderContribitions=n,this.numberType=Mu}drawShape(n,t,e,i,o,r,s,l){const a=Ht(n,r==null?void 0:r.theme).group,{fill:h=a.fill,background:d,stroke:u=a.stroke,opacity:c=a.opacity,width:g=a.width,height:f=a.height,clip:p=a.clip,fillOpacity:v=a.fillOpacity,strokeOpacity:m=a.strokeOpacity,cornerRadius:b=a.cornerRadius,path:w=a.path,lineWidth:C=a.lineWidth,visible:_=a.visible,fillStrokeOrder:y=a.fillStrokeOrder,x=a.x,y:S=a.y}=n.attribute,A=ip(c,v,g,f,h),R=np(c,m,g,f),T=cr(h,d),M=Cs(u,C);if(!n.valid||!_||!p&&(!T&&!M||!(A||R||s||l||d)))return;if(w&&w.length&&o.drawContribution){const H=t.disableFill,E=t.disableStroke,F=t.disableBeginPath;t.disableFill=!0,t.disableStroke=!0,t.disableBeginPath=!0,w.forEach(L=>{o.drawContribution.getRenderContribution(L).draw(L,o.renderService,o,r)}),t.disableFill=H,t.disableStroke=E,t.disableBeginPath=F}else b===0||it(b)&&b.every(H=>H===0)?(t.beginPath(),t.rect(e,i,g,f)):(t.beginPath(),on(t,e,i,g,f,b));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Tx));const P={doFill:T,doStroke:M};this._groupRenderContribitions.forEach(H=>{H.time===Ut.beforeFillStroke&&H.drawShape(n,t,e,i,T,M,A,R,a,o,s,l,P)}),p&&t.clip(),t.setShadowBlendStyle&&t.setShadowBlendStyle(n,n.attribute,a);const k=()=>{P.doFill&&(s?s(t,n.attribute,a):A&&(t.setCommonStyle(n,n.attribute,x-e,S-i,a),t.fill()))},B=()=>{P.doStroke&&(l?l(t,n.attribute,a):R&&(t.setStrokeStyle(n,n.attribute,x-e,S-i,a),t.stroke()))};y?(B(),k()):(k(),B()),this._groupRenderContribitions.forEach(H=>{H.time===Ut.afterFillStroke&&H.drawShape(n,t,e,i,T,M,A,R,a,o,s,l)})}draw(n,t,e,i){const{context:o}=e;if(!o)return;const{clip:r,baseOpacity:s=1}=n.attribute;r?o.save():o.highPerformanceSave();const l=o.baseGlobalAlpha;o.baseGlobalAlpha*=s;const a=Ht(n,i==null?void 0:i.theme).group,h=o.modelMatrix;if(o.camera){const g=Le.allocate(),f=Le.allocate();lp(f,n,a),ys(g,h||g,f),o.modelMatrix=g,Le.free(f),o.setTransform(1,0,0,1,0,0,!0)}else o.transformFromMatrix(n.transMatrix,!0);o.beginPath(),i.skipDraw?this.drawShape(n,o,0,0,e,i,()=>!1,()=>!1):this.drawShape(n,o,0,0,e);const{scrollX:d=a.scrollX,scrollY:u=a.scrollY}=n.attribute;let c;(d||u)&&o.translate(d,u),i&&i.drawingCb&&(c=i.drawingCb()),o.modelMatrix!==h&&Le.free(o.modelMatrix),o.modelMatrix=h,o.baseGlobalAlpha=l,c&&c.then?c.then(()=>{r?o.restore():o.highPerformanceRestore()}):r?o.restore():o.highPerformanceRestore()}};qu=mA([st(),wp(0,Ot(Me)),wp(0,Ie(tn)),bA("design:paramtypes",[Object])],qu);var CA=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_A=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Sp=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};const yA=["","repeat-x","repeat-y","repeat"];let Zu=class extends vi{constructor(n){super(),this.imageRenderContribitions=n,this.numberType=ta,this.builtinContributions=[Fx,kx],this.init(n)}drawShape(n,t,e,i,o,r,s,l){const a=Ht(n).image,{width:h=a.width,height:d=a.height,repeatX:u=a.repeatX,repeatY:c=a.repeatY,x:g=a.x,y:f=a.y,cornerRadius:p=a.cornerRadius,fillStrokeOrder:v=a.fillStrokeOrder,image:m}=n.attribute,b=this.valid(n,a,s);if(!b)return;const{fVisible:w,sVisible:C,doFill:_,doStroke:y}=b;t.setShadowBlendStyle&&t.setShadowBlendStyle(n,a),this.beforeRenderStep(n,t,e,i,_,!1,w,!1,a,o,s);const x=()=>{if(_){if(s)s(t,n.attribute,a);else if(w){if(!m||!n.resources)return;const A=n.resources.get(m);if(A.state!=="success")return;let R=!1;p===0||it(p)&&p.every(M=>M===0)||(t.beginPath(),on(t,e,i,h,d,p),t.save(),t.clip(),R=!0),t.setCommonStyle(n,n.attribute,e,i,a);let T=0;if(u==="repeat"&&(T|=1),c==="repeat"&&(T|=2),T){const M=t.createPattern(A.data,yA[T]);t.fillStyle=M,t.translate(e,i,!0),t.fillRect(0,0,h,d),t.translate(-e,-i,!0)}else t.drawImage(A.data,e,i,h,d);R&&t.restore()}}},S=()=>{y&&(l?l(t,n.attribute,a):C&&(t.setStrokeStyle(n,n.attribute,g-e,f-i,a),t.stroke()))};v?(S(),x()):(x(),S()),this.afterRenderStep(n,t,e,i,_,!1,w,!1,a,o,s)}draw(n,t,e){const{image:i}=n.attribute;if(!n.isGifImage){if(!i||!n.resources)return;const s=n.resources.get(i);if(s.state==="loading"&&Qt(i))return void ee.improveImageLoading(i);if(s.state!=="success")return}const{context:o}=t.drawParams;if(!o)return;const r=Ht(n).image;this._draw(n,r,!1,e)}};Zu=CA([st(),Sp(0,Ot(Me)),Sp(0,Ie(Bo)),_A("design:paramtypes",[Object])],Zu);const xp=Symbol.for("IncrementalDrawContribution"),Ca=Symbol.for("ArcRender"),_a=Symbol.for("CircleRender"),hi=Symbol.for("GraphicRender"),Ap=Symbol.for("GroupRender"),ya=Symbol.for("LineRender"),wa=Symbol.for("PathRender"),Sa=Symbol.for("PolygonRender"),xa=Symbol.for("RectRender"),Aa=Symbol.for("SymbolRender"),Ju=Symbol.for("TextRender"),Qu=Symbol.for("RichTextRender"),Rp=Symbol.for("ImageRender"),tc=Symbol.for("DrawContribution"),Tp=(n,t,e,i)=>{let o,r=!1,s=!1;if(t.forEachChildren(l=>(r=l.numberType===jS,!r)),t.forEachChildren(l=>(s=!!l.findFace,!s)),r){const l=t.getChildren(),a=[...l];a.sort((h,d)=>{var u,c,g,f;let p=((c=(u=h.attribute.startAngle)!==null&&u!==void 0?u:0+h.attribute.endAngle)!==null&&c!==void 0?c:0)/2,v=((f=(g=d.attribute.startAngle)!==null&&g!==void 0?g:0+d.attribute.endAngle)!==null&&f!==void 0?f:0)/2;for(;p<0;)p+=Gt;for(;v<0;)v+=Gt;return v-p}),a.forEach(h=>{h._next=null,h._prev=null}),t.removeAllChild(),t.update(),a.forEach(h=>{t.appendChild(h)}),i.hack_pieFace="outside",o=e(r,s),o&&o.graphic||(i.hack_pieFace="inside",o=e(r,s)),o&&o.graphic||(i.hack_pieFace="top",o=e(r,s)),t.removeAllChild(),l.forEach(h=>{h._next=null,h._prev=null}),l.forEach(h=>{t.appendChild(h)})}else if(s){const l=t.getChildren(),a=l.map(h=>({ave_z:h.findFace().vertices.map(d=>{var u;return n.view(d[0],d[1],(u=d[2]+h.attribute.z)!==null&&u!==void 0?u:0)[2]}).reduce((d,u)=>d+u,0),g:h}));a.sort((h,d)=>d.ave_z-h.ave_z),t.removeAllChild(),a.forEach(h=>{h.g._next=null,h.g._prev=null}),t.update(),a.forEach(h=>{t.add(h.g)}),o=e(r,s),t.removeAllChild(),l.forEach(h=>{h._next=null,h._prev=null}),t.update(),l.forEach(h=>{t.add(h)})}else o=e(r,s);return o};var wA=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},SA=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};const xs=Symbol.for("DrawItemInterceptor"),Mp=new he,Bp=new he;class xA{constructor(){this.order=1}afterDrawItem(t,e,i,o,r){return t.attribute.shadowRootIdx==null&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,o,r),!1}beforeDrawItem(t,e,i,o,r){return t.attribute.shadowRootIdx==null&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,o,r),!1}drawItem(t,e,i,o,r){if(!t.shadowRoot)return!1;const{context:s}=i;if(s.highPerformanceSave(),s.transformFromMatrix(t.transMatrix,!0),o.dirtyBounds&&o.backupDirtyBounds){Mp.copy(o.dirtyBounds),Bp.copy(o.backupDirtyBounds);const l=t.globalTransMatrix.getInverse();o.dirtyBounds.copy(o.backupDirtyBounds).transformWithMatrix(l),o.backupDirtyBounds.copy(o.dirtyBounds)}return o.renderGroup(t.shadowRoot,i,wi.allocate(1,0,0,1,0,0)),s.highPerformanceRestore(),o.dirtyBounds&&o.backupDirtyBounds&&(o.dirtyBounds.copy(Mp),o.backupDirtyBounds.copy(Bp)),!0}}class AA{constructor(){this.order=1}afterDrawItem(t,e,i,o,r){return t.attribute._debug_bounds&&this.drawItem(t,e,i,o,r),!1}drawItem(t,e,i,o,r){if(!t.attribute._debug_bounds)return!1;const{context:s}=i;s.highPerformanceSave(),t.parent&&s.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&s.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const l=t.AABBBounds;return t.attribute._debug_bounds!==!0&&t.attribute._debug_bounds(s,t),s.strokeRect(l.x1,l.y1,l.width(),l.height()),s.highPerformanceRestore(),!0}}let Ra=class{constructor(){this.order=1,this.interceptors=[new xA,new TA,new RA,new AA]}afterDrawItem(n,t,e,i,o){for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].afterDrawItem&&this.interceptors[r].afterDrawItem(n,t,e,i,o))return!0;return!1}beforeDrawItem(n,t,e,i,o){if((!n.in3dMode||e.in3dInterceptor)&&!n.shadowRoot&&!(n.baseGraphic||n.attribute.globalZIndex||n.interactiveGraphic))return!1;for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r].beforeDrawItem&&this.interceptors[r].beforeDrawItem(n,t,e,i,o))return!0;return!1}};Ra=wA([st(),SA("design:paramtypes",[])],Ra);class RA{constructor(){this.order=1}beforeDrawItem(t,e,i,o,r){return!this.processing&&(t.baseGraphic?this.beforeDrawInteractive(t,e,i,o,r):this.beforeSetInteractive(t,e,i,o,r))}beforeSetInteractive(t,e,i,o,r){let s=t.interactiveGraphic;if(t.attribute.globalZIndex){s||(s=t.clone(),t.interactiveGraphic=s,s.baseGraphic=t),s.setAttributes({globalZIndex:0,zIndex:t.attribute.globalZIndex},!1,{skipUpdateCallback:!0}),i.stage.tryInitInteractiveLayer();const l=i.stage.getLayer("_builtin_interactive");return l&&this.getShadowRoot(l).add(s),!0}if(s){i.stage.tryInitInteractiveLayer();const l=i.stage.getLayer("_builtin_interactive");l&&this.getShadowRoot(l).removeChild(s),t.interactiveGraphic=null,s.baseGraphic=null}return!1}beforeDrawInteractive(t,e,i,o,r){const s=t.baseGraphic;let l=!!s.stage,a=s.parent;for(;l&&a&&a.stage!==a;)l=!!a.stage,a=a.parent;if(!l){const h=i.stage.getLayer("_builtin_interactive");return h&&this.getShadowRoot(h).removeChild(t),!0}if(s){this.processing=!0;const{context:h}=i;return h.highPerformanceSave(),h.setTransformFromMatrix(s.parent.globalTransMatrix,!0),s.isContainer?o.renderGroup(s,i,s.parent.globalTransMatrix):o.renderItem(s,i),h.highPerformanceRestore(),this.processing=!1,!0}return!1}getShadowRoot(t){var e;let i=t.getElementById("_interactive_group");return i||(i=bt.CreateGraphic("group",{}),i.id="_interactive_group",t.add(i)),(e=i.shadowRoot)!==null&&e!==void 0?e:i.attachShadow()}}class TA{constructor(){this.order=1}beforeDrawItem(t,e,i,o,r){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:s,stage:l}=e.drawParams;s.canvas,s.save(),this.initCanvasCtx(s),s.camera=l.camera;const a=s.currentMatrix;a.a/=s.dpr,a.b/=s.dpr,a.c/=s.dpr,a.d/=s.dpr,a.e/=s.dpr,a.f/=s.dpr;const h=Le.allocate();Wu(h,a);const d=s.modelMatrix;if(d){if(h){const u=Le.allocate();s.modelMatrix=ys(u,d,h)}}else s.modelMatrix=h;return s.setTransform(1,0,0,1,0,0,!0),t.isContainer?Tp(s,t,(u,c)=>o.renderGroup(t,i,t.parent.globalTransMatrix,!u&&c),i):o.renderItem(t,i),s.camera=null,s.restore(),s.modelMatrix!==d&&Le.free(s.modelMatrix),s.modelMatrix=d,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var MA=globalThis&&globalThis.__decorate||function(n,t,e,i){var o,r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,e,i);else for(var l=n.length-1;l>=0;l--)(o=n[l])&&(s=(r<3?o(s):r>3?o(t,e,s):o(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},BA=globalThis&&globalThis.__metadata||function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},PA=globalThis&&globalThis.__param||function(n,t){return function(e,i){t(e,i,n)}};const Pp=Symbol.for("RenderService");let ec=class{constructor(n){this.drawContribution=n}prepare(n){n&&this.renderTreeRoots.forEach(t=>{this._prepare(t,n)})}_prepare(n,t){n.forEachChildren(e=>{this._prepare(e,t)}),n.update({bounds:t,trans:!0})}prepareRenderList(){}beforeDraw(n){}draw(n){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(n){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(n,t){this.renderTreeRoots=n,this.drawParams=t;const e=t.updateBounds;this.prepare(e),this.prepareRenderList(),this.beforeDraw(t),this.draw(t),this.afterDraw(t),this.drawParams=null}};ec=MA([st(),PA(0,Ot(tc)),BA("design:paramtypes",[Object])],ec);const HA=new Bt(n=>{n(Pp).to(ec)}),br=Symbol.for("PickerService"),Hp=Symbol.for("GlobalPickerService"),As=(n,t,e)=>{const{outerBorder:i,shadowBlur:o=t.shadowBlur}=n;if(i){const r=t.outerBorder,{distance:s=r.distance,lineWidth:l=r.lineWidth}=i;e.expand(s+(o+l)/2)}return e},Ep=["radius","startAngle","endAngle",...zi];class Rs extends pi{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ql}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Ht(this).circle}updateAABBBounds(t,e,i,o){this.updatePathProxyAABBBounds(i)||(o?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:s}=X.graphicService.updateTempAABBBounds(i);return As(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2),X.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:o=e.radius}=t;return i.set(-o,-o,o,o),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:o=e.startAngle,endAngle:r=e.endAngle,radius:s=e.radius}=t;return r-o>Gt-ae?i.set(-s,-s,s,s):Au(o,r,s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Ep)}needUpdateTag(t){return super.needUpdateTag(t,Ep)}toCustomPath(){var t,e,i;const o=this.attribute,r=(t=o.radius)!==null&&t!==void 0?t:this.getDefaultAttribute("radius"),s=(e=o.startAngle)!==null&&e!==void 0?e:this.getDefaultAttribute("startAngle"),l=(i=o.endAngle)!==null&&i!==void 0?i:this.getDefaultAttribute("endAngle"),a=new Ue;return a.arc(0,0,r,s,l),a}clone(){return new Rs(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Rs.NOWORK_ANIMATE_ATTR}}Rs.NOWORK_ANIMATE_ATTR=Ji;function Lp(n){return new Rs(n)}class ic{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if(e==="left"||e==="start")t.xOffset=0;else if(e==="center")t.xOffset=t.width/-2;else{if(e!=="right"&&e!=="end")throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset=i==="top"?0:i==="middle"?t.height/-2:i==="alphabetic"?-.79*t.height:-t.height,t}GetLayout(t,e,i,o,r,s,l,a,h){const d=[],u=[e,i],c=[0,0];for(;t.length>0;){const{str:f}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,l,a,h);d.push({str:f,width:this.textMeasure.measureTextWidth(f,this.textOptions)}),t=t.substring(f.length)}o==="left"||o==="start"||(o==="center"?c[0]=u[0]/-2:o!=="right"&&o!=="end"||(c[0]=-u[0])),r==="top"||(r==="middle"?c[1]=u[1]/-2:r==="bottom"&&(c[1]=-u[1]));const g={xOffset:c[0],yOffset:c[1],width:u[0],height:u[1]};return this.layoutWithBBox(g,d,o,r,s)}GetLayoutByLines(t,e,i,o,r="",s,l,a="end"){t=t.map(c=>c.toString());const h=[],d=[0,0];if(typeof l=="number"&&l!==1/0){let c;for(let g=0,f=t.length;g<f;g++)c=Math.min(this.textMeasure.measureTextWidth(t[g],this.textOptions),l),h.push({str:this.textMeasure.clipTextWithSuffix(t[g],this.textOptions,c,r,s,a).str,width:c});d[0]=l}else{let c,g;l=0;for(let f=0,p=t.length;f<p;f++)g=t[f],c=this.textMeasure.measureTextWidth(g,this.textOptions),l=Math.max(l,c),h.push({str:g,width:c});d[0]=l}d[1]=h.length*o,d[0]=h.reduce((c,g)=>Math.max(c,g.width),0);const u={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(u,e,i),this.layoutWithBBox(u,h,e,i,o)}layoutWithBBox(t,e,i,o,r){const s=[0,0],l=e.length*r;o==="top"||(o==="middle"?s[1]=(t.height-l)/2:o==="bottom"&&(s[1]=t.height-l));for(let a=0;a<e.length;a++)this.lineOffset(t,e[a],i,o,r,s);return{bbox:t,lines:e,fontFamily:this.fontFamily,fontSize:this.textOptions.fontSize,fontWeight:this.textOptions.fontWeight,lineHeight:r,textAlign:i,textBaseline:o}}lineOffset(t,e,i,o,r,s){return i==="left"||i==="start"?e.leftOffset=0:i==="center"?e.leftOffset=(t.width-e.width)/2:i!=="right"&&i!=="end"||(e.leftOffset=t.width-e.width),e.topOffset=(r-this.textOptions.fontSize)/2+.79*this.textOptions.fontSize+s[1],s[1]+=r,e}}const Fp=["text","maxLineWidth","textAlign","textBaseline","heightLimit","lineClamp","fontSize","fontFamily","fontWeight","ellipsis","lineHeight","direction","wordBreak","heightLimit","lineClamp",...zi];class fe extends pi{get font(){const t=this.getGraphicTheme();return this._font||(this._font=Fl(this.attribute,t)),this._font}get clipedText(){var t;const e=this.attribute,i=this.getGraphicTheme();if(!this.isSimplify())return;const{maxLineWidth:o=i.maxLineWidth}=e;return Number.isFinite(o)?(this.tryUpdateAABBBounds(),this.cache.clipedText):((t=e.text)!==null&&t!==void 0?t:i.text).toString()}get clipedWidth(){if(this.isSimplify())return this.tryUpdateAABBBounds(),this.cache.clipedWidth}get cliped(){var t,e;const i=this.getGraphicTheme(),o=this.attribute,{maxLineWidth:r=i.maxLineWidth,text:s,whiteSpace:l=i.whiteSpace}=o;if(!Number.isFinite(r))return!1;if(this.tryUpdateAABBBounds(),(e=(t=this.cache)===null||t===void 0?void 0:t.layoutData)===null||e===void 0?void 0:e.lines){let a="";return this.cache.layoutData.lines.forEach(h=>{a+=h.str}),(Array.isArray(s)?s.join(""):s)!==a}return o.direction==="vertical"&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map(a=>a.text).join("")!==o.text.toString():this.clipedText!=null&&this.clipedText!==o.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&this.attribute.direction!=="vertical"}get isMultiLine(){return Array.isArray(this.attribute.text)||this.attribute.whiteSpace==="normal"}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=oa,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return it(t)?!t.every(e=>e==null||e===""):t!=null&&t!==""}getGraphicTheme(){return Ht(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const h=this.AABBBounds;return this._OBBBounds.setValue(h.x1,h.y1,h.x2,h.y2),this._OBBBounds}this.obbText||(this.obbText=new fe({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const o=this.obbText.AABBBounds,{x:r,y:s}=e,l={x:(o.x1+o.x2)/2,y:(o.y1+o.y2)/2},a=or(l,i,{x:r,y:s});return this._OBBBounds.copy(o),this._OBBBounds.translate(a.x-l.x,a.y-l.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:o=e.text}=this.attribute;Array.isArray(o)?this.updateMultilineAABBBounds(o):this.updateSingallineAABBBounds(o);const{tb1:r}=X.graphicService.updateTempAABBBounds(i),{scaleX:s=e.scaleX,scaleY:l=e.scaleY,shadowBlur:a=e.shadowBlur,strokeBoundsBuffer:h=e.strokeBoundsBuffer}=t;if(a){const d=a/Math.abs(s+l);Zl(r,d,!0,h),i.union(r)}return X.graphicService.combindShadowAABBBounds(i,this),t.forceBoundsHeight==null&&t.forceBoundsWidth==null||X.graphicService.updateHTMLTextAABBBounds(t,e,i),Qd(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,o,r;const s=this.getGraphicTheme(),{fontFamily:l=s.fontFamily,textAlign:a=s.textAlign,textBaseline:h=s.textBaseline,fontSize:d=s.fontSize,ellipsis:u=s.ellipsis,maxLineWidth:c,stroke:g=s.stroke,lineWidth:f=s.lineWidth,wordBreak:p=s.wordBreak,fontWeight:v=s.fontWeight,ignoreBuf:m=s.ignoreBuf,suffixPosition:b=s.suffixPosition,heightLimit:w=0,lineClamp:C}=this.attribute,_=(e=Hn(this.attribute.lineHeight,this.attribute.fontSize||s.fontSize))!==null&&e!==void 0?e:this.attribute.fontSize||s.fontSize,y=m?0:2;if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const B=this.cache.layoutData.bbox;return this._AABBBounds.set(B.xOffset,B.yOffset,B.xOffset+B.width,B.yOffset+B.height),g&&this._AABBBounds.expand(f/2),this._AABBBounds}const x=X.graphicUtil.textMeasure,S=new ic(l,{fontSize:d,fontWeight:v,fontFamily:l},x),A=it(t)?t.map(B=>B.toString()):[t.toString()],R=[],T=[0,0];let M=1/0;if(w>0&&(M=Math.max(Math.floor(w/_),1)),C&&(M=Math.min(M,C)),typeof c=="number"&&c!==1/0){if(c>0)for(let H=0;H<A.length;H++){const E=A[H];let F=!0;if(H===M-1){const D=S.textMeasure.clipTextWithSuffix(E,S.textOptions,c,u,!1,b,H!==A.length-1);R.push({str:D.str,width:D.width});break}const L=S.textMeasure.clipText(E,S.textOptions,c,p!=="break-all",p==="keep-all");if(E!==""&&L.str===""||L.wordBreaked){if(u){const D=S.textMeasure.clipTextWithSuffix(E,S.textOptions,c,u,!1,b);L.str=(o=D.str)!==null&&o!==void 0?o:"",L.width=(r=D.width)!==null&&r!==void 0?r:0}else L.str="",L.width=0;F=!1}R.push({str:L.str,width:L.width});let z=L.str.length;if(!L.wordBreaked||E!==""&&L.str===""||(F=!0,z=L.wordBreaked),L.str.length!==E.length){if(F){let D=E.substring(z);p==="keep-all"&&(D=D.replace(/^\s+/g,"")),A.splice(H+1,0,D)}}}let B=0;R.forEach(H=>{B=Math.max(B,H.width)}),T[0]=B}else{let B,H,E=0;for(let F=0,L=A.length;F<L;F++){if(F===M-1){const z=S.textMeasure.clipTextWithSuffix(A[F],S.textOptions,c,u,!1,b);R.push({str:z.str,width:z.width}),E=Math.max(E,z.width);break}H=A[F],B=S.textMeasure.measureTextWidth(H,S.textOptions,p==="break-word"),E=Math.max(E,B),R.push({str:H,width:B})}T[0]=E}T[1]=R.length*(_+y);const P={xOffset:0,yOffset:0,width:T[0],height:T[1]};S.LayoutBBox(P,a,h);const k=S.layoutWithBBox(P,R,a,h,_);return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(P.xOffset,P.yOffset,P.xOffset+P.width,P.yOffset+P.height),g&&this._AABBBounds.expand(f/2),this._AABBBounds}updateSingallineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:o=e.underlineOffset}=this.attribute,r=i==="horizontal"?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t);return i==="horizontal"&&o&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+o),r}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:o=e.underlineOffset}=this.attribute,r=i==="horizontal"?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return i==="horizontal"&&o&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+o),r}updateHorizontalSinglelineAABBBounds(t){var e,i;const o=this.getGraphicTheme(),{wrap:r=o.wrap}=this.attribute;if(r)return this.updateWrapAABBBounds([t]);const s=X.graphicUtil.textMeasure;let l,a;const h=this.attribute,{maxLineWidth:d=o.maxLineWidth,ellipsis:u=o.ellipsis,textAlign:c=o.textAlign,textBaseline:g=o.textBaseline,fontFamily:f=o.fontFamily,fontSize:p=o.fontSize,fontWeight:v=o.fontWeight,stroke:m=o.stroke,lineWidth:b=o.lineWidth,ignoreBuf:w=o.ignoreBuf,whiteSpace:C=o.whiteSpace,suffixPosition:_=o.suffixPosition}=h;if(C==="normal")return this.updateWrapAABBBounds(t);const y=w?0:Math.max(2,.075*p),x=h.fontSize||o.fontSize,S=(e=Hn(h.lineHeight,x))!==null&&e!==void 0?e:x+y;if(!this.shouldUpdateShape()&&this.cache){l=(i=this.cache.clipedWidth)!==null&&i!==void 0?i:0;const M=fn(c,l),P=pn(g,S,p);return this._AABBBounds.set(M,P,M+l,P+S),m&&this._AABBBounds.expand(b/2),this._AABBBounds}if(Number.isFinite(d)){if(u){const M=u===!0?o.ellipsis:u,P=s.clipTextWithSuffix(t.toString(),{fontSize:p,fontWeight:v,fontFamily:f},d,M,!1,_);a=P.str,l=P.width}else{const M=s.clipText(t.toString(),{fontSize:p,fontWeight:v,fontFamily:f},d,!1);a=M.str,l=M.width}this.cache.clipedText=a,this.cache.clipedWidth=l}else l=s.measureTextWidth(t.toString(),{fontSize:p,fontWeight:v,fontFamily:f}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=l;this.clearUpdateShapeTag();const A=fn(c,l);let R=S;X.global&&X.global.isSafari()&&(R+=.2*p);const T=pn(g,R,p,y);return this._AABBBounds.set(A,T,A+l,T+R),m&&this._AABBBounds.expand(b/2),this._AABBBounds}getBaselineMapAlign(){return fe.baselineMapAlign}getAlignMapBaseline(){return fe.alignMapBaseline}updateVerticalSinglelineAABBBounds(t){var e,i,o;const r=this.getGraphicTheme(),s=X.graphicUtil.textMeasure;let l;const a=this.attribute,{ignoreBuf:h=r.ignoreBuf}=a,d=h?0:2,{maxLineWidth:u=r.maxLineWidth,ellipsis:c=r.ellipsis,fontSize:g=r.fontSize,fontWeight:f=r.fontWeight,fontFamily:p=r.fontFamily,stroke:v=r.stroke,lineWidth:m=r.lineWidth,verticalMode:b=r.verticalMode,suffixPosition:w=r.suffixPosition}=a,C=(e=Hn(a.lineHeight,a.fontSize||r.fontSize))!==null&&e!==void 0?e:(a.fontSize||r.fontSize)+d;let{textAlign:_=r.textAlign,textBaseline:y=r.textBaseline}=a;if(!b){const R=_;_=(i=fe.baselineMapAlign[y])!==null&&i!==void 0?i:"left",y=(o=fe.alignMapBaseline[R])!==null&&o!==void 0?o:"top"}if(!this.shouldUpdateShape()&&this.cache){l=this.cache.clipedWidth;const R=fn(_,l),T=pn(y,C,g);return this._AABBBounds.set(T,R,T+C,R+l),v&&this._AABBBounds.expand(m/2),this._AABBBounds}let x=[U0(t.toString())];if(Number.isFinite(u)){if(c){const R=c===!0?r.ellipsis:c,T=s.clipTextWithSuffixVertical(x[0],{fontSize:g,fontWeight:f,fontFamily:p},u,R,!1,w);x=[T.verticalList],l=T.width}else{const R=s.clipTextVertical(x[0],{fontSize:g,fontWeight:f,fontFamily:p},u,!1);x=[R.verticalList],l=R.width}this.cache.verticalList=x,this.cache.clipedWidth=l}else l=0,x[0].forEach(R=>{const T=R.direction===Ro.HORIZONTAL?g:s.measureTextWidth(R.text,{fontSize:g,fontWeight:f,fontFamily:p});l+=T,R.width=T}),this.cache.verticalList=x,this.cache.clipedWidth=l;this.clearUpdateShapeTag();const S=fn(_,l),A=pn(y,C,g);return this._AABBBounds.set(A,S,A+C,S+l),v&&this._AABBBounds.expand(m/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const o=this.getGraphicTheme(),{wrap:r=o.wrap}=this.attribute;if(r)return this.updateWrapAABBBounds(t);const s=this.attribute,{fontFamily:l=o.fontFamily,textAlign:a=o.textAlign,textBaseline:h=o.textBaseline,fontSize:d=o.fontSize,fontWeight:u=o.fontWeight,ellipsis:c=o.ellipsis,maxLineWidth:g,stroke:f=o.stroke,lineWidth:p=o.lineWidth,whiteSpace:v=o.whiteSpace,suffixPosition:m=o.suffixPosition}=s,b=(e=Hn(s.lineHeight,s.fontSize||o.fontSize))!==null&&e!==void 0?e:s.fontSize||o.fontSize;if(v==="normal")return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const y=this.cache.layoutData.bbox;return this._AABBBounds.set(y.xOffset,y.yOffset,y.xOffset+y.width,y.yOffset+y.height),f&&this._AABBBounds.expand(p/2),this._AABBBounds}const w=X.graphicUtil.textMeasure,C=new ic(l,{fontSize:d,fontWeight:u,fontFamily:l},w).GetLayoutByLines(t,a,h,b,c===!0?o.ellipsis:c||void 0,!1,g,m),{bbox:_}=C;return this.cache.layoutData=C,this.clearUpdateShapeTag(),this._AABBBounds.set(_.xOffset,_.yOffset,_.xOffset+_.width,_.yOffset+_.height),f&&this._AABBBounds.expand(p/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e,i,o;const r=this.getGraphicTheme(),s=X.graphicUtil.textMeasure;let l;const a=this.attribute,{ignoreBuf:h=r.ignoreBuf}=a,d=h?0:2,{maxLineWidth:u=r.maxLineWidth,ellipsis:c=r.ellipsis,fontFamily:g=r.fontFamily,fontSize:f=r.fontSize,fontWeight:p=r.fontWeight,stroke:v=r.stroke,lineWidth:m=r.lineWidth,verticalMode:b=r.verticalMode,suffixPosition:w=r.suffixPosition}=a,C=(e=Hn(a.lineHeight,a.fontSize||r.fontSize))!==null&&e!==void 0?e:(a.fontSize||r.fontSize)+d;let{textAlign:_=r.textAlign,textBaseline:y=r.textBaseline}=a;if(!b){const T=_;_=(i=fe.baselineMapAlign[y])!==null&&i!==void 0?i:"left",y=(o=fe.alignMapBaseline[T])!==null&&o!==void 0?o:"top"}if(l=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach(k=>{const B=k.reduce((H,E)=>H+E.width,0);l=Xn(B,l)});const T=fn(_,l),M=this.cache.verticalList.length*C,P=pn(y,M,f);return this._AABBBounds.set(P,T,P+M,T+l),v&&this._AABBBounds.expand(m/2),this._AABBBounds}const x=t.map(T=>U0(T.toString()));x.forEach((T,M)=>{if(Number.isFinite(u))if(c){const P=c===!0?r.ellipsis:c,k=s.clipTextWithSuffixVertical(T,{fontSize:f,fontWeight:p,fontFamily:g},u,P,!1,w);x[M]=k.verticalList,l=k.width}else{const P=s.clipTextVertical(T,{fontSize:f,fontWeight:p,fontFamily:g},u,!1);x[M]=P.verticalList,l=P.width}else l=0,T.forEach(P=>{const k=P.direction===Ro.HORIZONTAL?f:s.measureTextWidth(P.text,{fontSize:f,fontWeight:p,fontFamily:g});l+=k,P.width=k})}),this.cache.verticalList=x,this.clearUpdateShapeTag(),this.cache.verticalList.forEach(T=>{const M=T.reduce((P,k)=>P+k.width,0);l=Xn(M,l)});const S=fn(_,l),A=this.cache.verticalList.length*C,R=pn(y,A,f);return this._AABBBounds.set(R,S,R+A,S+l),v&&this._AABBBounds.expand(m/2),this._AABBBounds}needUpdateTags(t,e=Fp){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Fp){return super.needUpdateTag(t,e)}clone(){return new fe(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fe.NOWORK_ANIMATE_ATTR}}fe.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ji),fe.baselineMapAlign={top:"left",bottom:"right",middle:"center"},fe.alignMapBaseline={left:"top",right:"bottom",center:"middle"};function nc(n){return new fe(n)}const Ta=["heightLimit","lineClamp"];class Ma extends fe{constructor(t){super(Object.assign(Object.assign({},t),{wrap:!0}))}_isValid(){const{text:t}=this.attribute;return it(t)?!t.every(e=>e==null||e===""):t!=null&&t!==""}updateMultilineAABBBounds(t){var e,i,o,r;const s=this.getGraphicTheme(),{fontFamily:l=s.fontFamily,textAlign:a=s.textAlign,textBaseline:h=s.textBaseline,fontSize:d=s.fontSize,ellipsis:u=s.ellipsis,maxLineWidth:c,stroke:g=s.stroke,lineWidth:f=s.lineWidth,wordBreak:p=s.wordBreak,fontWeight:v=s.fontWeight,ignoreBuf:m=s.ignoreBuf,heightLimit:b=0,suffixPosition:w=s.suffixPosition,lineClamp:C}=this.attribute,_=(e=Hn(this.attribute.lineHeight,this.attribute.fontSize||s.fontSize))!==null&&e!==void 0?e:this.attribute.fontSize||s.fontSize,y=m?0:2;if(!this.shouldUpdateShape()&&(!((i=this.cache)===null||i===void 0)&&i.layoutData)){const B=this.cache.layoutData.bbox;return this._AABBBounds.set(B.xOffset,B.yOffset,B.xOffset+B.width,B.yOffset+B.height),g&&this._AABBBounds.expand(f/2),this._AABBBounds}const x=X.graphicUtil.textMeasure,S=new ic(l,{fontSize:d,fontWeight:v,fontFamily:l},x),A=t.map(B=>B.toString()),R=[],T=[0,0];let M=1/0;if(b>0&&(M=Math.max(Math.floor(b/_),1)),C&&(M=Math.min(M,C)),typeof c=="number"&&c!==1/0){if(c>0)for(let H=0;H<A.length;H++){const E=A[H];let F=!0;if(H===M-1){const z=S.textMeasure.clipTextWithSuffix(E,S.textOptions,c,u,!1,w);R.push({str:z.str,width:z.width});break}const L=S.textMeasure.clipText(E,S.textOptions,c,p==="break-word");if(E!==""&&L.str===""){if(u){const z=S.textMeasure.clipTextWithSuffix(E,S.textOptions,c,u,!1,w);L.str=(o=z.str)!==null&&o!==void 0?o:"",L.width=(r=z.width)!==null&&r!==void 0?r:0}else L.str="",L.width=0;F=!1}if(R.push({str:L.str,width:L.width}),L.str.length!==E.length){if(F){const z=E.substring(L.str.length);A.splice(H+1,0,z)}}}let B=0;R.forEach(H=>{B=Math.max(B,H.width)}),T[0]=B}else{let B,H,E=0;for(let F=0,L=A.length;F<L;F++){if(F===M-1){const z=S.textMeasure.clipTextWithSuffix(A[F],S.textOptions,c,u,!1,w);R.push({str:z.str,width:z.width}),E=Math.max(E,z.width);break}H=A[F],B=S.textMeasure.measureTextWidth(H,S.textOptions,p==="break-word"),E=Math.max(E,B),R.push({str:H,width:B})}T[0]=E}T[1]=R.length*(_+y);const P={xOffset:0,yOffset:0,width:T[0],height:T[1]};S.LayoutBBox(P,a,h);const k=S.layoutWithBBox(P,R,a,h,_);return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(P.xOffset,P.yOffset,P.xOffset+P.width,P.yOffset+P.height),g&&this._AABBBounds.expand(f/2),this._AABBBounds}needUpdateTags(t){for(let e=0;e<Ta.length;e++){const i=Ta[e];if(t.indexOf(i)!==-1)return!0}return super.needUpdateTags(t)}needUpdateTag(t){for(let e=0;e<Ta.length;e++)if(t===Ta[e])return!0;return super.needUpdateTag(t)}getNoWorkAnimateAttr(){return Ma.NOWORK_ANIMATE_ATTR}}function EA(n){return new Ma(n)}class Se{bounds(t,e){if(nt(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}}function kp(n,t,e,i,o){return o?n.arc(e,i,t,0,Ye,!1,o):n.arc(e,i,t,0,Ye),!1}class LA extends Se{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,o,r){return kp(t,e/2,i,o,r)}drawOffset(t,e,i,o,r,s){return kp(t,e/2+r,i,o,s)}drawToSvgPath(t,e,i,o){const r=t/2;return`M ${e-r}, ${i} a ${r},${r} 0 1,0 ${2*r},0 a ${r},${r} 0 1,0 -${2*r},0`}}const FA=new LA;function kA(n,t,e,i,o){return n.moveTo(-3*t+e,-t+i,o),n.lineTo(-t+e,-t+i,o),n.lineTo(-t+e,-3*t+i,o),n.lineTo(t+e,-3*t+i,o),n.lineTo(t+e,-t+i,o),n.lineTo(3*t+e,-t+i,o),n.lineTo(3*t+e,t+i,o),n.lineTo(t+e,t+i,o),n.lineTo(t+e,3*t+i,o),n.lineTo(-t+e,3*t+i,o),n.lineTo(-t+e,t+i,o),n.lineTo(-3*t+e,t+i,o),n.closePath(),!0}function IA(n,t,e,i,o,r){return n.moveTo(-3*t+e-o,-t+i-o,r),n.lineTo(-t+e-o,-t+i-o,r),n.lineTo(-t+e-o,-3*t+i-o,r),n.lineTo(t+e+o,-3*t+i-o,r),n.lineTo(t+e+o,-t+i-o,r),n.lineTo(3*t+e+o,-t+i-o,r),n.lineTo(3*t+e+o,t+i+o,r),n.lineTo(t+e+o,t+i+o,r),n.lineTo(t+e+o,3*t+i+o,r),n.lineTo(-t+e-o,3*t+i+o,r),n.lineTo(-t+e-o,t+i+o,r),n.lineTo(-3*t+e-o,t+i+o,r),n.closePath(),!0}class zA extends Se{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,o,r){return kA(t,e/6,i,o,r)}drawOffset(t,e,i,o,r,s){return IA(t,e/6,i,o,r,s)}}const DA=new zA;function oc(n,t,e,i,o){return n.moveTo(e,i-t,o),n.lineTo(t+e,i,o),n.lineTo(e,i+t,o),n.lineTo(e-t,i,o),n.closePath(),!0}class OA extends Se{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,o,r){return oc(t,e/2,i,o,r)}drawFitDir(t,e,i,o,r){return oc(t,e/2,i,o,r)}drawOffset(t,e,i,o,r,s){return oc(t,e/2+r,i,o,s)}}const WA=new OA;function Ip(n,t,e,i){const o=2*t;return n.rect(e-t,i-t,o,o),!1}class NA extends Se{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,o){return Ip(t,e/2,i,o)}drawOffset(t,e,i,o,r){return Ip(t,e/2+r,i,o)}}const VA=new NA;function zp(n,t,e,i,o=0){return n.moveTo(e+t+2*o,t+i+o),n.lineTo(e-t-2*o,t+i+o),n.lineTo(e,i-t-2*o),n.closePath(),!0}class Dp extends Se{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,o){return zp(t,e/2,i,o)}drawOffset(t,e,i,o,r){return zp(t,e/2,i,o,r)}}const jA=new Dp;class GA extends Dp{constructor(){super(...arguments),this.type="triangle"}}const UA=new GA,Op=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),KA=Math.sin(Ye/10)*Op,$A=-Math.cos(Ye/10)*Op;function Wp(n,t,e,i){const o=KA*t,r=$A*t;n.moveTo(e,-t+i),n.lineTo(o+e,r+i);for(let s=1;s<5;++s){const l=Ye*s/5,a=Math.cos(l),h=Math.sin(l);n.lineTo(h*t+e,-a*t+i),n.lineTo(a*o-h*r+e,h*o+a*r+i)}return n.closePath(),!0}class YA extends Se{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,o){return Wp(t,e/2,i,o)}drawOffset(t,e,i,o,r){return Wp(t,e/2+r,i,o)}}const XA=new YA,qA=Zi(3);function Np(n,t,e,i){const o=t,r=o/qA,s=r/5,l=t;return n.moveTo(0+e,-o+i),n.lineTo(r/2+e,i),n.lineTo(s/2+e,i),n.lineTo(s/2+e,l+i),n.lineTo(-s/2+e,l+i),n.lineTo(-s/2+e,i),n.lineTo(-r/2+e,i),n.closePath(),!0}class ZA extends Se{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,o){return Np(t,e/2,i,o)}drawOffset(t,e,i,o,r){return Np(t,e/2+r,i,o)}}const JA=new ZA;function Vp(n,t,e,i){const o=2*t;return n.moveTo(e,-t+i),n.lineTo(o/3/2+e,t+i),n.lineTo(-o/3/2+e,t+i),n.closePath(),!0}class QA extends Se{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,o){return Vp(t,e/2,i,o)}drawOffset(t,e,i,o,r){return Vp(t,e/2+r,i,o)}}const tR=new QA;function jp(n,t,e,i){return n.moveTo(-t+e,i),n.lineTo(e,t+i),!1}class eR extends Se{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,o){return jp(t,e/2,i,o)}drawOffset(t,e,i,o,r){return jp(t,e/2+r,i,o)}}const iR=new eR,Oi=-.5,Wi=Zi(3)/2,Gp=1/Zi(12);function Up(n,t,e,i){const o=t/2,r=t*Gp,s=o,l=t*Gp+t,a=-s,h=l;return n.moveTo(o+e,r+i),n.lineTo(s+e,l+i),n.lineTo(a+e,h+i),n.lineTo(Oi*o-Wi*r+e,Wi*o+Oi*r+i),n.lineTo(Oi*s-Wi*l+e,Wi*s+Oi*l+i),n.lineTo(Oi*a-Wi*h+e,Wi*a+Oi*h+i),n.lineTo(Oi*o+Wi*r+e,Oi*r-Wi*o+i),n.lineTo(Oi*s+Wi*l+e,Oi*l-Wi*s+i),n.lineTo(Oi*a+Wi*h+e,Oi*h-Wi*a+i),n.closePath(),!1}class nR extends Se{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,o){return Up(t,e/2,i,o)}drawOffset(t,e,i,o,r){return Up(t,e/2+r,i,o)}}const oR=new nR;function Kp(n,t,e,i,o){return n.moveTo(-t+e-2*o,i),n.lineTo(t+e+o,t+i+2*o),n.lineTo(t+e+o,i-t-2*o),n.closePath(),!0}class rR extends Se{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,o){return Kp(t,e/2,i,o,0)}drawOffset(t,e,i,o,r){return Kp(t,e/2,i,o,r)}}const sR=new rR;function $p(n,t,e,i,o=0){return n.moveTo(e-t-o,t+i+2*o),n.lineTo(t+e+2*o,i),n.lineTo(e-t-o,i-t-2*o),n.closePath(),!0}class lR extends Se{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,o){return $p(t,e/2,i,o)}drawOffset(t,e,i,o,r){return $p(t,e/2,i,o,r)}}const aR=new lR;function Yp(n,t,e,i,o=0){return n.moveTo(e-t-2*o,i-t-o),n.lineTo(e+t+2*o,i-t-o),n.lineTo(e,i+t+2*o),n.closePath(),!0}class hR extends Se{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,o){return Yp(t,e/2,i,o)}drawOffset(t,e,i,o,r){return Yp(t,e/2,i,o,r)}}const dR=new hR,rc=Zi(3);function Xp(n,t,e,i){const o=t*rc;return n.moveTo(e,i+-o/3*2),n.lineTo(t+e,i+o),n.lineTo(e-t,i+o),n.closePath(),!0}class uR extends Se{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,o){return Xp(t,e/2/rc,i,o)}drawOffset(t,e,i,o,r){return Xp(t,e/2/rc+r,i,o)}}const cR=new uR;function qp(n,t,e,i){const o=2*t;return n.moveTo(t+e,i-o),n.lineTo(e-t,i),n.lineTo(t+e,o+i),!0}class gR extends Se{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,o){return qp(t,e/4,i,o)}drawOffset(t,e,i,o,r){return qp(t,e/4+r,i,o)}}const fR=new gR;function Zp(n,t,e,i){const o=2*t;return n.moveTo(e-t,i-o),n.lineTo(e+t,i),n.lineTo(e-t,o+i),!0}class pR extends Se{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,o){return Zp(t,e/4,i,o)}drawOffset(t,e,i,o,r){return Zp(t,e/4+r,i,o)}}const vR=new pR;function Jp(n,t,e,i){const o=2*t;return n.moveTo(e-o,i+t),n.lineTo(e,i-t),n.lineTo(e+o,i+t),!0}class mR extends Se{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,o){return Jp(t,e/4,i,o)}drawOffset(t,e,i,o,r){return Jp(t,e/4+r,i,o)}}const bR=new mR;function Qp(n,t,e,i){const o=2*t;return n.moveTo(e-o,i-t),n.lineTo(e,i+t),n.lineTo(e+o,i-t),!0}class CR extends Se{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,o){return Qp(t,e/4,i,o)}drawOffset(t,e,i,o,r){return Qp(t,e/4+r,i,o)}}const _R=new CR;function tv(n,t,e,i,o){return n.moveTo(e,i-t),n.lineTo(e,i+t),!0}class yR extends Se{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,o,r){return tv(t,e/2,i,o)}drawOffset(t,e,i,o,r,s){return tv(t,e/2+r,i,o)}drawToSvgPath(t,e,i,o){const r=t/2;return`M ${e}, ${i-r} L ${e},${i+r}`}}const wR=new yR;function ev(n,t,e,i,o){return n.moveTo(e-t,i),n.lineTo(e+t,i),!0}class SR extends Se{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,o,r){return ev(t,e/2,i,o)}drawOffset(t,e,i,o,r,s){return ev(t,e/2+r,i,o)}drawToSvgPath(t,e,i,o){const r=t/2;return`M ${e-r}, ${i} L ${e+r},${i}`}}const xR=new SR;function iv(n,t,e,i,o){return n.moveTo(e-t,i-t),n.lineTo(e+t,i+t),n.moveTo(e+t,i-t),n.lineTo(e-t,i+t),!0}class AR extends Se{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,o,r){return iv(t,e/2,i,o)}drawOffset(t,e,i,o,r,s){return iv(t,e/2+r,i,o)}drawToSvgPath(t,e,i,o){const r=t/2;return`M ${e-r}, ${i-r} L ${e+r},${i+r} M ${e+r}, ${i-r} L ${e-r},${i+r}`}}const RR=new AR;function nv(n,t,e,i){return n.rect(e-t[0]/2,i-t[1]/2,t[0],t[1]),!1}function ov(n,t,e,i){const o=t,r=t/2;return n.rect(e-o/2,i-r/2,o,r),!1}class TR extends Se{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,o){return nt(e)?ov(t,e,i,o):nv(t,e,i,o)}drawOffset(t,e,i,o,r){return nt(e)?ov(t,e+2*r,i,o):nv(t,[e[0]+2*r,e[1]+2*r],i,o)}}const MR=new TR,Ts=new he;class rv{constructor(t,e,i=!1){this.pathStr="",this.type=t,it(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,o,r,s,l){return this.isSvg?!!this.svgCache&&(this.svgCache.forEach(a=>{t.beginPath(),qn(a.path.commandList,t,i,o,e,e),l&&l(a.path,a.attribute)}),!1):(qn(this.path.commandList,t,i,o,e+r,e+r),!1)}draw(t,e,i,o,r,s){return this.drawOffset(t,e,i,o,0,r,s)}bounds(t,e){if(this.isSvg)return this.svgCache?(e.clear(),void this.svgCache.forEach(({path:i})=>{Ts.x1=i.bounds.x1*t,Ts.y1=i.bounds.y1*t,Ts.x2=i.bounds.x2*t,Ts.y2=i.bounds.y2*t,e.union(Ts)})):void 0;this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const BR=[FA,DA,WA,VA,cR,UA,XA,JA,tR,iR,oR,sR,aR,jA,dR,fR,vR,bR,_R,MR,wR,xR,RR],sv={};BR.forEach(n=>{sv[n.type]=n});const PR={arrowLeft:"M 0.25 -0.5 L -0.25 0 l 0.5 0.5",arrowRight:"M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",rectRound:"M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",roundLine:"M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"},HR=(n,t,e)=>{const{outerBorder:i,shadowBlur:o=t.shadowBlur,strokeBoundsBuffer:r=t.strokeBoundsBuffer}=n;if(i){const s=t.outerBorder,{distance:l=s.distance,lineWidth:a=s.lineWidth}=i;Zl(e,l+(o+a)/2,!0,r)}return e},Ba=new he,lv=["symbolType","size",...zi];let sc=class ts extends pi{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=na}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return it(t)?t.length===2&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const t=this.getGraphicTheme();let{symbolType:e=t.symbolType}=this.attribute,i=sv[e];if(i)return this._parsedPath=i,i;if(i=ts.userSymbolMap[e],i)return this._parsedPath=i,i;if(e=PR[e]||e,zS(e)===!0){const a=new ql,{svg:h}=a.parse(e);if(!h)return null;const d=it(h.path)?h.path:[h.path];Ba.clear();const u=[];d.forEach(p=>{const v=new Ue().fromString(p.d),m={};GS.forEach(b=>{p[b]&&(m[Z0[b]]=p[b])}),u.push({path:v,attribute:m}),Ba.union(v.bounds)});const c=Ba.width(),g=Ba.height(),f=1/Xn(c,g);return u.forEach(p=>p.path.transform(0,0,f,f)),this._parsedPath=new rv(e,u,!0),ts.userSymbolMap[e]=this._parsedPath,this._parsedPath}const o=new Ue().fromString(e),r=o.bounds.width(),s=o.bounds.height(),l=1/Xn(r,s);return o.transform(0,0,l,l),this._parsedPath=new rv(e,o),ts.userSymbolMap[e]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Ht(this).symbol}updateAABBBounds(t,e,i,o){this.updatePathProxyAABBBounds(i)||(o?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:r,tb2:s}=X.graphicService.updateTempAABBBounds(i);HR(t,e,r),i.union(r),r.setValue(s.x1,s.y1,s.x2,s.y2);const{lineJoin:l=e.lineJoin}=t;return X.graphicService.transformAABBBounds(t,i,e,l==="miter",this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:o=e.size}=t;if(it(o))i.set(-o[0]/2,-o[1]/2,o[0]/2,o[1]/2);else{const r=o/2;i.set(-r,-r,r,r)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:o=e.size}=t;return this.getParsedPath().bounds(o,i),i}needUpdateTags(t){return super.needUpdateTags(t,lv)}needUpdateTag(t){return super.needUpdateTag(t,lv)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=it(e)?e:[e,e];return t.path?new Ue().fromCustomPath2D(t.path,0,0,i[0],i[1]):new Ue().fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new ts(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ts.NOWORK_ANIMATE_ATTR}};sc.userSymbolMap={},sc.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ji);function Ms(n){return new sc(n)}const av=["segments","points","curveType","curveTension",...zi];let hv=class pf extends pi{constructor(t={}){super(t),this.type="line",this.numberType=vs}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?e.length!==0:!!t&&!(t.length<=1)}_interpolate(t,e,i,o,r){t==="points"&&(r.points=F0(i,o,e))}getGraphicTheme(){return Ht(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),X.graphicService.updateTempAABBBounds(i);const{lineJoin:o=e.lineJoin}=t;return X.graphicService.transformAABBBounds(t,i,e,o==="miter",this),i}updateLineAABBBoundsByPoints(t,e,i,o){const{points:r=e.points,connectedType:s}=t,l=i;return r.forEach(a=>{a.defined===!1&&s!=="zero"&&s!=="connect"||l.add(a.x,a.y)}),l}updateLineAABBBoundsBySegments(t,e,i,o){const{segments:r=e.segments,connectedType:s}=t,l=i;return r.forEach(a=>{a.points.forEach(h=>{h.defined===!1&&s!=="zero"&&s!=="connect"||l.add(h.x,h.y)})}),l}needUpdateTags(t){return super.needUpdateTags(t,av)}needUpdateTag(t){return super.needUpdateTag(t,av)}toCustomPath(){const t=this.attribute,e=new Ue,i=t.segments,o=r=>{if(r&&r.length){let s=!0;r.forEach(l=>{l.defined!==!1&&(s?e.moveTo(l.x,l.y):e.lineTo(l.x,l.y),s=!1)})}};return i&&i.length?i.forEach(r=>{o(r.points)}):t.points&&o(t.points),e}clone(){return new pf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return pf.NOWORK_ANIMATE_ATTR}};hv.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ji);function Si(n){return new hv(n)}const dv=["width","x1","y1","height","cornerRadius",...zi];let lc=class vf extends pi{constructor(t){super(t),this.type="rect",this.numberType=Bu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Ht(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:s,height:l}=t;const{x1:a,y1:h,x:d,y:u}=t;s=s??a-d,l=l??h-u,(isFinite(s)||isFinite(l)||isFinite(d)||isFinite(u))&&i.set(0,0,s||0,l||0)}const{tb1:o,tb2:r}=X.graphicService.updateTempAABBBounds(i);return As(t,e,o),i.union(o),o.setValue(r.x1,r.y1,r.x2,r.y2),X.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,dv)}needUpdateTag(t){return super.needUpdateTag(t,dv)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:o,height:r}=wS(t),s=new Ue;return s.moveTo(e,i),s.rect(e,i,o,r),s}clone(){return new vf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return vf.NOWORK_ANIMATE_ATTR}};lc.NOWORK_ANIMATE_ATTR=Ji;function ve(n){return new lc(n)}class ER{constructor(t,e,i,o,r,s,l,a,h,d,u,c,g,f){this.left=t,this.top=e,this.width=i,this.height=o,this.actualHeight=0,this.bottom=e+o,this.right=t+i,this.ellipsis=r,this.wordBreak=s,this.verticalDirection=l,this.lines=[],this.globalAlign=a,this.globalBaseline=h,this.layoutDirection=d,this.directionKey=fu[this.layoutDirection],this.isWidthMax=u,this.isHeightMax=c,this.singleLine=g,f?(f.clear(),this.icons=f):this.icons=new Map}draw(t,e){const{width:i,height:o}=this.getActualSize(),r=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let s=this.isHeightMax?Math.min(this.height,o):this.height||o||0;s=Math.min(s,o);let l=0;switch(this.globalBaseline){case"top":l=0;break;case"middle":l=-s/2;break;case"bottom":l=-s}let a=0;this.globalAlign==="right"||this.globalAlign==="end"?a=-r:this.globalAlign==="center"&&(a=-r/2);let h=this[this.directionKey.height];this.singleLine&&(h=this.lines[0].height+1);let d=!1;if(this.verticalDirection==="middle")if(this.actualHeight>=h&&h!==0)for(let u=0;u<this.lines.length;u++){const{top:c,height:g}=this.lines[u];if(c+g<this[this.directionKey.top]||c+g>this[this.directionKey.top]+h)return d;let f=!1;this.ellipsis&&this.lines[u+1]&&this.lines[u+1].top+this.lines[u+1].height>this[this.directionKey.top]+h&&(f=!0,d=!0),this.lines[u].draw(t,f,this.lines[u][this.directionKey.left]+a,this.lines[u][this.directionKey.top]+l,this.ellipsis,e)}else{const u=Math.floor((h-this.actualHeight)/2);this.layoutDirection==="vertical"?a+=u:l+=u;for(let c=0;c<this.lines.length;c++)this.lines[c].draw(t,!1,this.lines[c][this.directionKey.left]+a,this.lines[c][this.directionKey.top]+l,this.ellipsis,e)}else if(this.verticalDirection==="bottom"&&this.layoutDirection!=="vertical")for(let u=0;u<this.lines.length;u++){const{top:c,height:g}=this.lines[u],f=h-this.lines[u].top-this.lines[u].height;if(h===0)this.lines[u].draw(t,!1,a,f+l,this.ellipsis,e);else{if(f+g>this[this.directionKey.top]+h||f<this[this.directionKey.top])return d;{let p=!1;this.ellipsis&&this.lines[u+1]&&f-this.lines[u+1].height<this[this.directionKey.top]&&(p=!0,d=!0),this.lines[u].draw(t,p,a,f+l,this.ellipsis,e)}}}else{this.verticalDirection==="bottom"&&this.layoutDirection==="vertical"&&this.singleLine&&this.isWidthMax&&(a+=this.lines[0].height+1);for(let u=0;u<this.lines.length;u++){this.verticalDirection==="bottom"&&this.layoutDirection==="vertical"&&(a-=this.lines[u].height+this.lines[u].top);const{top:c,height:g}=this.lines[u];if(h===0)this.lines[u].draw(t,!1,this.lines[u][this.directionKey.left]+a,this.lines[u][this.directionKey.top]+l,this.ellipsis,e);else{if(c+g<this[this.directionKey.top]||c+g>this[this.directionKey.top]+h)return d;{let f=!1;this.ellipsis&&this.lines[u+1]&&this.lines[u+1].top+this.lines[u+1].height>this[this.directionKey.top]+h&&(f=!0,d=!0),this.lines[u].draw(t,f,this.lines[u][this.directionKey.left]+a,this.lines[u][this.directionKey.top]+l,this.ellipsis,e)}}}}return d}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;i<this.lines.length;i++){const o=this.lines[i];o.actualWidth>t&&(t=o.actualWidth),e+=o.height}return{width:this.layoutDirection==="vertical"?e:t,height:this.layoutDirection==="vertical"?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:o}=this.getRawActualSize();this.width,this.height;let r=this[this.directionKey.height];if(this.singleLine&&(r=this.lines[0].height+1),this.verticalDirection==="middle")if(this.actualHeight>=r&&r!==0)for(let s=0;s<this.lines.length;s++){const{top:l,height:a}=this.lines[s];if(!(l+a<this[this.directionKey.top]||l+a>this[this.directionKey.top]+r))if(this.ellipsis&&this.lines[s+1]&&this.lines[s+1].top+this.lines[s+1].height>this[this.directionKey.top]+r){const h=this.ellipsis===!0?"...":this.ellipsis||"",d=this.lines[s].getWidthWithEllips(h);d>t&&(t=d),e+=this.lines[s].height}else this.lines[s].actualWidth>t&&(t=this.lines[s].actualWidth),e+=this.lines[s].height}else{Math.floor((r-this.actualHeight)/2);for(let s=0;s<this.lines.length;s++)this.lines[s].actualWidth>t&&(t=this.lines[s].actualWidth),e+=this.lines[s].height}else if(this.verticalDirection==="bottom")for(let s=0;s<this.lines.length;s++){const{top:l,height:a}=this.lines[s],h=r-this.lines[s].top-this.lines[s].height;if(r===0)this.lines[s].actualWidth>t&&(t=this.lines[s].actualWidth),e+=this.lines[s].height;else if(!(h+a>this[this.directionKey.top]+r||h<this[this.directionKey.top]))if(this.ellipsis&&this.lines[s+1]&&h-this.lines[s+1].height<this[this.directionKey.top]){const d=this.ellipsis===!0?"...":this.ellipsis||"",u=this.lines[s].getWidthWithEllips(d);u>t&&(t=u),e+=this.lines[s].height}else this.lines[s].actualWidth>t&&(t=this.lines[s].actualWidth),e+=this.lines[s].height}else for(let s=0;s<this.lines.length;s++){const{top:l,height:a}=this.lines[s];if(r===0)this.lines[s].actualWidth>t&&(t=this.lines[s].actualWidth),e+=this.lines[s].height;else if(!(l+a<this[this.directionKey.top]||l+a>this[this.directionKey.top]+r))if(this.ellipsis&&this.lines[s+1]&&this.lines[s+1].top+this.lines[s+1].height>this[this.directionKey.top]+r){const h=this.ellipsis===!0?"...":this.ellipsis||"",d=this.lines[s].getWidthWithEllips(h);d>t&&(t=d),e+=this.lines[s].height}else this.lines[s].actualWidth>t&&(t=this.lines[s].actualWidth),e+=this.lines[s].height}return{width:this.layoutDirection==="vertical"?e:t,height:this.layoutDirection==="vertical"?t:e}}}class Bs{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const o=Hn(i.lineHeight,this.fontSize);this.lineHeight=typeof o=="number"?o>this.fontSize?o:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:r,height:s,descent:l,width:a}=lr(t,i);let h=0,d=0,u=0;this.height>s&&(h=(this.height-s)/2,d=Math.ceil(h),u=Math.floor(h)),this.textBaseline==="top"?(this.ascent=h,this.descent=s-h):this.textBaseline==="bottom"?(this.ascent=s-h,this.descent=h):this.textBaseline==="middle"?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=r+d,this.descent=l+u),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,i.direction==="vertical"&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=lr(this.text,this.character);this.width=t,this.direction==="vertical"&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,o,r){let s=this.text,l=this.left+i;e+=this.top;let a=this.direction;if(this.verticalEllipsis)s=this.ellipsisStr,a="vertical",e-=this.ellipsisWidth/2;else{if(this.ellipsis==="hide")return;if(this.ellipsis==="add")s+=this.ellipsisStr,r!=="right"&&r!=="end"||(l-=this.ellipsisWidth);else if(this.ellipsis==="replace"){const h=pu(s,(a==="vertical"?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,s.length-1);if(s=s.slice(0,h),s+=this.ellipsisStr,r==="right"||r==="end"){const{width:d}=lr(this.text.slice(h),this.character);a==="vertical"||(l-=this.ellipsisWidth-d)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}a==="vertical"&&(t.save(),t.rotateAbout(Math.PI/2,l,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(l,e),l=0,e=0),this.character.stroke&&(oS(t,this.character),t.strokeText(s,l,e)),nS(t,this.character),this.character.fill&&t.fillText(s,l,e),this.character.fill&&(typeof this.character.lineThrough=="boolean"||typeof this.character.underline=="boolean"?(this.character.underline&&t.fillRect(l,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(l,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):this.character.textDecoration==="underline"?t.fillRect(l,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):this.character.textDecoration==="line-through"&&t.fillRect(l,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),a==="vertical"&&t.restore()}getWidthWithEllips(t){let e=this.text;const i=t==="vertical"?this.height:this.width;if(this.ellipsis==="hide")return i;if(this.ellipsis==="add")return i+this.ellipsisWidth;if(this.ellipsis==="replace"){const o=pu(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,o),e+=this.ellipsisStr;const{width:r}=lr(this.text.slice(o),this.character);return i+this.ellipsisWidth-r}return i}}function LR(n,t){const e=n.text.slice(0,t),i=n.text.slice(t);return[new Bs(e,n.newLine,n.character),new Bs(i,!0,n.character)]}const uv=["width","height","image",...zi];let Eo=class mf extends pi{constructor(t){super(t),this.type="image",this.numberType=ta,this.loadImage(this.attribute.image)}get width(){var t;return(t=this.attribute.width)!==null&&t!==void 0?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return(t=this.attribute.height)!==null&&t!==void 0?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return(t=this.attribute.repeatX)!==null&&t!==void 0?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return(t=this.attribute.repeatY)!==null&&t!==void 0?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,()=>{this.successCallback&&this.successCallback()})}imageLoadFail(t,e){super.imageLoadFail(t,()=>{this.failCallback&&this.failCallback()})}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,o){return t==="image"&&this.loadImage(e),super.setAttribute(t,e,i,o)}getGraphicTheme(){return Ht(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:l=e.height}=t;i.set(0,0,s,l)}const{tb1:o,tb2:r}=X.graphicService.updateTempAABBBounds(i);return As(t,e,o),i.union(o),o.setValue(r.x1,r.y1,r.x2,r.y2),X.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ls[t]}needUpdateTags(t){return super.needUpdateTags(t,uv)}needUpdateTag(t){return super.needUpdateTag(t,uv)}clone(){return new mf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mf.NOWORK_ANIMATE_ATTR}};Eo.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ji);function Pa(n){return new Eo(n)}class kn extends Eo{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],t.backgroundShowMode==="always"&&(this._hovered=!0),t.margin){const e=gs(t.margin);this._marginArray=typeof e=="number"?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(e,i,o)=>{if(it(o)&&o.indexOf("margin")!==-1||o==="margin")if(i.margin){const r=gs(i.margin);this._marginArray=typeof r=="number"?[r,r,r,r]:r}else this._marginArray=[0,0,0,0]}}get width(){var t;return((t=this.attribute.width)!==null&&t!==void 0?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return((t=this.attribute.height)!==null&&t!==void 0?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=ls.width,height:e=ls.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:o=e}=this.attribute,r=(i-t)/2,s=(o-e)/2;return this._AABBBounds.expand([0,2*r,2*s,0]),this._AABBBounds}setHoverState(t){this.attribute.backgroundShowMode==="hover"&&this._hovered!==t&&(this._hovered=t)}}class FR{constructor(t,e,i,o,r,s,l,a){this.left=t,this.width=e,this.baseline=i,this.ascent=o,this.descent=r,this.top=i-o,this.paragraphs=s.map(d=>d),this.textAlign=(this.paragraphs[0]instanceof kn?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=l,this.directionKey=fu[this.direction],this.actualWidth=0;let h=0;this.paragraphs.forEach((d,u)=>{if(u===0&&d instanceof Bs){const c=iS.exec(d.text);(c==null?void 0:c.index)!==0&&(d.text=d.text.slice(c==null?void 0:c.index),d.updateWidth())}this.actualWidth+=d[this.directionKey.width],h=Math.max(d[this.directionKey.height],h)}),this.height=h,this.blankWidth=a?0:this.width-this.actualWidth,this.calcOffset(e,a)}calcOffset(t,e){const i=this.directionKey,o=this.height;let r=this.left,s=0;this.actualWidth<t&&!e&&(this.textAlign==="right"||this.textAlign==="end"?r=t-this.actualWidth:this.textAlign==="center"?r=(t-this.actualWidth)/2:this.textAlign==="justify"&&(this.paragraphs.length<2?r=(t-this.actualWidth)/2:s=(t-this.actualWidth)/(this.paragraphs.length-1))),this.paragraphs.map(function(l){l instanceof kn?(l["_"+i.x]=r,r+=l[i.width]+s,l["_"+i.y]=l.attribute.textBaseline==="top"?0:l.attribute.textBaseline==="bottom"?o-l.height:(o-l.height)/2):(l[i.left]=r,r+=l[i.width]+s)})}draw(t,e,i,o,r,s){if(r&&(e||this.paragraphs.some(l=>l.overflow))){let l=!0,a=!1;for(let d=this.paragraphs.length-1;d>=0;d--){const u=this.paragraphs[d];if(u.overflow)l=l&&u.text==="";else if(l){a=!0;break}}let h=0;if(!a)for(let d=this.paragraphs.length-1;d>=0;d--){const u=this.paragraphs[d];if(u.overflow){if(u.text==="")break;continue}if(u instanceof kn)break;if(this.direction==="vertical"&&u.direction!=="vertical"){u.verticalEllipsis=!0;break}const c=r===!0?"...":r||"";u.ellipsisStr=c;const{width:g}=lr(c,u.character),f=g||0;if(f<=this.blankWidth+h){e&&(u.ellipsis="add");break}if(f<=this.blankWidth+h+u.width){u.ellipsis="replace",u.ellipsisWidth=f,u.ellipsisOtherParagraphWidth=this.blankWidth+h;break}u.ellipsis="hide",h+=u.width}}this.paragraphs.map((l,a)=>{if(l instanceof kn)return l.setAttributes({x:i+l._x,y:o+l._y}),void s(l,t,i+l._x,o+l._y,this.ascent);l.draw(t,o+this.ascent,i,a===0,this.textAlign)})}getWidthWithEllips(t){let e=0;for(let o=this.paragraphs.length-1;o>=0;o--){const r=this.paragraphs[o];if(r instanceof kn)break;const{width:s}=lr(t,r.character),l=s||0;if(l<=this.blankWidth+e){r.ellipsis="add",r.ellipsisWidth=l;break}if(l<=this.blankWidth+e+r.width){r.ellipsis="replace",r.ellipsisWidth=l,r.ellipsisOtherParagraphWidth=this.blankWidth+e;break}r.ellipsis="hide",e+=r.width}let i=0;return this.paragraphs.map((o,r)=>{i+=o instanceof kn?o.width:o.getWidthWithEllips(this.direction)}),i}}class kR{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=fu[this.direction]}store(t){if(t instanceof kn){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;t.attribute.textBaseline==="top"?(e=0,i=t.height):t.attribute.textBaseline==="bottom"?(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),t.text.length!==0?(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(this.lineBuffer.length===0)return;const t=this.maxAscent===0?this.maxAscentForBlank:this.maxAscent,e=this.maxDescent===0?this.maxDescentForBlank:this.maxDescent,i=new FR(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,this.direction==="horizontal"?this.frame.isWidthMax:this.frame.isHeightMax);this.frame.lines.push(i),this.frame.actualHeight+=i.height,this.y+=i.height,this.lineBuffer.length=0,this.lineWidth=this.maxAscent=this.maxDescent=this.maxAscentForBlank=this.maxDescentForBlank=0}deal(t,e=!1){t instanceof kn?this.direction==="horizontal"&&this.width===0||this.direction==="vertical"&&this.height===0||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineBuffer.length===0?(this.store(t),this.send()):(this.send(),this.deal(t)):typeof this.width!="number"||this.width<0||(t.newLine&&this.send(),t.text.length!==0&&(this.direction==="horizontal"&&this.width===0||this.direction==="vertical"&&this.height===0||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,o=Math.ceil(i/t[this.directionKey.width]*t.length)||0,r=pu(t.text,i,t.character,o,this.frame.wordBreak==="break-word");if(r!==0){const[s,l]=LR(t,r);this.store(s),e?this.send():this.deal(l)}else this.lineBuffer.length!==0&&(this.send(),this.deal(t))}}const cv=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize",...zi];class rn extends pi{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Pu,this.onBeforeAttributeUpdate=(e,i,o)=>{for(const r in e)if(r==="hoverIconId"){if(e[r]===i[r])continue;const s=this._frameCache.icons.get(e[r]);this.updateHoverIconState(s)}}}get width(){var t;return(t=this.attribute.width)!==null&&t!==void 0?t:Tn.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return(t=this.attribute.height)!==null&&t!==void 0?t:Tn.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(t=this.attribute.ellipsis)!==null&&t!==void 0?t:Tn.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return(t=this.attribute.wordBreak)!==null&&t!==void 0?t:Tn.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return(t=this.attribute.verticalDirection)!==null&&t!==void 0?t:Tn.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return(t=this.attribute.textAlign)!==null&&t!==void 0?t:Tn.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return(t=this.attribute.textBaseline)!==null&&t!==void 0?t:Tn.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return(t=this.attribute.textConfig)!==null&&t!==void 0?t:Tn.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Ht(this).richtext}updateAABBBounds(t,e,i){const{width:o=e.width,height:r=e.height,maxWidth:s=e.maxWidth,maxHeight:l=e.maxHeight,textAlign:a=e.textAlign,textBaseline:h=e.textBaseline}=t;if(o>0&&r>0)i.set(0,0,o,r);else{const c=this.getFrameCache(),{width:g,height:f}=c.getActualSize();let p=o||g||0,v=r||f||0;v=typeof l=="number"&&v>l?l:v||0,p=typeof s=="number"&&p>s?s:p||0,i.set(0,0,p,v)}let d=0;switch(h){case"top":d=0;break;case"middle":d=-i.height()/2;break;case"bottom":d=-i.height()}let u=0;switch(a){case"left":u=0;break;case"center":u=-i.width()/2;break;case"right":u=-i.width()}return i.translate(u,d),X.graphicService.updateTempAABBBounds(i),t.forceBoundsHeight==null&&t.forceBoundsWidth==null||X.graphicService.updateHTMLTextAABBBounds(t,e,i),X.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,cv)}needUpdateTag(t){return super.needUpdateTag(t,cv)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let i=0;i<t.lines.length;i++){const o=t.lines[i];for(let r=0;r<o.paragraphs.length;r++){const s=o.paragraphs[r];if(s.overflow&&s.text!=="")return!0}}return!1}combinedStyleToCharacter(t){const{fill:e,stroke:i,fontSize:o,fontFamily:r,fontStyle:s,fontWeight:l,lineWidth:a,opacity:h,fillOpacity:d,strokeOpacity:u}=this.attribute;return Object.assign({fill:e,stroke:i,fontSize:o,fontFamily:r,fontStyle:s,fontWeight:l,lineWidth:a,opacity:h,fillOpacity:d,strokeOpacity:u},t)}doUpdateFrameCache(t){var e;const{textConfig:i=[],maxWidth:o,maxHeight:r,width:s,height:l,ellipsis:a,wordBreak:h,verticalDirection:d,textAlign:u,textBaseline:c,layoutDirection:g,singleLine:f,disableAutoWrapLine:p}=this.attribute,v=[],m=t??i;for(let S=0;S<m.length;S++)if("image"in m[S]){const A=this.combinedStyleToCharacter(m[S]);A.lineWidth=void 0;const R=A.id&&this._frameCache&&this._frameCache.icons&&this._frameCache.icons.get(A.id);if(R)v.push(R);else{const T=new kn(A);T.successCallback=()=>{var M;this.addUpdateBoundTag(),(M=this.stage)===null||M===void 0||M.renderNextFrame()},T.richtextId=A.id,v.push(T)}}else{const A=this.combinedStyleToCharacter(m[S]);if(nt(A.text)&&(A.text=`${A.text}`),A.text&&A.text.includes(`
|
|
@@ -303,5 +303,5 @@
|
|
|
303
303
|
border: 1px solid #E6E8ED;
|
|
304
304
|
}
|
|
305
305
|
`,document.head.appendChild(n)}j3();const xl="vtable__bubble-tooltip-element",e1=`${xl}__content`,i1=`${xl}__triangle`,Qr=`${xl}--hidden`,Al=`${xl}--shown`;class G3{constructor(){this._handler=new Lh;const t=this._rootElement=xn("div",[xl,Qr]),e=xn("div",[e1]),i=xn("span",[i1]);t.appendChild(i),t.appendChild(e),this._messageElement=t.querySelector(`.${e1}`)||void 0,this._triangleElement=t.querySelector(`.${i1}`)||void 0,t.addEventListener("mousemove",()=>{this._disappearDelayId&&clearTimeout(this._disappearDelayId)}),t.addEventListener("mouseleave",()=>{this._disappearDelay=void 0,this.unbindFromCell()}),e.addEventListener("wheel",o=>{o.stopPropagation()}),e.addEventListener("copy",o=>{u2(e)&&o.stopPropagation()})}bindToCell(t,e,i,o,r){var s,l,a,h,d,u,c,g,f,p,v,m,b,w,C,_,y,x,S;this._disappearDelay=o==null?void 0:o.disappearDelay,this._disappearDelayId&&clearTimeout(this._disappearDelayId);const A=this._rootElement,R=this._messageElement,T=this._triangleElement;if(A==null||A.classList.remove(Al),A==null||A.classList.add(Qr),this._canBindToCell(t,e,i)){if(R.setAttribute("style",""),T.setAttribute("style",""),o!=null&&o.className&&A.classList.add(o.className),!((s=o==null?void 0:o.style)===null||s===void 0)&&s.bgColor&&(R.style.backgroundColor=(l=o==null?void 0:o.style)===null||l===void 0?void 0:l.bgColor),!((a=o==null?void 0:o.style)===null||a===void 0)&&a.bgColor&&(T.style.backgroundColor=(h=o==null?void 0:o.style)===null||h===void 0?void 0:h.bgColor),T.style.display=((d=o==null?void 0:o.style)===null||d===void 0?void 0:d.arrowMark)===!0?"block":"none",!((u=o==null?void 0:o.style)===null||u===void 0)&&u.fontSize&&(R.style.fontSize=((g=(c=o==null?void 0:o.style)===null||c===void 0?void 0:c.fontSize)!==null&&g!==void 0?g:12)+"px"),!((f=o==null?void 0:o.style)===null||f===void 0)&&f.fontFamily&&(R.style.fontFamily=(p=o==null?void 0:o.style)===null||p===void 0?void 0:p.fontFamily),!((v=o==null?void 0:o.style)===null||v===void 0)&&v.color&&(R.style.color=(m=o==null?void 0:o.style)===null||m===void 0?void 0:m.color),!((b=o==null?void 0:o.style)===null||b===void 0)&&b.padding&&(R.style.padding=`${(w=o==null?void 0:o.style)===null||w===void 0?void 0:w.padding.join("px ")}px`),!((C=o==null?void 0:o.style)===null||C===void 0)&&C.maxHeight&&(R.style.maxHeight=`${(_=o==null?void 0:o.style)===null||_===void 0?void 0:_.maxHeight}px`),!((y=o==null?void 0:o.style)===null||y===void 0)&&y.maxWidth&&(R.style.maxWidth=`${(x=o==null?void 0:o.style)===null||x===void 0?void 0:x.maxWidth}px`),R&&(R.textContent=o==null?void 0:o.content),this._bindToCell(t,e,i,o==null?void 0:o.position,o==null?void 0:o.referencePosition,r,(S=o==null?void 0:o.style)===null||S===void 0?void 0:S.arrowMark))return A==null||A.classList.add(Al),A==null||A.classList.remove(Qr),!0}else this.unbindFromCell();return!1}release(){var t,e;this.unbindFromCell();const i=this._rootElement;i!=null&&i.parentElement&&i.parentElement.removeChild(i),(e=(t=this._handler)===null||t===void 0?void 0:t.release)===null||e===void 0||e.call(t),delete this._rootElement,delete this._messageElement}move(t,e,i,o,r){const s=this._rootElement;this._canBindToCell(t,e,i)?(this._bindToCell(t,e,i,o==null?void 0:o.position,o==null?void 0:o.referencePosition,r),s==null||s.classList.add(Al),s==null||s.classList.remove(Qr)):this.unbindFromCell()}unbindFromCell(){var t;if(this._disappearDelay)this._disappearDelayId=setTimeout(()=>{const e=this._rootElement;e!=null&&e.parentElement&&(e.classList.remove(Al),e.classList.add(Qr))},(t=this._disappearDelay)!==null&&t!==void 0?t:0);else{const e=this._rootElement;e!=null&&e.parentElement&&(e.classList.remove(Al),e.classList.add(Qr))}}_canBindToCell(t,e,i){const o=t.getCellRangeRelativeRect({col:e,row:i}),r=t.getElement(),{bottom:s,left:l,right:a,top:h}=o;if(t.isFrozenCell(e,i))return!0;if(s<t.getFrozenRowsHeight()||a<t.getFrozenColsWidth()||l>t.tableNoFrameWidth-t.getRightFrozenColsWidth()||h>t.tableNoFrameHeight-t.getBottomFrozenRowsHeight())return!1;const{offsetHeight:d,offsetWidth:u}=r;return!(h>d)&&!(l>u)}_bindToCell(t,e,i,o,r,s,l){const a=this._rootElement,h=t.getCellRangeRelativeRect({col:e,row:i}),d=t.internalProps.tooltip.parentElement,u=t.internalProps.element.offsetWidth,{width:c}=h;if(a){let g,f;a.parentElement!==d&&d.appendChild(a),a.style.left="0px";const p=Math.min(.8*u,4*c);a.style.maxWidth=`${p}px`;const v=a.clientWidth,m=a.clientHeight;if(!o&&!r)return!1;{const R=this.getComputedPosition(t,e,i,o,r,s,l);f=R.x,g=R.y}a.style.left=`${f}px`,a.style.top=`${g}px`,dg()&&(a.style.fontSize="11px");const{x1:b,x2:w,y1:C,y2:_}=t.stateManager.menu.bounds,y=f,x=y+v,S=g,A=y+m;return!(t.stateManager.menu.isShow&&b<x&&w>y&&_>S&&C<A)}return!1}getComputedPosition(t,e,i,o,r,s,l){var a;const h=this._rootElement,d=t.getCellRangeRelativeRect({col:e,row:i}),{x:u,y:c}=t.internalProps.tooltip.parentElement.getBoundingClientRect(),{width:g,height:f,x:p,y:v}=t.internalProps.element.getBoundingClientRect(),{width:m}=d;let b,w;const C=Math.min(.8*g,4*m);h.style.maxWidth=`${C}px`;const _=h.clientWidth,y=h.clientHeight,x=l?6:0;if(o)w=o.x,b=o.y+x,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px";else if(r){let S=(a=r.placement)!==null&&a!==void 0?a:Ri.bottom;const A=r.rect.left+r.rect.width/2,R=r.rect.top+r.rect.height/2,T=r.rect.top,M=r.rect.bottom,P=r.rect.left,k=r.rect.right;let B=0;const H=()=>{B++,B>=4||(this.removeStyleFromTriangle(),S===Ri.top?(w=A-_/2,b=T-y-x,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.bottom="-5px",s&&b<0&&(S=Ri.right,H())):S===Ri.bottom?(w=A-_/2,b=M+x,this._triangleElement.style.left="50%",this._triangleElement.style.marginLeft="-5px",this._triangleElement.style.top="-5px",s&&b+y>f&&(S=Ri.left,H())):S===Ri.left?(b=R-y/2,w=P-_-x,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.right="-5px",s&&w<0&&(S=Ri.top,H())):S===Ri.right&&(b=R-y/2,w=k+x,this._triangleElement.style.top="50%",this._triangleElement.style.marginTop="-5px",this._triangleElement.style.left="-5px",s&&w+_>g&&(S=Ri.bottom,H())))};H()}return s&&(w<0?w=0:w+h.offsetWidth>g&&(w=g-h.offsetWidth)),{x:w+p-u,y:b+v-c}}removeStyleFromTriangle(){this._triangleElement.style.left="",this._triangleElement.style.right="",this._triangleElement.style.top="",this._triangleElement.style.bottom="",this._triangleElement.style.marginLeft="",this._triangleElement.style.marginTop=""}_locate(t,e,i,o,r,s){const l=this.getComputedPosition(t,e,i,o,r,s),a=l.x,h=l.y;this._rootElement.style.left=`${a}px`,this._rootElement.style.top=`${h}px`}}class U3 extends V3{createTooltipElementInternal(){return new G3}}const K3={"bubble-tooltip":function(n){return new U3(n)}};class $3{constructor(t,e){this._table=t,this._tooltipInstances={},this._bindTableEvent(t),this.confine=e}release(){var t,e;const i=this._tooltipInstances;for(const o in i)(e=(t=i[o])===null||t===void 0?void 0:t.release)===null||e===void 0||e.call(t);delete this._tooltipInstances,this._attachInfo=null}_bindToCell(t,e,i){var o;const r=this._attachInfo,s=this._getTooltipInstanceInfo(t,e);if(!r||s&&r.instance===s||((o=r.instance)===null||o===void 0||o.unbindTooltipElement(),this._attachInfo=null),!!s&&s&&s.bindTooltipElement(t,e,i,this.confine)){const l=this._table.getCellRange(t,e);this._attachInfo={range:l,instance:s,tooltipOptions:i}}}_move(t,e,i){const o=this._attachInfo;if(!o||!Ti(o.range,t,e))return;const{instance:r}=o;r==null||r.moveTooltipElement(t,e,i,this.confine)}moveToPosition(t,e,i,o){const r=this._attachInfo;if(!r||!Ti(r.range,t,e))return;const{instance:s}=r;this._attachInfo.tooltipOptions.position=i,this._attachInfo.tooltipOptions.referencePosition=o,s==null||s.locateTooltipElement(t,e,i,o,this.confine)}_unbindFromCell(){const t=this._attachInfo;if(!t)return;const{instance:e}=t;e==null||e.unbindTooltipElement(),this._attachInfo=null}_isBindCell(t,e){const i=this._attachInfo;return!!i&&Ti(i.range,t,e)}_bindTableEvent(t){t.on(J.MOUSEENTER_CELL,e=>{if(dg())return;const{x1:i,x2:o,y1:r,y2:s}=t.stateManager.menu.bounds;if(t.stateManager.menu.isShow&&typeof e.x=="number"&&typeof e.y=="number"&&e.x>i&&e.x<o&&e.y>r&&e.y<s)return;const{col:l,row:a}=e;this.showTooltip(l,a)}),t.on(J.MOUSEMOVE_CELL,e=>{var i,o;if(!dg()){if(!((o=(i=this._attachInfo)===null||i===void 0?void 0:i.tooltipOptions)===null||o===void 0)&&o.referencePosition){const r=this._attachInfo.tooltipOptions.referencePosition,{event:s}=e,{left:l,right:a,top:h,bottom:d}=r.rect,u=t._getMouseAbstractPoint(s,!1);u.inTable&&u.x>=l-5&&u.x<=a+5&&u.y>=h-5&&u.y<=d+5||this._unbindFromCell()}this._attachInfo&&t.stateManager.menu.isShow&&this._bindToCell(e.col,e.row)}}),t.on(J.MOUSELEAVE_CELL,e=>{this._unbindFromCell()}),t.on(J.SELECTED_CELL,e=>{this._isBindCell(e.col,e.row)&&this._unbindFromCell()}),t.on(J.MOUSELEAVE_TABLE,e=>{this._unbindFromCell()}),t.on(J.SCROLL,e=>{this._unbindFromCell()})}showTooltip(t,e){var i,o,r;let s;const l=this._table,a=l.getHeaderDescription(t,e);if(a){const h=l.getCellRangeRelativeRect({col:t,row:e});s={content:a,referencePosition:{placement:Ri.bottom,rect:h},disappearDelay:(i=l.internalProps.tooltip.overflowTextTooltipDisappearDelay)!==null&&i!==void 0?i:0,style:l.theme.tooltipStyle}}else if(jt((o=l.internalProps.tooltip)===null||o===void 0?void 0:o.isShowOverflowTextTooltip)?l.internalProps.tooltip.isShowOverflowTextTooltip(t,e,l):l.internalProps.tooltip.isShowOverflowTextTooltip){const h=l.getCellOverflowText(t,e),d=l.getCellRangeRelativeRect({col:t,row:e});h&&(s={content:a?`${a}
|
|
306
|
-
${h}`:h,referencePosition:{placement:Ri.bottom,rect:d},disappearDelay:(r=l.internalProps.tooltip.overflowTextTooltipDisappearDelay)!==null&&r!==void 0?r:0,style:l.theme.tooltipStyle})}s?this._bindToCell(t,e,s):this._unbindFromCell()}_getTooltipInstanceInfo(t,e){const i=this._table,o=this._tooltipInstances;return o&&o["bubble-tooltip"]||o&&(o["bubble-tooltip"]=K3["bubble-tooltip"](i))}isBinded(t){var e;return JSON.stringify(t)===JSON.stringify((e=this._attachInfo)===null||e===void 0?void 0:e.tooltipOptions)}}const Y3=()=>{St.registerComponent("axis",b3),St.registerFunction("computeAxisComponentWidth",y3),St.registerFunction("computeAxisComponentHeight",w3),St.registerFunction("getAxisConfigInPivotChart",PI)},X3=()=>{St.registerComponent("emptyTip",x3)},q3=()=>{St.registerFunction("createLegend",F3)},Z3=()=>{St.registerComponent("menuHandler",W3)},J3=()=>{St.registerComponent("title",N3)},Q3=()=>{St.registerComponent("tooltipHandler",$3)},tz={};function ez(){return qs(tz,VI)}function iz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b){var w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q;const j=ez()[d],rt=f._getCellStyle(o,r),ht=Kh("padding",rt,o,r,f);if(I(ht)&&(a=ht),!n){const gt=$o(o,r,p,f);m&&(n=f.scenegraph.highPerformanceGetCell(o,r,!0))&&n.role==="cell"&&n.setAttributes({x:e,y:i,width:s,height:l,lineWidth:(C=(w=p==null?void 0:p.group)===null||w===void 0?void 0:w.lineWidth)!==null&&C!==void 0?C:void 0,fill:(y=(_=p==null?void 0:p.group)===null||_===void 0?void 0:_.fill)!==null&&y!==void 0?y:void 0,stroke:(S=(x=p==null?void 0:p.group)===null||x===void 0?void 0:x.stroke)!==null&&S!==void 0?S:void 0,strokeArrayWidth:gt,strokeArrayColor:(R=(A=p==null?void 0:p.group)===null||A===void 0?void 0:A.strokeArrayColor)!==null&&R!==void 0?R:void 0,cursor:(M=(T=p==null?void 0:p.group)===null||T===void 0?void 0:T.cursor)!==null&&M!==void 0?M:void 0,lineDash:(k=(P=p==null?void 0:p.group)===null||P===void 0?void 0:P.lineDash)!==null&&k!==void 0?k:void 0,lineCap:"butt",clip:!0,cornerRadius:p.group.cornerRadius}),n&&n.role==="cell"||((n=new Kt({x:e,y:i,width:s,height:l,lineWidth:(H=(B=p==null?void 0:p.group)===null||B===void 0?void 0:B.lineWidth)!==null&&H!==void 0?H:void 0,fill:(F=(E=p==null?void 0:p.group)===null||E===void 0?void 0:E.fill)!==null&&F!==void 0?F:void 0,stroke:(z=(L=p==null?void 0:p.group)===null||L===void 0?void 0:L.stroke)!==null&&z!==void 0?z:void 0,strokeArrayWidth:gt,strokeArrayColor:(N=(D=p==null?void 0:p.group)===null||D===void 0?void 0:D.strokeArrayColor)!==null&&N!==void 0?N:void 0,cursor:(G=(V=p==null?void 0:p.group)===null||V===void 0?void 0:V.cursor)!==null&&G!==void 0?G:void 0,lineDash:(Z=(U=p==null?void 0:p.group)===null||U===void 0?void 0:U.lineDash)!==null&&Z!==void 0?Z:void 0,lineCap:"butt",clip:!0,cornerRadius:p.group.cornerRadius})).role="cell",n.col=o,n.row=r,t==null||t.addCellGroup(n))}if(n.AABBBounds.width(),b&&Array.isArray(f.getCellValue(o,r))||!b){const gt=new Vr(v,{stroke:!1,x:a[3],y:a[0],canvas:(q=f.canvas)!==null&&q!==void 0?q:f.scenegraph.stage.window.getContext().canvas,mode:f.options.mode,modeParams:f.options.modeParams,spec:u,ClassType:j,width:s-a[3]-a[1],height:l-a[2]-a[0],chartInstance:c,dataId:g,data:f.getCellValue(o,r)||[],cellPadding:a,dpr:f.internalProps.pixelRatio,axes:f.isPivotChart()?f.internalProps.layoutMap.getChartAxes(o,r):[],tableChartOption:f.options.chartOption});n.appendChild(gt),f.internalProps.layoutMap.setChartInstance(o,r,gt.chartInstance)}return n}function nz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m){var b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U;if(!n){const ht=$o(o,r,f,g);m&&(n=g.scenegraph.highPerformanceGetCell(o,r,!0))&&n.role==="cell"&&n.setAttributes({x:e,y:i,width:l,height:a,lineWidth:(w=(b=f==null?void 0:f.group)===null||b===void 0?void 0:b.lineWidth)!==null&&w!==void 0?w:void 0,fill:(_=(C=f==null?void 0:f.group)===null||C===void 0?void 0:C.fill)!==null&&_!==void 0?_:void 0,stroke:(x=(y=f==null?void 0:f.group)===null||y===void 0?void 0:y.stroke)!==null&&x!==void 0?x:void 0,strokeArrayWidth:ht,strokeArrayColor:(A=(S=f==null?void 0:f.group)===null||S===void 0?void 0:S.strokeArrayColor)!==null&&A!==void 0?A:void 0,cursor:(T=(R=f==null?void 0:f.group)===null||R===void 0?void 0:R.cursor)!==null&&T!==void 0?T:void 0,lineDash:(P=(M=f==null?void 0:f.group)===null||M===void 0?void 0:M.lineDash)!==null&&P!==void 0?P:void 0,lineCap:"butt",clip:!0,cornerRadius:f.group.cornerRadius}),n&&n.role==="cell"||((n=new Kt({x:e,y:i,width:l,height:a,lineWidth:(B=(k=f==null?void 0:f.group)===null||k===void 0?void 0:k.lineWidth)!==null&&B!==void 0?B:void 0,fill:(E=(H=f==null?void 0:f.group)===null||H===void 0?void 0:H.fill)!==null&&E!==void 0?E:void 0,stroke:(L=(F=f==null?void 0:f.group)===null||F===void 0?void 0:F.stroke)!==null&&L!==void 0?L:void 0,strokeArrayWidth:ht,strokeArrayColor:(D=(z=f==null?void 0:f.group)===null||z===void 0?void 0:z.strokeArrayColor)!==null&&D!==void 0?D:void 0,cursor:(V=(N=f==null?void 0:f.group)===null||N===void 0?void 0:N.cursor)!==null&&V!==void 0?V:void 0,lineDash:(U=(G=f==null?void 0:f.group)===null||G===void 0?void 0:G.lineDash)!==null&&U!==void 0?U:void 0,lineCap:"butt",clip:!0,cornerRadius:f.group.cornerRadius})).role="cell",n.col=o,n.row=r,t==null||t.addCellGroup(n))}let Z;if(c){let ht=o,gt=r;v&&(ht=v.start.col,gt=v.start.row),Z=g.getCellIcons(ht,gt)}let q=0,j=0;if(Array.isArray(Z)&&Z.length!==0){const{leftIconWidth:ht,rightIconWidth:gt,absoluteLeftIconWidth:vt,absoluteRightIconWidth:W}=qh(Z,n,v,g);q=ht+gt,j=ht,n.forEachChildren(O=>{O.role==="icon-left"?O.setAttribute("x",O.attribute.x+h[3]):O.role==="icon-right"?O.setAttribute("x",O.attribute.x+l-gt-h[1]):O.role==="icon-absolute-right"&&O.setAttribute("x",O.attribute.x+l-W-h[1])}),n.forEachChildren(O=>{u==="middle"?O.setAttribute("y",(a-O.AABBBounds.height())/2):u==="bottom"?O.setAttribute("y",a-O.AABBBounds.height()-h[2]):O.setAttribute("y",h[0])})}const rt=oz(o,r,s-q,l,a,h,f,p,g);return rt&&n.appendChild(rt),rt.render(),l-=h[1]+h[3]+q,a-=h[0]+h[2],d==="center"?rt.setAttribute("x",h[3]+j+(l-rt.AABBBounds.width())/2):d==="right"?rt.setAttribute("x",h[3]+j+l-rt.AABBBounds.width()):rt.setAttribute("x",h[3]+j),u==="middle"?rt.setAttribute("y",h[0]+(a-rt.AABBBounds.height())/2):u==="bottom"?rt.setAttribute("y",h[0]+a-rt.AABBBounds.height()):rt.setAttribute("y",h[0]),n}function oz(n,t,e,i,o,r,s,l,a){var h,d,u,c;const g=a._getCellStyle(n,t),f=lt("size",g,n,t,a),p=lt("spaceBetweenTextAndIcon",g,n,t,a),v=lt("defaultFill",g,n,t,a),m=lt("defaultStroke",g,n,t,a),b=lt("disableFill",g,n,t,a),w=lt("checkedFill",g,n,t,a),C=lt("checkedStroke",g,n,t,a),_=lt("disableCheckedFill",g,n,t,a),y=lt("disableCheckedStroke",g,n,t,a),x=lt("checkIconImage",g,n,t,a),S=lt("indeterminateIconImage",g,n,t,a),A=a.getCellValue(n,t),R=a.getCellOriginValue(n,t);let T,M,P=(h=A)!==null&&h!==void 0?h:"";$t(A)?(T=A.checked,M=A.disable,P=(d=A.text)!==null&&d!==void 0?d:""):typeof A=="boolean"&&(T=A,P=""),T=a.stateManager.syncCheckedState(n,t,l.field,T);const k=hn(n,t,a),B=a._getCellStyle(n,t),H=(u=B.autoWrapText)!==null&&u!==void 0?u:a.internalProps.autoWrapText,{lineClamp:E}=B,{checked:F,disable:L}=l;if(T==null||typeof T=="function"){const Z=xe(F,{col:n,row:t,table:a,context:null,value:A,dataValue:R});T=a.stateManager.syncCheckedState(n,t,l.field,Z)}const z=xe(L,{col:n,row:t,table:a,context:null,value:A,dataValue:R}),D=e==="auto",N=a.isAutoRowHeight(t),V={text:P.length===1?P[0]:P,maxLineWidth:D?1/0:i-(r[1]+r[3]+k)-f-p,textBaseline:"top",autoWrapText:H,lineClamp:E,wordBreak:"break-word",heightLimit:N?-1:o-Math.floor(r[0]+r[2]),pickable:!1,dx:k,whiteSpace:P.length!==1||H?"normal":"no-wrap"},G={x:0,y:0,text:s.text?Object.assign({},s.text,V):V,icon:{width:Math.floor(f/1.4),height:Math.floor(f/1.4)},box:{width:f,height:f},spaceBetweenTextAndIcon:p,disabled:(c=M??z)!==null&&c!==void 0&&c};T==="indeterminate"?(G.checked=void 0,G.indeterminate=!0):(G.checked=T,G.indeterminate=void 0),v&&(G.box.fill=v),m&&(G.box.stroke=m),b&&(G.box.disableFill=b),w&&(G.box.checkedFill=w),C&&(G.box.checkedStroke=C),_&&(G.box.disableCheckedFill=_),y&&(G.box.disableCheckedStroke=y),x&&(G.icon.checkIconImage=x),S&&(G.icon.indeterminateIconImage=S);const U=new kr(G);return U.name="checkbox",U}function rz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f){var p,v,m,b,w,C,_,y,x,S,A,R;if(!n){const P=$o(o,r,g,c);(n=new Kt({x:e,y:i,width:l,height:a,lineWidth:(v=(p=g==null?void 0:g.group)===null||p===void 0?void 0:p.lineWidth)!==null&&v!==void 0?v:void 0,fill:(b=(m=g==null?void 0:g.group)===null||m===void 0?void 0:m.fill)!==null&&b!==void 0?b:void 0,stroke:(C=(w=g==null?void 0:g.group)===null||w===void 0?void 0:w.stroke)!==null&&C!==void 0?C:void 0,strokeArrayWidth:P,strokeArrayColor:(y=(_=g==null?void 0:g.group)===null||_===void 0?void 0:_.strokeArrayColor)!==null&&y!==void 0?y:void 0,cursor:(S=(x=g==null?void 0:g.group)===null||x===void 0?void 0:x.cursor)!==null&&S!==void 0?S:void 0,lineDash:(R=(A=g==null?void 0:g.group)===null||A===void 0?void 0:A.lineDash)!==null&&R!==void 0?R:void 0,lineCap:"butt",clip:!0,cornerRadius:g.group.cornerRadius})).role="cell",n.col=o,n.row=r,t==null||t.addCellGroup(n)}const{width:T,height:M}=sz(o,r,s,l,a,h,g,f,n,c);return l-=h[1]+h[3],a-=h[0]+h[2],n.forEachChildren(P=>{d==="center"?P.setAttribute("x",h[3]+P.attribute.x+(l-T)/2):d==="right"?P.setAttribute("x",h[3]+P.attribute.x+l-T):P.setAttribute("x",h[3]+P.attribute.x),u==="middle"?P.setAttribute("y",h[0]+P.attribute.y+(a-M)/2):u==="bottom"?P.setAttribute("y",h[0]+P.attribute.y+a-M):P.setAttribute("y",h[0]+P.attribute.y)}),n}function sz(n,t,e,i,o,r,s,l,a,h){var d,u;const c=h._getCellStyle(n,t);let g=lt("size",c,n,t,h),f=lt("innerRadius",c,n,t,h),p=lt("outerRadius",c,n,t,h);const v=lt("spaceBetweenTextAndIcon",c,n,t,h),m=lt("spaceBetweenRadio",c,n,t,h),b=lt("defaultFill",c,n,t,h),w=lt("defaultStroke",c,n,t,h),C=lt("disableFill",c,n,t,h),_=lt("checkedFill",c,n,t,h),y=lt("checkedStroke",c,n,t,h),x=lt("disableCheckedFill",c,n,t,h),S=lt("disableCheckedStroke",c,n,t,h);nt(p)?g=2*p:p=Math.round(g/2),(!nt(f)||f<0)&&(f=Math.round(p/7*3));const A=h.getCellValue(n,t),R=h.getCellOriginValue(n,t),T=hn(n,t,h),M=h._getCellStyle(n,t),P=(d=M.autoWrapText)!==null&&d!==void 0?d:h.internalProps.autoWrapText,{lineClamp:k}=M,B=e==="auto",H=h.heightMode==="autoHeight",E={maxLineWidth:B?1/0:i-(r[1]+r[3]+T)-g-v,textBaseline:"top",autoWrapText:P,lineClamp:k,wordBreak:"break-word",heightLimit:H?-1:o-Math.floor(r[0]+r[2]),pickable:!1,dx:T},F={x:0,y:0,text:s.text?Object.assign({},s.text,E):E,circle:{innerRadius:f,outerRadius:p},spaceBetweenTextAndIcon:v};b&&(F.circle.fill=b),w&&(F.circle.stroke=w),C&&(F.circle.disableFill=C),_&&(F.circle.checkedFill=_),y&&(F.circle.checkedStroke=y),x&&(F.circle.disableCheckedFill=x),S&&(F.circle.disableCheckedStroke=S);let L=0,z=0;const D=(u=l.radioDirectionInCell)!==null&&u!==void 0?u:"vertical";if(it(A))A.forEach((N,V)=>{const G=n1(N,R,V,n,t,l,P,F,h);G&&a.appendChild(G),G.id=`radio-${n}-${t}-${V}`,G.render();const U=G.AABBBounds;D==="vertical"?(G.setAttribute("y",z),z+=U.height()+(V!==A.length-1?m:0),L=Math.max(L,U.width())):D==="horizontal"&&(G.setAttribute("x",L),L+=U.width()+(V!==A.length-1?m:0),z=Math.max(z,U.height()))});else{const N=n1(A,R,void 0,n,t,l,P,F,h);N&&a.appendChild(N),N.id=`radio-${n}-${t}`,N.render();const V=N.AABBBounds;L=V.width(),z=V.height()}return{width:L,height:z}}function n1(n,t,e,i,o,r,s,l,a){const h=lz(n,t,e,i,o,r,a),d=az(n,t,i,o,r,a),u=$t(n)?n.text:ze(n)?"":n??"",c=dt({},l,{checked:h,disabled:d,text:{text:u.length===1?u[0]:u,whiteSpace:u.length!==1||s?"normal":"no-wrap"},boundsPadding:0}),g=new Ir(c);return g.name="radio",g}function lz(n,t,e,i,o,r,s){var l,a;const h=(l=r.radioCheckType)!==null&&l!==void 0?l:"column";let d,u;return $t(n)?d=n.checked:typeof n=="boolean"&&(d=n),d=s.stateManager.syncRadioState(i,o,r.field,h,e,d),d!=null&&typeof d!="function"||(u=xe(r.checked,{col:i,row:o,table:s,context:null,value:n,dataValue:t}),d=s.stateManager.syncRadioState(i,o,r.field,h,e,u)),(a=d??u)!==null&&a!==void 0&&a}function az(n,t,e,i,o,r){var s;let l;$t(n)&&(l=n.disable);const a=xe(o.disable,{col:e,row:i,table:r,context:null,value:n,dataValue:t});return(s=l??a)!==null&&s!==void 0&&s}const mo=new rH,bo=new ko;function hz(n,t,e,i,o,r,s,l,a,h,d,u){var c,g,f,p,v,m,b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L;if(!n){const D=$o(o,r,d,h);u&&(n=h.scenegraph.highPerformanceGetCell(o,r,!0))&&n.role==="cell"&&n.setAttributes({x:e,y:i,width:s,height:l,lineWidth:(g=(c=d==null?void 0:d.group)===null||c===void 0?void 0:c.lineWidth)!==null&&g!==void 0?g:void 0,fill:(p=(f=d==null?void 0:d.group)===null||f===void 0?void 0:f.fill)!==null&&p!==void 0?p:void 0,stroke:(m=(v=d==null?void 0:d.group)===null||v===void 0?void 0:v.stroke)!==null&&m!==void 0?m:void 0,strokeArrayWidth:D,strokeArrayColor:(w=(b=d==null?void 0:d.group)===null||b===void 0?void 0:b.strokeArrayColor)!==null&&w!==void 0?w:void 0,cursor:(_=(C=d==null?void 0:d.group)===null||C===void 0?void 0:C.cursor)!==null&&_!==void 0?_:void 0,lineDash:(x=(y=d==null?void 0:d.group)===null||y===void 0?void 0:y.lineDash)!==null&&x!==void 0?x:void 0,lineCap:"butt",clip:!0,cornerRadius:d.group.cornerRadius}),n&&n.role==="cell"||((n=new Kt({x:e,y:i,width:s,height:l,lineWidth:(A=(S=d==null?void 0:d.group)===null||S===void 0?void 0:S.lineWidth)!==null&&A!==void 0?A:void 0,fill:(T=(R=d==null?void 0:d.group)===null||R===void 0?void 0:R.fill)!==null&&T!==void 0?T:void 0,stroke:(P=(M=d==null?void 0:d.group)===null||M===void 0?void 0:M.stroke)!==null&&P!==void 0?P:void 0,strokeArrayWidth:D,strokeArrayColor:(B=(k=d==null?void 0:d.group)===null||k===void 0?void 0:k.strokeArrayColor)!==null&&B!==void 0?B:void 0,cursor:(E=(H=d==null?void 0:d.group)===null||H===void 0?void 0:H.cursor)!==null&&E!==void 0?E:void 0,lineDash:(L=(F=d==null?void 0:d.group)===null||F===void 0?void 0:F.lineDash)!==null&&L!==void 0?L:void 0,lineCap:"butt",clip:!0,cornerRadius:d.group.cornerRadius})).role="cell",n.col=o,n.row=r,t==null||t.addCellGroup(n))}const z=dz(o,r,s,l,a,h);return z&&n.appendChild(z),n}function dz(n,t,e,i,o,r){let s,l;const a=r.internalProps.layoutMap.getBody(n,t).sparklineSpec,h=r.getCellValue(n,t);if(!Array.isArray(h))return;const d=o[3],u=o[0];e-=o[1]+o[3];const c=i-=o[0]+o[2];if(typeof a=="function"){const w={col:n,row:t,dataValue:r.getCellOriginValue(n,t)||"",value:r.getCellValue(n,t)||"",rect:r.getCellRangeRelativeRect(r.getCellRange(n,t)),table:r};s=a(w),l=o1(s,d,u,e,i)}else s=a,l=o1(a,d,u,e,i);const g=[],f=[];let p,v;if(typeof s.xField=="object")mo.domain(s.xField.domain),p=s.xField.field;else if(typeof s.xField=="string"){const w=h.map(C=>C[s.xField]);mo.domain(w),p=s.xField}else Array.isArray(h)&&(mo.domain(Array.from({length:h.length},(w,C)=>C)),p=s.xField);if(mo.range([0,e]),typeof s.yField=="object")bo.domain(s.yField.domain),v=s.yField.field;else if(typeof s.yField=="string"){const w=r1(h,s.yField);bo.domain([Math.min(...w),Math.max(...w)]),v=s.yField}else if(Array.isArray(h)){const w=r1(h);bo.domain([Math.min(...w),Math.max(...w)]),v=s.yField}if(bo.range([0,i]),typeof s.xField=="object"&&Array.isArray(s.xField.domain)){const w=h.map(_=>_[s.xField.field]),C=s.xField.domain;for(let _=0;_<C.length;_++){let y=!1;for(let x=0;x<w.length;x++)if(C[_]===w[x]){const S=h[x];if(!I(S[p])||!I(S[v]))break;g.push({x:0+mo.scale(S[p]),y:c-bo.scale(S[v]),defined:I(S[v])}),f.push(S),y=!0;break}y||(g.push({x:0+mo.scale(C[_]),y:0,defined:!1}),f.push({[p]:C[_],[v]:null}))}}else for(let w=0;w<h.length;w++){const C=h[w];g.push({x:0+mo.scale(p?C[p]:w),y:c-bo.scale(v?C[v]:C),defined:I(v?C[v]:C),rawData:C}),f.push(C)}const m=l.getChildByName("sparkline-line");m&&m.setAttribute("points",g),m.bandwidth=mo.step(),m.min=bo.range()[0],m.max=bo.range()[1];const b=l.getChildByName("sparkline-symbol-group");if(b){const w=s.pointShowRule==="isolatedPoint";if(s.pointShowRule==="all")for(let C=0;C<g.length;C++){const{x:_,y,defined:x}=g[C];if(x){const S=Ms({x:_,y});b.appendChild(S)}}else if(w)for(let C=0;C<g.length;C++){const{x:_,y,defined:x}=g[C];if(x&&(!g[C-1]||!g[C-1].defined)&&(!g[C+1]||!g[C+1].defined)){const S=Ms({x:_,y});b.appendChild(S)}}}return l}function o1(n,t,e,i,o){var r,s,l,a,h,d,u,c,g,f,p,v,m,b,w,C,_,y,x,S,A,R;let T;T=typeof n=="function"?n(null):n;const M=new Kt({x:t,y:e,width:i,height:o,stroke:!1,fill:!1});if(M.name="sparkline",T.type==="line"){const P=Si({x:0,y:0,curveType:T.smooth?"monotoneX":"linear",stroke:(l=(s=(r=T.line)===null||r===void 0?void 0:r.style)===null||s===void 0?void 0:s.stroke)!==null&&l!==void 0?l:"blue",lineWidth:(d=(h=(a=T.line)===null||a===void 0?void 0:a.style)===null||h===void 0?void 0:h.strokeWidth)!==null&&d!==void 0?d:2});P.name="sparkline-line",M.addChild(P),T.crosshair&&(P.hover=(c=(u=T.crosshair)===null||u===void 0?void 0:u.style)!==null&&c!==void 0?c:{stroke:"#000",interpolate:"linear"});const k=new Kt({x:0,y:0,width:i,height:o,stroke:!1,fill:!1});k.name="sparkline-symbol-group",k.setTheme({symbol:{stroke:(p=(f=(g=T.point)===null||g===void 0?void 0:g.style)===null||f===void 0?void 0:f.stroke)!==null&&p!==void 0?p:"#000",lineWidth:(b=(m=(v=T.point)===null||v===void 0?void 0:v.style)===null||m===void 0?void 0:m.strokeWidth)!==null&&b!==void 0?b:1,fill:(_=(C=(w=T.point)===null||w===void 0?void 0:w.style)===null||C===void 0?void 0:C.fill)!==null&&_!==void 0?_:"#000",size:2*((S=(x=(y=T.point)===null||y===void 0?void 0:y.style)===null||x===void 0?void 0:x.size)!==null&&S!==void 0?S:3),symbolType:"circle"}}),M.addChild(k),k.hover=(R=(A=T.point)===null||A===void 0?void 0:A.hover)!==null&&R!==void 0&&R}return M}function r1(n,t){const e=[];for(let i=0;i<n.length;i++){const o=n[i];I(t)&&I(o[t])?e.push(o[t]):!I(t)&&I(o)&&e.push(o)}return e}const cf=an();function uz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p,v){var m,b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht;const gt=g._getCellStyle(i,o),vt=Kh("padding",gt,i,o,g);!((m=g.options.customConfig)===null||m===void 0)&&m.imageMargin?h=kt((b=g.options.customConfig)===null||b===void 0?void 0:b.imageMargin):I(vt)&&(h=vt),!((w=f==null?void 0:f.text)===null||w===void 0)&&w.textAlign&&(d=(C=f==null?void 0:f.text)===null||C===void 0?void 0:C.textAlign),!((_=f==null?void 0:f.text)===null||_===void 0)&&_.textBaseline&&(u=(y=f==null?void 0:f.text)===null||y===void 0?void 0:y.textBaseline);const W=$o(i,o,f,g);let O,Y;if(v&&(O=g.scenegraph.highPerformanceGetCell(i,o,!0),O&&O.role==="cell"&&O.setAttributes({x:t,y:e,width:r,height:s,lineWidth:(S=(x=f==null?void 0:f.group)===null||x===void 0?void 0:x.lineWidth)!==null&&S!==void 0?S:void 0,fill:(R=(A=f==null?void 0:f.group)===null||A===void 0?void 0:A.fill)!==null&&R!==void 0?R:void 0,stroke:(M=(T=f==null?void 0:f.group)===null||T===void 0?void 0:T.stroke)!==null&&M!==void 0?M:void 0,strokeArrayWidth:W,strokeArrayColor:(k=(P=f==null?void 0:f.group)===null||P===void 0?void 0:P.strokeArrayColor)!==null&&k!==void 0?k:void 0,cursor:(H=(B=f==null?void 0:f.group)===null||B===void 0?void 0:B.cursor)!==null&&H!==void 0?H:void 0,lineDash:(F=(E=f==null?void 0:f.group)===null||E===void 0?void 0:E.lineDash)!==null&&F!==void 0?F:void 0,lineCap:"butt",clip:!0,cornerRadius:f.group.cornerRadius})),O&&O.role==="cell"||(O=new Kt({x:t,y:e,width:r,height:s,lineWidth:(z=(L=f==null?void 0:f.group)===null||L===void 0?void 0:L.lineWidth)!==null&&z!==void 0?z:void 0,fill:(N=(D=f==null?void 0:f.group)===null||D===void 0?void 0:D.fill)!==null&&N!==void 0?N:void 0,stroke:(G=(V=f==null?void 0:f.group)===null||V===void 0?void 0:V.stroke)!==null&&G!==void 0?G:void 0,strokeArrayWidth:W,strokeArrayColor:(Z=(U=f==null?void 0:f.group)===null||U===void 0?void 0:U.strokeArrayColor)!==null&&Z!==void 0?Z:void 0,cursor:(j=(q=f==null?void 0:f.group)===null||q===void 0?void 0:q.cursor)!==null&&j!==void 0?j:void 0,lineDash:(ht=(rt=f==null?void 0:f.group)===null||rt===void 0?void 0:rt.lineDash)!==null&&ht!==void 0?ht:void 0,lineCap:"butt",clip:!0,cornerRadius:f.group.cornerRadius}),O.role="cell",O.col=i,O.row=o,n==null||n.addCellGroup(O)),c){let at=i,tt=o;p&&(at=p.start.col,tt=p.start.row),Y=g.getCellIcons(at,tt)}let $=0,Q=0;if(Array.isArray(Y)&&Y.length!==0){const{leftIconWidth:at,rightIconWidth:tt,absoluteLeftIconWidth:_t,absoluteRightIconWidth:yt}=qh(Y,O,p,g);$=at,Q=tt,O.forEachChildren(ut=>{ut.role==="icon-left"?ut.setAttribute("x",ut.attribute.x+h[3]):ut.role==="icon-right"?ut.setAttribute("x",ut.attribute.x+r-tt-h[1]):ut.role==="icon-absolute-right"&&ut.setAttribute("x",ut.attribute.x+r-yt-h[1])}),O.forEachChildren(ut=>{u==="middle"?ut.setAttribute("y",(s-ut.AABBBounds.height())/2):u==="bottom"?ut.setAttribute("y",s-ut.AABBBounds.height()-h[2]):ut.setAttribute("y",h[0])}),O._cellLeftIconWidth=$,O._cellRightIconWidth=Q}const et=g.getCellValue(i,o),ot=document.createElement("video");ot.addEventListener("loadeddata",()=>{a&&t_(i,o,ot.videoWidth,ot.videoHeight,g.scenegraph,h,O);const{width:at,height:tt,isMerge:_t}=Or(O,g);if(l){const{width:Qe,height:$i}=Uh(ot.videoWidth,ot.videoHeight,at-h[1]-h[3],tt-h[0]-h[2]),si=Tg(0,0,at,tt,Qe,$i,d,u,h);K.setAttributes({width:Qe,height:$i,x:si.x,y:si.y,dx:0})}else K.setAttributes({x:h[3],y:h[0],width:at-h[1]-h[3],height:tt-h[2]-h[0],dy:0});_t&&Mg(O.mergeStartCol,O.mergeEndCol,O.mergeStartRow,O.mergeEndRow,g);const{width:yt,height:ut}=Or(O,g),xt=Math.floor(Math.min(yt-h[1]-h[3],ut-h[2]-h[0])/2),de=0+(yt>K.attribute.width?K.attribute.x-0+K.attribute.width/2:yt/2),Re=0+(ut>K.attribute.height?K.attribute.y-0+K.attribute.height/2:ut/2),Ge=new Wo({x:de-xt/2,y:Re-xt/2,width:xt,height:xt,image:cf.play.svg,cursor:cf.play.cursor});Ge.name="play-icon",O.appendChild(Ge),g.scenegraph.updateNextFrame()}),ot.onerror=()=>{K.image=cf.damage_pic.svg},ot.src=et,ot.setAttribute("preload","auto");const K=Pa({x:h[3],y:h[0],width:r-h[1]-h[3],height:s-h[2]-h[0],image:ot,cursor:"pointer"});return K.name="image",K.keepAspectRatio=l,K.textAlign=d,K.textBaseline=u,O.appendChild(K),O}function cz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b){var w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O;const Y=n._getCellStyle(r,s),$=Kh("padding",Y,r,s,n);I($)&&(d=$),!((w=v==null?void 0:v.text)===null||w===void 0)&&w.textAlign&&(u=(C=v==null?void 0:v.text)===null||C===void 0?void 0:C.textAlign),!((_=v==null?void 0:v.text)===null||_===void 0)&&_.textBaseline&&(c=(y=v==null?void 0:v.text)===null||y===void 0?void 0:y.textBaseline);const Q=n.isAutoRowHeight(s),et=l==="auto",ot=(x=Y.autoWrapText)!==null&&x!==void 0?x:n.internalProps.autoWrapText,K=Y.lineClamp,at=$o(r,s,v,n);let tt;if(b&&(tt=n.scenegraph.getCell(r,s,!0),tt&&tt.role==="cell"&&tt.setAttributes({x:i,y:o,width:a,height:h,lineWidth:(A=(S=v==null?void 0:v.group)===null||S===void 0?void 0:S.lineWidth)!==null&&A!==void 0?A:void 0,fill:(T=(R=v==null?void 0:v.group)===null||R===void 0?void 0:R.fill)!==null&&T!==void 0?T:void 0,stroke:(P=(M=v==null?void 0:v.group)===null||M===void 0?void 0:M.stroke)!==null&&P!==void 0?P:void 0,strokeArrayWidth:at??void 0,strokeArrayColor:(B=(k=v==null?void 0:v.group)===null||k===void 0?void 0:k.strokeArrayColor)!==null&&B!==void 0?B:void 0,cursor:(E=(H=v==null?void 0:v.group)===null||H===void 0?void 0:H.cursor)!==null&&E!==void 0?E:void 0,lineDash:(L=(F=v==null?void 0:v.group)===null||F===void 0?void 0:F.lineDash)!==null&&L!==void 0?L:void 0,lineCap:"butt",clip:!0,cornerRadius:v.group.cornerRadius})),tt&&tt.role==="cell"||(tt=new Kt({x:i,y:o,width:a,height:h,lineWidth:(D=(z=v==null?void 0:v.group)===null||z===void 0?void 0:z.lineWidth)!==null&&D!==void 0?D:void 0,fill:(V=(N=v==null?void 0:v.group)===null||N===void 0?void 0:N.fill)!==null&&V!==void 0?V:void 0,stroke:(U=(G=v==null?void 0:v.group)===null||G===void 0?void 0:G.stroke)!==null&&U!==void 0?U:void 0,strokeArrayWidth:at??void 0,strokeArrayColor:(q=(Z=v==null?void 0:v.group)===null||Z===void 0?void 0:Z.strokeArrayColor)!==null&&q!==void 0?q:void 0,cursor:(rt=(j=v==null?void 0:v.group)===null||j===void 0?void 0:j.cursor)!==null&&rt!==void 0?rt:void 0,lineDash:(gt=(ht=v==null?void 0:v.group)===null||ht===void 0?void 0:ht.lineDash)!==null&>!==void 0?gt:void 0,lineCap:"butt",clip:!0,cornerRadius:v.group.cornerRadius}),tt.role="cell",tt.col=r,tt.row=s,e==null||e.addCellGroup(tt)),f&&tt.appendChild(f),p){const _t=t;let yt;if(g){let ut=r,xt=s;m&&(ut=m.start.col,xt=m.start.row),yt=n.getCellIcons(ut,xt)}if(eL(tt,yt,_t,d,et,Q,ot,typeof K=="number"?K:void 0,tt.attribute.width,tt.attribute.height,u,c,n,v,m),(vt=v==null?void 0:v._vtable)===null||vt===void 0?void 0:vt.marked){const ut=ac({x:tt.attribute.width,y:0,startAngle:Math.PI/2,endAngle:Math.PI,outerRadius:6,fill:"#3073F2",pickable:!1});ut.name="mark",tt.appendChild(ut)}}return f&&tt.setAttributes({width:Math.max(tt.attribute.width,(W=f.attribute.width)!==null&&W!==void 0?W:0),height:Math.max(tt.attribute.height,(O=f.attribute.height)!==null&&O!==void 0?O:0)}),tt}function gz(n,t,e,i,o,r,s,l,a,h){var d,u,c,g,f,p;n.dependField&&(o=(u=(d=a.getCellOriginRecord(r,s))===null||d===void 0?void 0:d[n.dependField])!==null&&u!==void 0?u:o),n.barType=(c=n.barType)!==null&&c!==void 0?c:"default",n.min=(g=xe(n.min,{col:r,row:s,table:a,value:i,dataValue:o,cellHeaderPaths:void 0}))!==null&&g!==void 0?g:0,n.max=(f=xe(n.max,{col:r,row:s,table:a,value:i,dataValue:o,cellHeaderPaths:void 0}))!==null&&f!==void 0?f:n.min+100;let v=0;v=h?a.getRowsHeight(h.start.row,h.end.row):a.getRowHeight(s);let m=e,b=v,w=0;nt(a.theme._contentOffset)&&(w=a.theme._contentOffset);const C=new Kt({x:-w,y:-w,width:m,height:b});C.name="progress-bar";const{showBar:_,barColor:y,barBgColor:x,barPositiveColor:S,barNegativeColor:A,barAxisColor:R,barRightToLeft:T,showBarMark:M,barMarkPositiveColor:P,barMarkNegativeColor:k,barMarkWidth:B,barMarkPosition:H}=t;let{barHeight:E,barBottom:F,barPadding:L}=t;L.length===1?L=[L[0],L[0],L[0],L[0]]:L.length===2?L=[L[0],L[1],L[0],L[1]]:L.length===3&&(L=[L[0],L[1],L[2],L[1]]),L=L.map((j,rt)=>{if(typeof j=="string"&&Eh.endsWith(j,"%")){const ht=Number(j.substr(0,j.length-1));return rt===0||rt===2?v*ht/100:e*ht/100}return Number(j)});const z=kt(lt("borderLineWidth",t,r,s,a)),D=Math.max(L[0],Math.ceil(z[0]/2)),N=Math.max(L[1],Math.floor(z[1]/2)),V=Math.max(L[2],Math.floor(z[2]/2)),G=Math.max(L[3],Math.ceil(z[3]/2));m-=N+G,b-=V+D,s===a.rowCount-1&&[0,"0"].includes(F)&&(b-=1);const U=D,Z=G,q=m;if(typeof E=="string"&&Eh.endsWith(E,"%")?(E=Number(E.substr(0,E.length-1)),E=b*E/100):E=Number(E),typeof F=="string"&&Eh.endsWith(F,"%")?(F=Number(F.substr(0,F.length-1)),F=b*F/100):F=Number(F),xe(_,{col:r,row:s,table:a,context:null,value:i,dataValue:o})){let j=`${o}`;Eh.endsWith(j,"%")&&(j=j.substr(0,j.length-1));const rt=Number(j);if(isNaN(rt))return C;if(((p=n.barType)!==null&&p!==void 0?p:"default")==="default"){const ht=rt<n.min?0:rt>n.max?1:(rt-n.min)/(n.max-n.min),gt=m,vt=U+b-E-F;let W=Math.min(gt*ht,gt);const O=T?Z+q-W:Z;r!==a.colCount-1||ht!==1||T||(W-=1);const Y=xe(x,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:ht});if(Y){const et=ve({x:O,y:vt,width:gt,height:E,fill:Y});C.addChild(et)}const $=xe(y,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:ht})||"#20a8d8",Q=ve({x:O,y:vt,width:W,height:E,fill:$});C.addChild(Q)}else if(n.barType==="negative"){const ht=n.min<0?-n.min:0,gt=n.max>0?n.max:0,vt=ht/(ht+gt),W=1-vt,O=rt>0?rt/gt:0,Y=rt<0?-rt/ht:0,$=m,Q=U+b-E-F,et=Z,ot=xe(x,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:O});if(ot){const si=ve({x:et,y:Q,width:$,height:E,fill:ot});C.addChild(si)}const K=T?W*$:vt*$,at=Math.min($*vt*Y,$),tt=T?{left:et+K,top:Q,width:at,height:E}:{left:et+K-at,top:Q,width:at,height:E},_t=xe(A,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:Y})||"#20a8d8",yt=ve({x:tt.left,y:tt.top,width:tt.width,height:tt.height,fill:_t});C.addChild(yt);let ut=Math.min($*W*O,$);r!==a.colCount-1||O!==1||T||(ut-=1);const xt=T?{left:et+K-ut,top:Q,width:ut,height:E}:{left:et+K,top:Q,width:ut,height:E},de=xe(S,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:O})||"#20a8d8",Re=ve({x:xt.left,y:xt.top,width:xt.width,height:xt.height,fill:de});C.addChild(Re);const Ge=T?tt.left:xt.left,Qe=xe(R,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:O}),$i=Si({x:0,y:0,stroke:Qe,lineWidth:1,lineDash:[2,2],points:[{x:Ge,y:0},{x:Ge,y:v}]});if(C.addChild($i),M&&(O||Y)){const si=B,ti=[];let ue;if(O>0)if(ue=xe(P,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:O})||"#20a8d8",H==="right"){const mt=T?xt.left+B/2:xt.left+xt.width-B/2;ti.push({x:mt,y:xt.top}),ti.push({x:mt,y:xt.top+xt.height})}else H==="bottom"&&(ti.push({x:xt.left,y:xt.top+xt.height-B/2}),ti.push({x:xt.left+xt.width,y:xt.top+xt.height-B/2}));else if(Y>0)if(ue=xe(k,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:Y})||"#20a8d8",H==="right"){const mt=T?tt.left+tt.width-B/2:tt.left+B/2;ti.push({x:mt,y:tt.top}),ti.push({x:mt,y:tt.top+tt.height})}else H==="bottom"&&(ti.push({x:tt.left,y:tt.top+tt.height-B/2}),ti.push({x:tt.left+tt.width,y:tt.top+tt.height-B/2}));const pt=Si({x:0,y:0,stroke:ue,lineWidth:si,points:ti});C.addChild(pt)}}else if(n.barType==="negative_no_axis"){const ht=n.min<0?-n.min:0,gt=n.max>0?n.max:0,vt=Math.max(ht,gt),W=vt===0?0:Math.abs(rt)/vt,O=m;let Y=Math.min(O*W,O);r!==a.colCount-1||W!==1||T||(Y-=1);const $=U+b-E-F,Q=T?Z+q-Y:Z,et=xe(x,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:W});if(et){const tt=ve({x:Q,y:$,width:O,height:E,fill:et});C.addChild(tt)}const ot={left:Q,top:$,width:Y,height:E};let K;K=rt>=0?xe(S,{col:r,row:s,table:a,context:null,value:i,percentile:W,dataValue:o})||"#20a8d8":xe(A,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:W})||"#20a8d8";const at=ve({x:ot.left,y:ot.top,width:ot.width,height:ot.height,fill:K});if(C.addChild(at),M&&rt){const tt=B,_t=[];let yt;if(yt=rt>=0?xe(P,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:W})||"#20a8d8":xe(k,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:W})||"#20a8d8",H==="right"){const xt=T?ot.left+B/2:ot.left+ot.width-B/2;_t.push({x:xt,y:ot.top}),_t.push({x:xt,y:ot.top+ot.height})}else H==="bottom"&&(_t.push({x:ot.left,y:ot.top+ot.height-B/2}),_t.push({x:ot.left+ot.width,y:ot.top+ot.height-B/2}));const ut=Si({x:0,y:0,stroke:yt,lineWidth:tt,points:_t});C.addChild(ut)}}}return C}function fz(n,t,e,i,o,r){var s,l,a,h,d,u,c,g,f;if(e!=null&&e.zero&&(n=Math.min(n,0),t=Math.max(t,0)),e==null?void 0:e.expand){const m=n,b=t;I(e.expand.min)&&(n=m-(b-m)*e.expand.min),I(e.expand.max)&&(t=b+(b-m)*e.expand.max)}let p,v;if(nt(e==null?void 0:e.min)&&(n=e.min),nt(e==null?void 0:e.max)&&(t=e.max),(e==null?void 0:e.type)==="log"?(p=new js,p.base((s=e==null?void 0:e.base)!==null&&s!==void 0?s:10)):(e==null?void 0:e.type)==="symlog"?(p=new Gs,p.constant((l=e==null?void 0:e.constant)!==null&&l!==void 0?l:10)):p=new ko,p.domain([n,t],!!(e!=null&&e.nice)),e==null?void 0:e.nice){let m=(u=(h=(a=e.tick)===null||a===void 0?void 0:a.forceTickCount)!==null&&h!==void 0?h:(d=e.tick)===null||d===void 0?void 0:d.tickCount)!==null&&u!==void 0?u:10;jt(m)&&(m=m({axisLength:o,labelStyle:(g=(c=e==null?void 0:e.label)===null||c===void 0?void 0:c.style)!==null&&g!==void 0?g:{fontSize:Sl.LABEL_FONT_SIZE}})),e.niceType==="accurateFirst"&&(m=Math.max(10,m)),ct(e.min)&&ct(e.max)?p.nice(m):I(e.min)&&ct(e.max)?p.niceMax(m):ct(e.min)&&I(e.max)&&p.niceMin(m)}return delete p._niceType,r||(v=p.ticks(nt(e==null?void 0:e.tickCount)?e==null?void 0:e.tickCount:5,{noDecimals:(f=e==null?void 0:e.tick)===null||f===void 0?void 0:f.noDecimals})),{range:p.domain(),ticks:v}}const pz=()=>{St.registerFunction("createChartCellGroup",iz),St.registerFunction("getAxisDomainRangeAndLabels",fz)},vz=()=>{St.registerFunction("createCheckboxCellGroup",nz)},mz=()=>{St.registerFunction("createImageCellGroup",oL)},bz=()=>{St.registerFunction("createProgressBarCell",gz)},Cz=()=>{St.registerFunction("createRadioCellGroup",rz)},_z=()=>{St.registerFunction("createSparkLineCellGroup",hz)},yz=()=>{St.registerFunction("createTextCellGroup",cz)},wz=()=>{St.registerFunction("createVideoCellGroup",uz)};function Sz(n,t,e,i,o,r){const s=r.columnHeaderLevelCount,l=[],a=[];for(let c=0;c<e.length;c++)i.includes(e[c])||a.push(o[c]);for(let c=0;c<i.length;c++)if(!e.includes(i[c])){const g={col:n,row:s+c};l.push(g)}let h=r.getParentCellId(n,t),d=r.getRowHeaderCellAddressByCellId(h);const u=[];for(d&&u.push(d);h;)h=r.getParentCellId(d.col,d.row),h&&(d=r.getRowHeaderCellAddressByCellId(h),u.push(d));return{addCellPositions:l,removeCellPositions:a,updateCellPositions:u}}const s1={startInTotal:0,level:0};class Rl{constructor(t,e,i,o){var r,s,l,a,h,d,u,c,g,f,p,v,m,b,w,C,_;this.colIndex=0,this._showHeader=!0,this.columnHeaderObjs=[],this.rowHeaderObjs=[],this._cornerHeaderCellFullPathIds=[],this._columnHeaderCellFullPathIds=[],this._rowHeaderCellFullPathIds=[],this._rowHeaderCellFullPathIds_FULL=[],this._cornerHeaderCellIds=[],this._columnHeaderCellIds=[],this._rowHeaderCellIds=[],this._rowHeaderCellIds_FULL=[],this._columnWidths=[],this.columnPaths=[],this._headerObjects=[],this._headerObjectMap={},this._indicators=[],this.indicatorsAsCol=!0,this.hideIndicatorName=!1,this._showRowHeader=!0,this._showColumnHeader=!0,this._indicatorShowType="column",this.rowHierarchyTextStartAlignment=!1,this.rowDimensionKeys=[],this.colDimensionKeys=[],this.indicatorKeys=[],this.indicatorDimensionKey=ln,this._rowHeaderExtensionTree={},this._extensionRowDimensionKeys=[],this.fullRowDimensionKeys=[],this.leftRowSeriesNumberColumnCount=0,this.rightRowSeriesNumberColumnCount=0,this._useGetBodyCache=!1,this._getBodyCache=new Map,this._useHeaderPathCache=!1,this._colHeaderPathCache=new Map,this._rowHeaderPathCache=new Map,this.sharedVar=t.layoutNodeId,this._table=t,t.options.rowHierarchyType==="tree"&&(this.extensionRows=t.options.extensionRows),this.dataset=e,this._largeCellRangeCache=[],this._CellHeaderPathMap=new Map,this.rowTree=t.internalProps.rowTree,this.columnTree=t.internalProps.columnTree,this.rowsDefine=(r=t.internalProps.rows)!==null&&r!==void 0?r:[],this.columnsDefine=(s=t.internalProps.columns)!==null&&s!==void 0?s:[],this.indicatorsDefine=(l=t.internalProps.indicators)!==null&&l!==void 0?l:[],this.indicatorTitle=t.options.indicatorTitle,this.indicatorsAsCol=(a=t.options.indicatorsAsCol)===null||a===void 0||a,this.hideIndicatorName=(h=t.options.hideIndicatorName)!==null&&h!==void 0&&h,this.showRowHeader=(d=t.options.showRowHeader)===null||d===void 0||d,this.showColumnHeader=(u=t.options.showColumnHeader)===null||u===void 0||u,this.rowHeaderTitle=t.options.rowHeaderTitle,this.columnHeaderTitle=t.options.columnHeaderTitle,this.rowHierarchyType=(c=t.options.rowHierarchyType)!==null&&c!==void 0?c:"grid",this.rowExpandLevel=(g=t.options.rowExpandLevel)!==null&&g!==void 0?g:1,this.rowHierarchyIndent=(f=t.options.rowHierarchyIndent)!==null&&f!==void 0?f:20,this.rowHierarchyTextStartAlignment=t.options.rowHierarchyTextStartAlignment,this.cornerSetting=Object.assign({titleOnDimension:"column",forceShowHeader:!1},t.options.corner),e&&(this.rowTree=e.rowHeaderTree,this.columnTree=e.colHeaderTree),(p=this.indicatorsDefine)===null||p===void 0||p.forEach(A=>{typeof A=="string"?this.indicatorKeys.push(A):this.indicatorKeys.push(A.indicatorKey)}),this.columnDimensionTree=i,this.rowDimensionTree=o,this.colDimensionKeys=this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr(),this.rowDimensionKeys=this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),this.fullRowDimensionKeys=this.fullRowDimensionKeys.concat(this.rowDimensionKeys),this.resetRowHeaderLevelCount(),this._table.isPivotChart()&&(this.hasTwoIndicatorAxes=this.indicatorsDefine.some(A=>{var R,T;if(A.chartSpec&&A.chartSpec.series&&A.chartSpec.series.length>1){const M=(T=(R=A.chartSpec.axes)!==null&&R!==void 0?R:this._table.pivotChartAxes)!==null&&T!==void 0?T:[];if(!M.length||M.every(P=>P.orient!==(this.indicatorsAsCol?"top":"right")||P.visible!==!1))return!0}return!1})),this.resetColumnHeaderLevelCount(),this._generateColHeaderIds(),this.colIndex=0,this._generateRowHeaderIds(),this._rowHeaderCellFullPathIds_FULL=lg(this._rowHeaderCellFullPathIds_FULL),t.options.rowHierarchyType==="tree"&&((v=this.extensionRows)===null||v===void 0?void 0:v.length)>=1&&(this.generateExtensionRowTree(),this.extensionRows.forEach(A=>{const R=[];A.rows.forEach(T=>{typeof T=="string"?R.push(T):R.push(T.dimensionKey)}),this._extensionRowDimensionKeys.push(R),this.fullRowDimensionKeys=this.fullRowDimensionKeys.concat(R)})),this.sharedVar.seqId=Math.max(this.sharedVar.seqId,this._headerObjects.length);let y,x=this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();!this.dataset||this._table.isPivotChart()||((b=(m=this.dataset.records)===null||m===void 0?void 0:m.length)!==null&&b!==void 0?b:0)!==0||this.dataset.customColTree||(x=this.columnsDefine.map(A=>typeof A=="string"?A:A.dimensionKey),this.indicatorsAsCol&&x.push(this.indicatorDimensionKey)),x=this.columnHeaderTitle?[""].concat(x):x;let S=[];if(this.rowHierarchyType==="tree"&&((w=this.extensionRows)===null||w===void 0?void 0:w.length)>=1){const A=[];A.push(this.rowDimensionKeys[0]),this._extensionRowDimensionKeys.forEach(R=>{A.push(R[0])}),S=this.extensionRows.reduce((R,T)=>R.concat(T.rows),[]),y=this.rowHeaderTitle?[""].concat(A):A}else y=this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),!this.dataset||this._table.isPivotChart()||((_=(C=this.dataset.records)===null||C===void 0?void 0:C.length)!==null&&_!==void 0?_:0)!==0||this.dataset.customRowTree||(y=this.rowsDefine.map(A=>typeof A=="string"?A:A.dimensionKey),this.indicatorsAsCol||y.push(this.indicatorDimensionKey)),y=this.rowHeaderTitle?[""].concat(y):y;this.cornerHeaderObjs=this._addCornerHeaders(x,y,this.columnsDefine.concat(...this.rowsDefine,...S)),this.colIndex=0,this._headerObjectMap=this._headerObjects.reduce((A,R)=>(A[R.id]=R,A),{}),this.indicatorsAsCol&&!this.hideIndicatorName?this._indicatorShowType="column":this.indicatorsAsCol||this.hideIndicatorName?this._indicatorShowType="none":this._indicatorShowType="row",this.generateCellIdsConsiderHideHeader(),this.setPagination(t.options.pagination),this._table.isPivotChart()&&(this._chartItemSpanSize=0,this._chartItemBandSize=0,this._indicators.find(A=>{var R,T,M,P,k,B,H,E;!((R=A==null?void 0:A.style)===null||R===void 0)&&R.padding&&(this._chartPadding=A.style.padding),!((T=A.chartSpec)===null||T===void 0)&&T.barWidth&&typeof A.chartSpec.barWidth=="number"&&(this._chartItemSpanSize=(M=A.chartSpec)===null||M===void 0?void 0:M.barWidth);const F=(k=(P=A.chartSpec)===null||P===void 0?void 0:P.axes)===null||k===void 0?void 0:k.find(L=>L.type==="band");return F!=null&&F.bandSize&&(this._chartItemBandSize=F==null?void 0:F.bandSize,this._chartPaddingInner=(B=it(F.paddingInner)?F.paddingInner[0]:F.paddingInner)!==null&&B!==void 0?B:0,this._chartPaddingOuter=(H=it(F.paddingOuter)?F.paddingOuter[0]:F.paddingOuter)!==null&&H!==void 0?H:0),this._chartItemSpanSize>0||((E=A.chartSpec.series)===null||E===void 0||E.find(L=>(L.barWidth&&typeof L.barWidth=="number"&&(this._chartItemSpanSize=L.barWidth),this._chartItemSpanSize>0)),!1)})),this.handleRowSeriesNumber(t.internalProps.rowSeriesNumber),this.setColumnWidths()}handleRowSeriesNumber(t){var e,i;t&&(Array.isArray(t)?this.rowSeriesNumberColumn=t.map(o=>{var r,s;return{id:"",title:o.title,define:o,cellType:(r=o.cellType)!==null&&r!==void 0?r:"text",headerType:(s=o.cellType)!==null&&s!==void 0?s:"text",width:o.width,style:o.style,format:o.format,field:o.field,icon:o.icon}}):this.rowSeriesNumberColumn=[{id:"",title:t.title,define:t,cellType:(e=t.cellType)!==null&&e!==void 0?e:"text",headerType:(i=t.cellType)!==null&&i!==void 0?i:"text",style:t.style,width:t.width,format:t.format,field:"",icon:t.icon,isChildNode:!1}],this.leftRowSeriesNumberColumn=this.rowSeriesNumberColumn.filter(o=>!0),this.rightRowSeriesNumberColumn=this.rowSeriesNumberColumn.filter(o=>!1),this.leftRowSeriesNumberColumnCount=this.leftRowSeriesNumberColumn.length,this.rightRowSeriesNumberColumnCount=this.rightRowSeriesNumberColumn.length)}_generateColHeaderIds(){var t,e,i,o,r,s,l,a;if(((t=this.columnDimensionTree.tree.children)===null||t===void 0?void 0:t.length)>=1){let h=0;if(this.dataset&&!this._table.isPivotChart()&&((i=(e=this.dataset.records)===null||e===void 0?void 0:e.length)!==null&&i!==void 0?i:0)===0&&!this.dataset.customColTree&&!this.dataset.customRowTree&&this.indicatorsAsCol&&this.columnDimensionTree.totalLevel<this.columnHeaderLevelCount){h=this.columnHeaderLevelCount-this.columnDimensionTree.totalLevel;for(let d=0;d<h;d++)this._columnHeaderCellFullPathIds.unshift([])}this._addHeaders(this._columnHeaderCellFullPathIds,h,this.columnDimensionTree.tree.children,[],this.columnHeaderObjs)}if(this.columnHeaderTitle){this.sharedVar.seqId=Math.max(this.sharedVar.seqId,this._headerObjects.length);const h=++this.sharedVar.seqId,d=Array(this.colCount-this.rowHeaderLevelCount-this.rightFrozenColCount).fill(h);this._columnHeaderCellFullPathIds.unshift(d);const u={id:h,title:typeof this.columnHeaderTitle.title=="string"?this.columnHeaderTitle.title:this.columnsDefine.reduce((c,g)=>typeof g=="string"?c:c+(c?`/${g.title}`:`${g.title}`),""),field:void 0,headerType:(r=(o=this.columnHeaderTitle)===null||o===void 0?void 0:o.headerType)!==null&&r!==void 0?r:"text",style:(s=this.columnHeaderTitle)===null||s===void 0?void 0:s.headerStyle,define:{id:h,disableHeaderHover:!!(!((l=this.columnHeaderTitle)===null||l===void 0)&&l.disableHeaderHover),disableHeaderSelect:!!(!((a=this.columnHeaderTitle)===null||a===void 0)&&a.disableHeaderSelect)}};this.columnHeaderObjs.push(u),this._headerObjects[h]=u}}_generateRowHeaderIds(){var t,e,i,o,r,s,l,a,h,d;if(((t=this.rowDimensionTree.tree.children)===null||t===void 0?void 0:t.length)>=1)if(this.rowHierarchyType==="tree")this._addHeadersForTreeMode(this._rowHeaderCellFullPathIds_FULL,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0,this.rowsDefine,this.rowHeaderObjs);else{let u=0;if(this.dataset&&!this._table.isPivotChart()&&((i=(e=this.dataset.records)===null||e===void 0?void 0:e.length)!==null&&i!==void 0?i:0)===0&&!this.dataset.customColTree&&!this.dataset.customRowTree&&!this.indicatorsAsCol&&this.rowDimensionTree.totalLevel<this.rowHeaderLevelCount){u=this.rowHeaderLevelCount-this.rowDimensionTree.totalLevel;for(let c=0;c<u;c++)this._rowHeaderCellFullPathIds_FULL.unshift([])}this._addHeaders(this._rowHeaderCellFullPathIds_FULL,u,this.rowDimensionTree.tree.children,[],this.rowHeaderObjs)}if(this.rowHeaderTitle){this.sharedVar.seqId=Math.max(this.sharedVar.seqId,this._headerObjects.length);const u=++this.sharedVar.seqId,c=Array((r=(o=this._rowHeaderCellFullPathIds_FULL[0])===null||o===void 0?void 0:o.length)!==null&&r!==void 0?r:this.rowDimensionTree.tree.size).fill(u);this._rowHeaderCellFullPathIds_FULL.unshift(c);const g={id:u,title:typeof this.rowHeaderTitle.title=="string"?this.rowHeaderTitle.title:this.rowsDefine.reduce((f,p)=>typeof p=="string"?f:f+(f?`/${p.title}`:`${p.title}`),""),field:void 0,headerType:(l=(s=this.rowHeaderTitle)===null||s===void 0?void 0:s.headerType)!==null&&l!==void 0?l:"text",style:(a=this.rowHeaderTitle)===null||a===void 0?void 0:a.headerStyle,define:{id:u,disableHeaderHover:!!(!((h=this.rowHeaderTitle)===null||h===void 0)&&h.disableHeaderHover),disableHeaderSelect:!!(!((d=this.rowHeaderTitle)===null||d===void 0)&&d.disableHeaderSelect)}};this.rowHeaderObjs.push(g),this._headerObjects[u]=g}}_addHeaders(t,e,i,o,r){const s=this;t[e]||function(l){const a=t[l]=[];if(s.colIndex===0)return a;const h=t[l-1];for(let d=0;d<(h==null?void 0:h.length);d++)a[d]=h[d]}(e);for(let l=0;l<i.length;l++){const a=i[l];SI(a,t,r,o,e,this)}}_addHeadersForTreeMode(t,e,i,o,r,s,l,a){const h=this;t[e]||function(d){const u=t[d]=[];if(h.colIndex===0)return u;const c=t[d-1];for(let g=0;g<(c==null?void 0:c.length);g++)u[g]=c[g]}(e);for(let d=0;d<i.length;d++){const u=i[d];xI(u,t,a,o,e,r,s,l,this)}}_addCornerHeaders(t,e,i){var o,r;const s=[];if(this.cornerSetting.titleOnDimension==="all")if(this.indicatorsAsCol){let l=-1;t&&t.forEach((a,h)=>{var d,u;a===this.indicatorDimensionKey&&(l=h);const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};s[c]=f,this._headerObjects[c]=f,this._cornerHeaderCellFullPathIds[h]||(this._cornerHeaderCellFullPathIds[h]=[]);for(let p=0;p<this.rowHeaderLevelCount;p++)this._cornerHeaderCellFullPathIds[h][p]=c}),e&&e.forEach((a,h)=>{var d,u;const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};s[c]=f,this._headerObjects[c]=f,this._cornerHeaderCellFullPathIds[l]||(this._cornerHeaderCellFullPathIds[l]=[]),this._cornerHeaderCellFullPathIds[l][h]=c})}else{let l=-1;e&&e.forEach((a,h)=>{var d,u;a===this.indicatorDimensionKey&&(l=h);const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};s[c]=f,this._headerObjects[c]=f;for(let p=0;p<this.columnHeaderLevelCount;p++)this._cornerHeaderCellFullPathIds[p]||(this._cornerHeaderCellFullPathIds[p]=[]),this._cornerHeaderCellFullPathIds[p][h]=c}),t&&t.forEach((a,h)=>{var d,u;const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};s[c]=f,this._headerObjects[c]=f,this._cornerHeaderCellFullPathIds[h][l]=c})}else if(this.cornerSetting.titleOnDimension==="row"||this.cornerSetting.titleOnDimension==="column"){const l=((o=this.cornerSetting)===null||o===void 0?void 0:o.titleOnDimension)==="row"?e:t;l&&l.forEach((a,h)=>{var d,u;const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerCustomRender:this.cornerSetting.customRender,headerCustomLayout:this.cornerSetting.customLayout,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};if(s[c]=f,this._headerObjects[c]=f,this.cornerSetting.titleOnDimension==="column"){this._cornerHeaderCellFullPathIds[h]||(this._cornerHeaderCellFullPathIds[h]=[]);for(let p=0;p<this.rowHeaderLevelCount;p++)this._cornerHeaderCellFullPathIds[h][p]=c}else if(this.cornerSetting.titleOnDimension==="row")for(let p=0;p<this.columnHeaderLevelCount;p++)this._cornerHeaderCellFullPathIds[p]||(this._cornerHeaderCellFullPathIds[p]=[]),this._cornerHeaderCellFullPathIds[p][h]=c})}else{const l=++this.sharedVar.seqId,a={id:l,title:"",field:"维度名称",style:this.cornerSetting.headerStyle,headerType:(r=this.cornerSetting.headerType)!==null&&r!==void 0?r:"text",define:{dimensionKey:"维度名称",id:l,headerCustomRender:this.cornerSetting.customRender,headerCustomLayout:this.cornerSetting.customLayout,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect}};s[l]=a,this._headerObjects[l]=a;for(let h=0;h<this.columnHeaderLevelCount;h++)for(let d=0;d<this.rowHeaderLevelCount;d++)this._cornerHeaderCellFullPathIds[h]||(this._cornerHeaderCellFullPathIds[h]=[]),this._cornerHeaderCellFullPathIds[h][d]=l}return s}generateExtensionRowTree(){this.extensionRows.forEach((t,e)=>{const i=this._rowHeaderCellFullPathIds_FULL;this._rowHeaderCellFullPathIds_FULL=[],i.forEach((o,r)=>{const s=o[o.length-1];let l,a;if(this.colIndex=0,typeof t.rowTree=="function"){const d=this.findFullCellIds(o);l=t.rowTree(d.map(u=>({dimensionKey:this._headerObjects[u].field,value:this._headerObjects[u].title})))}else l=Be(t.rowTree);this._rowHeaderExtensionTree[s]?(this._rowHeaderExtensionTree[s].reset(this._rowHeaderExtensionTree[s].tree.children,!0),a=this._rowHeaderExtensionTree[s]):(a=new ci(l??[],this.sharedVar,this.rowHierarchyType,void 0),this._rowHeaderExtensionTree[s]=a);const h=[];this._addHeadersForTreeMode(h,0,a.tree.children,[],a.totalLevel,!0,t.rows,this.rowHeaderObjs);for(let d=0;d<h[0].length;d++)this._rowHeaderCellFullPathIds_FULL.push(o.concat(h[0][d]))})})}setColumnWidths(){var t,e,i;const o=new Array(this.colCount).fill(void 0);if(this.leftRowSeriesNumberColumnCount&&(o[0]=this.leftRowSeriesNumberColumn[0]),this.showHeader&&this.showRowHeader)if(this.rowHeaderTitle&&(o[0+this.leftRowSeriesNumberColumnCount]={}),this.rowHierarchyType==="tree"){const r=this.rowDimensionKeys[0];if(r){const s=(t=this.rowsDefine)===null||t===void 0?void 0:t.find(l=>typeof l!="string"&&l.dimensionKey===r);s&&(o[0+(this.rowHeaderTitle?1:0)+this.leftRowSeriesNumberColumnCount]={width:s.width,minWidth:s.minWidth,maxWidth:s.maxWidth})}(e=this._extensionRowDimensionKeys)===null||e===void 0||e.forEach((s,l)=>{var a;const h=s[0];if(h){const d=(a=this.extensionRows[l].rows)===null||a===void 0?void 0:a.find(u=>typeof u!="string"&&u.dimensionKey===h);d&&(o[l+1+(this.rowHeaderTitle?1:0)+this.leftRowSeriesNumberColumnCount]={width:d.width,minWidth:d.minWidth,maxWidth:d.maxWidth})}})}else(this.rowDimensionTree.totalLevel>0?this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr():this.rowsDefine.map(r=>typeof r=="string"?r:r.dimensionKey)).forEach((r,s)=>{var l;const a=(l=this.rowsDefine)===null||l===void 0?void 0:l.find(h=>typeof h!="string"&&h.dimensionKey===r);a&&(o[s+(this.rowHeaderTitle?1:0)+this.leftRowSeriesNumberColumnCount]={width:a.width,minWidth:a.minWidth,maxWidth:a.maxWidth})});if(this.indicatorsAsCol)for(let r=this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount;r<this.colCount;r++){const s=this.getBody(r,this.columnHeaderLevelCount);o[r]={width:s==null?void 0:s.width,minWidth:s==null?void 0:s.minWidth,maxWidth:s==null?void 0:s.maxWidth}}else{let r,s,l,a=0;(i=this._indicators)===null||i===void 0||i.forEach((h,d)=>{var u,c;typeof h.width=="number"?a=Math.max(h.width,a):h.width==="auto"&&(l=!0),typeof h.minWidth=="number"&&(s=Math.max(h.minWidth,(u=s)!==null&&u!==void 0?u:0)),typeof h.maxWidth=="number"&&(r=Math.min(h.maxWidth,(c=r)!==null&&c!==void 0?c:Number.MAX_VALUE))}),a=a>0?a:l?"auto":void 0,o.fill({width:a,minWidth:s,maxWidth:r},this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount,this.colCount-this.rightFrozenColCount)}this._columnWidths=o}get columnWidths(){return this._columnWidths}getColumnWidthDefined(t){return this._columnWidths[t]}get showHeader(){return this._showHeader}set showHeader(t){this._showHeader=t}get showColumnHeader(){return this._showColumnHeader}set showColumnHeader(t){this._showColumnHeader=t}get showRowHeader(){return this._showRowHeader}set showRowHeader(t){this._showRowHeader=t}get columnHeaderTitle(){return this._columnHeaderTitle}set columnHeaderTitle(t){this._columnHeaderTitle=t}get rowHeaderTitle(){return this._rowHeaderTitle}set rowHeaderTitle(t){this._rowHeaderTitle=t}getHeaderFieldKey(t,e){}getCellLocation(t,e){return this.isCornerHeader(t,e)?"cornerHeader":this.isColumnHeader(t,e)?"columnHeader":this.isRowHeader(t,e)?"rowHeader":"body"}isHeader(t,e){return t>=this.leftRowSeriesNumberColumnCount&&t<this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount||e>=0&&e<this.columnHeaderLevelCount||t>=this.colCount-this.rightHeaderColCount||e>=this.rowCount-this.bottomHeaderRowCount}isCornerHeader(t,e){return t>=0&&t<this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount&&e>=0&&e<this.columnHeaderLevelCount}isColumnHeader(t,e){return t>=this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount&&e>=0&&e<this.columnHeaderLevelCount}isRowHeader(t,e){return t>=this.leftRowSeriesNumberColumnCount&&t<this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount&&e>=this.columnHeaderLevelCount}isFrozen(t,e){return this.isFrozenColumn(t)||this.isRightFrozenColumn(t)||this.isBottomFrozenRow(e)||this.isFrozenRow(e)||this.isSeriesNumberInBody(t,e)||this.isSeriesNumberInHeader(t,e)}isFrozenColumn(t,e){if(I(e)){if(t>=0&&t<this.frozenColCount&&e>=this.frozenRowCount&&e<this.rowCount-this.bottomFrozenRowCount)return!0}else if(this.frozenColCount>0&&t>=0&&t<this.frozenColCount)return!0;return!1}isRightFrozenColumn(t,e){if(I(e)){if(t>=this.colCount-this.rightFrozenColCount&&e>=this.frozenRowCount&&e<this.rowCount-this.bottomFrozenRowCount)return!0}else if(this.rightFrozenColCount>0&&t>=this.colCount-this.rightFrozenColCount)return!0;return!1}isFrozenRow(t,e){if(I(e)){if(e>=0&&e<this.frozenRowCount&&t>=this.frozenColCount&&t<this.colCount-this.rightFrozenColCount)return!0}else if(e=t,this.frozenRowCount>0&&e>=0&&e<this.frozenRowCount)return!0;return!1}isBottomFrozenRow(t,e){if(I(e)){if(e>=this.rowCount-this.bottomFrozenRowCount&&t>=this.frozenColCount&&t<this.colCount-this.rightFrozenColCount)return!0}else if(e=t,this.bottomFrozenRowCount>0&&e>=this.rowCount-this.bottomFrozenRowCount)return!0;return!1}isLeftTopCorner(t,e){return t>=0&&t<this.frozenColCount&&e>=0&&e<this.frozenRowCount}isLeftBottomCorner(t,e){return t>=0&&t<this.frozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=0&&e<this.frozenRowCount}isRightBottomCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}getColumnHeaderRange(){return{start:{col:this.rowHeaderLevelCount,row:0},end:{col:this.colCount-1,row:this.columnHeaderLevelCount-1}}}getRowHeaderRange(){return{start:{col:0,row:this.columnHeaderLevelCount},end:{col:this.rowHeaderLevelCount-1,row:this.rowCount-1}}}getCornerHeaderRange(){return{start:{col:0,row:0},end:{col:this.rowHeaderLevelCount-1,row:this.columnHeaderLevelCount-1}}}getBodyRange(){return{start:{col:this.rowHeaderLevelCount,row:this.columnHeaderLevelCount},end:{col:this.colCount-1,row:this.rowCount-1}}}resetCellIds(){}get frozenColCount(){return this._table.internalProps.frozenColCount?this.colCount>this._table.internalProps.frozenColCount?this._table.internalProps.frozenColCount:this.colCount:0}get frozenRowCount(){return this._table.internalProps.frozenRowCount?this.rowCount>=this._table.internalProps.frozenRowCount?this._table.internalProps.frozenRowCount:this.rowCount:0}get headerLevelCount(){return this.columnHeaderLevelCount}resetColumnHeaderLevelCount(){var t,e,i,o,r,s,l,a,h,d,u;if(this.showHeader&&this.showColumnHeader){if(this._table.isPivotChart()&&this.indicatorsAsCol&&!(!((e=(t=this.dataset)===null||t===void 0?void 0:t.colKeys)===null||e===void 0)&&e.length)&&((o=(i=this.columnDimensionTree)===null||i===void 0?void 0:i.tree)===null||o===void 0?void 0:o.level)===0&&!this.hasTwoIndicatorAxes)return void(this.columnHeaderLevelCount=0);let c=this.indicatorsAsCol&&this.hideIndicatorName&&this.colDimensionKeys[this.colDimensionKeys.length-1]===this.indicatorDimensionKey?this.columnDimensionTree.totalLevel-1:this.columnDimensionTree.totalLevel;return c===0&&this.dataset&&!(!((r=this.dataset.customColTree)===null||r===void 0)&&r.length)?this.cornerSetting.titleOnDimension==="row"&&this.cornerSetting.forceShowHeader?c=1:this._table.isPivotChart()||((l=(s=this.dataset.records)===null||s===void 0?void 0:s.length)!==null&&l!==void 0?l:0)!==0||this.cornerSetting.titleOnDimension!=="column"&&this.cornerSetting.titleOnDimension!=="all"||(c=(a=this.columnsDefine.length)!==null&&a!==void 0?a:0):!this.dataset||this._table.isPivotChart()||((d=(h=this.dataset.records)===null||h===void 0?void 0:h.length)!==null&&d!==void 0?d:0)!==0||this.dataset.customColTree||this.cornerSetting.titleOnDimension!=="column"&&this.cornerSetting.titleOnDimension!=="all"||(c=(u=this.columnsDefine.length)!==null&&u!==void 0?u:0,!this.hideIndicatorName&&this.indicatorsAsCol&&c++),this.columnHeaderTitle&&(c+=1),this._table.isPivotChart()&&this.indicatorsAsCol&&!this.hasTwoIndicatorAxes&&af(this.indicatorsDefine)&&(c-=1),void(this.columnHeaderLevelCount=c)}this.columnHeaderLevelCount=this.indicatorsAsCol?this.hideIndicatorName?0:1:0}resetRowHeaderLevelCount(){var t,e,i,o,r,s,l,a;if(this.showHeader&&this.showRowHeader){if(this.rowHierarchyType==="tree"){const u=(e=(t=this.extensionRows)===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0;return this.rowHeaderTitle?void(this.rowHeaderLevelCount=2+u):void(this.rowHeaderLevelCount=1+u)}const h=this.rowDimensionTree.totalLevel;let d=h;return d===0&&this.dataset&&!(!((i=this.dataset.customRowTree)===null||i===void 0)&&i.length)?this.cornerSetting.titleOnDimension==="column"&&this.cornerSetting.forceShowHeader?d=1:this._table.isPivotChart()||((r=(o=this.dataset.records)===null||o===void 0?void 0:o.length)!==null&&r!==void 0?r:0)!==0||this.cornerSetting.titleOnDimension!=="row"&&this.cornerSetting.titleOnDimension!=="all"||(d=(s=this.rowsDefine.length)!==null&&s!==void 0?s:0):!this.dataset||this._table.isPivotChart()||((a=(l=this.dataset.records)===null||l===void 0?void 0:l.length)!==null&&a!==void 0?a:0)!==0||this.dataset.customRowTree||this.cornerSetting.titleOnDimension!=="row"&&this.cornerSetting.titleOnDimension!=="all"||(d=this.rowsDefine.length,this.hideIndicatorName||this.indicatorsAsCol||d++),!this.indicatorsAsCol&&this.hideIndicatorName&&this.rowDimensionKeys[this.rowDimensionKeys.length-1]===this.indicatorDimensionKey&&(d=h-1),this.rowHeaderTitle&&(d+=1),void(this.rowHeaderLevelCount=d)}this.rowHeaderLevelCount=this.indicatorsAsCol||this.hideIndicatorName?0:1}get columnHeaderLevelCount(){return this._columnHeaderLevelCount}set columnHeaderLevelCount(t){this._columnHeaderLevelCount=t}get rowHeaderLevelCount(){return this._rowHeaderLevelCount}set rowHeaderLevelCount(t){this._rowHeaderLevelCount=t}get colCount(){var t;return(this.columnDimensionTree.totalLevel>0||this._table.isPivotChart()||((t=this.dataset.records)===null||t===void 0?void 0:t.length)>0||this.dataset.records&&!Array.isArray(this.dataset.records)?this.columnDimensionTree.tree.size:0)+this.rowHeaderLevelCount+this.rightHeaderColCount+this.leftRowSeriesNumberColumnCount}get rowCount(){var t,e,i,o;return((this._table.records||this.dataset.records)&&(!Array.isArray(this._table.records)||this._table.records.length>0)&&((t=this._indicators)===null||t===void 0?void 0:t.length)>0&&!(!((e=this._rowHeaderCellIds)===null||e===void 0)&&e.length)?1:(o=(i=this._rowHeaderCellIds)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0)+this.columnHeaderLevelCount+this.bottomHeaderRowCount}get bodyRowSpanCount(){return this.rowDimensionTree.tree.size}get bottomFrozenRowCount(){if(!this._table.isPivotChart())return this._table.internalProps.bottomFrozenRowCount?this.rowCount-this.headerLevelCount>=this._table.internalProps.bottomFrozenRowCount?this._table.internalProps.bottomFrozenRowCount:this.rowCount-this.headerLevelCount:0;if(this.indicatorKeys.length>=1&&af(this.indicatorsDefine)){const t=this._table.pivotChartAxes.find(e=>e.orient==="bottom");return(t==null?void 0:t.visible)===!1?0:(this.indicatorsAsCol,1)}return 0}get rightFrozenColCount(){if(!this._table.isPivotChart())return this._table.internalProps.rightFrozenColCount?this.colCount-this.rowHeaderLevelCount>=this._table.internalProps.rightFrozenColCount?this._table.internalProps.rightFrozenColCount:this.colCount-this.rowHeaderLevelCount:0;const t=this._table.pivotChartAxes.find(e=>e.orient==="right");return(t==null?void 0:t.visible)===!1||this.indicatorsAsCol?0:this.hasTwoIndicatorAxes?1:0}get bodyRowCount(){return this.rowCount-this.bottomFrozenRowCount-this.headerLevelCount}get bodyColCount(){return this.colCount-this.rightFrozenColCount-this.rowHeaderLevelCount}get headerObjects(){return this._headerObjects}get columnObjects(){return this._indicators}getCellId(t,e){var i,o,r,s,l;if(e>=0&&t>=0){if(this.isSeriesNumber(t,e))return"";if(this.isCornerHeader(t,e))return(i=this._cornerHeaderCellIds[e])===null||i===void 0?void 0:i[t-this.leftRowSeriesNumberColumnCount];if(this.isColumnHeader(t,e))return(o=this._columnHeaderCellIds[e])===null||o===void 0?void 0:o[t-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount];if(this.isRowHeader(t,e))return(r=this._rowHeaderCellIds[e-this.columnHeaderLevelCount])===null||r===void 0?void 0:r[t-this.leftRowSeriesNumberColumnCount];if(this.isRightFrozenColumn(t,e))return(s=this._rowHeaderCellIds[e-this.columnHeaderLevelCount])===null||s===void 0?void 0:s[this.rowHeaderLevelCount-1];if(this.isBottomFrozenRow(t,e))return(l=this._columnHeaderCellIds[this.columnHeaderLevelCount-1])===null||l===void 0?void 0:l[t-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount]}}getHeader(t,e){var i;if(this.isSeriesNumberInHeader(t,e))return this.getSeriesNumberHeader(t,e);const o=this.getCellId(t,e);return(i=this._headerObjectMap[o])!==null&&i!==void 0?i:{id:void 0,field:"",headerType:"text",define:void 0}}getHeaderField(t,e){var i,o;const r=this.getCellId(t,e);return((i=this._headerObjectMap[r])===null||i===void 0?void 0:i.field)||((o=this.getBody(t,e))===null||o===void 0?void 0:o.field)}getHeaderCellAdressById(t){for(let e=0;e<this._columnHeaderCellIds.length;e++){const i=this._columnHeaderCellIds[e];for(let o=0;o<i.length;o++)if(i[o]===t)return{col:o+this._table.frozenColCount,row:e}}for(let e=0;e<this._rowHeaderCellIds.length;e++){const i=this._rowHeaderCellIds[e];for(let o=0;o<i.length;o++)if(i[o]===t)return{col:o,row:e+this._table.frozenRowCount}}for(let e=0;e<this._cornerHeaderCellIds.length;e++){const i=this._cornerHeaderCellIds[e];for(let o=0;o<i.length;o++)if(i[o]===t)return{col:o,row:e}}}getHeaderCellAddressByField(t){const e=this.headerObjects.find(i=>i&&i.field===t);return e&&this.getHeaderCellAdressById(e.id)}getBody(t,e){var i,o,r,s,l,a,h,d,u,c;const g=this.getBodyWidthCache(t,e);if(g)return g;if(this.isSeriesNumber(t,e)){const m=this.getSeriesNumberBody(t,e);return this.setBodyWidthCache(t,e,m),m}const f=this.getCellHeaderPaths(t,e);if(this.indicatorsAsCol){const m=(o=(i=f.colHeaderPaths)===null||i===void 0?void 0:i.find(w=>w.indicatorKey))===null||o===void 0?void 0:o.indicatorKey,b=I(m)&&(l=(s=(r=this._indicators)===null||r===void 0?void 0:r.find(w=>w.indicatorKey===m))!==null&&s!==void 0?s:this._indicators[0])!==null&&l!==void 0?l:{id:"",field:void 0,indicatorKey:void 0,cellType:"text",define:void 0};return this.setBodyWidthCache(t,e,b),b}const p=(h=(a=f.rowHeaderPaths)===null||a===void 0?void 0:a.find(m=>m.indicatorKey))===null||h===void 0?void 0:h.indicatorKey,v=I(p)&&(c=(u=(d=this._indicators)===null||d===void 0?void 0:d.find(m=>m.indicatorKey===p))!==null&&u!==void 0?u:this._indicators[0])!==null&&c!==void 0?c:{id:"",field:void 0,indicatorKey:void 0,cellType:"text",define:void 0};return this.setBodyWidthCache(t,e,v),v}getCellRange(t,e){var i,o;const r={start:{col:t,row:e},end:{col:t,row:e}};if(!this.isHeader(t,e)||t===-1||e===-1||this.isRightFrozenColumn(t,e)||this.isBottomFrozenRow(t,e))return r;if(this._table.isPivotChart()){if(this.isLeftBottomCorner(t,e))return{start:{col:0,row:this.rowCount-this.bottomFrozenRowCount},end:{col:this.frozenColCount-1,row:this.rowCount-1}};if(this.isRightTopCorner(t,e))return{start:{col:this.colCount-this.rightFrozenColCount,row:0},end:{col:this.colCount-1,row:this.frozenRowCount-1}};if(this.isRightBottomCorner(t,e))return{start:{col:this.colCount-this.rightFrozenColCount,row:this.rowCount-this.bottomFrozenRowCount},end:{col:this.colCount-1,row:this.rowCount-1}}}for(let s=0;s<this._largeCellRangeCache.length;s++){const l=this._largeCellRangeCache[s];if(t>=l.start.col&&t<=l.end.col&&e>=l.start.row&&e<=l.end.row)return l}if(this.isHeader(t,e)&&t!==-1&&e!==-1){const s=this.getCellId(t,e);for(let l=t-1;l>=0&&s===this.getCellId(l,e);l--)r.start.col=l;for(let l=t+1;l<((i=this.colCount)!==null&&i!==void 0?i:0)&&s===this.getCellId(l,e);l++)r.end.col=l;for(let l=e-1;l>=0&&s===this.getCellId(t,l);l--)r.start.row=l;for(let l=e+1;l<((o=this.rowCount)!==null&&o!==void 0?o:0)&&!(s!==this.getCellId(t,l)||this.isSeriesNumberInHeader(t,e)&&l>=this.columnHeaderLevelCount);l++)r.end.row=l}return(r.end.col-r.start.col>100||r.end.row-r.start.row>100)&&this._largeCellRangeCache.push(r),r}isCellRangeEqual(t,e,i,o){const r=this.getCellRange(t,e),s=this.getCellRange(i,o);return r.start.col===s.start.col&&r.end.col===s.end.col&&r.start.row===s.start.row&&r.end.row===s.end.row}getBodyIndexByRow(t){return t<this.columnHeaderLevelCount||t>=this.rowCount-this.bottomHeaderRowCount?-1:t-this.columnHeaderLevelCount}get bottomHeaderRowCount(){return this._table.isPivotChart()?this.bottomFrozenRowCount:0}get rightHeaderColCount(){return this._table.isPivotChart()?this.rightFrozenColCount:0}getBodyIndexByCol(t){return t<this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount||t>=this.colCount-this.rightHeaderColCount?-1:t-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount}getRecordStartRowByRecordIndex(t){return this.columnHeaderLevelCount+t}getRecordShowIndexByCell(t,e){}getCellHeaderPathsWithTreeNode(t,e){for(let l=0;l<this._largeCellRangeCache.length;l++){const a=this._largeCellRangeCache[l];if(t>=a.start.col&&t<=a.end.col&&e>=a.start.row&&e<=a.end.row)break}let i=this.getColHeaderPathCache(t,e),o=this.getRowHeaderPathCache(t,e);const r=this.getBodyIndexByCol(t),s=this.getBodyIndexByRow(e)+this.currentPageStartIndex;if(!i&&e>=0&&r>=0&&(i=this.columnDimensionTree.getTreePath(r,this.showHeader&&this.showColumnHeader?e-(this.columnHeaderTitle?1:0):this.columnDimensionTree.totalLevel),this.setColHeaderPathCache(t,e,i)),!o&&t>=0&&s>=0){if(o=[],this.rowHierarchyType==="tree"){const l=this._rowHeaderCellFullPathIds[s];let a=this.rowDimensionTree,h=0;for(;a;){const d=[];let u=l[h];for(d.push(u);;){const g=this._headerObjectMap[u];if(!(g!=null&&g.parentCellId))break;d.unshift(g.parentCellId),u=g.parentCellId}const c=a.getTreePathByCellIds(d);o.push(...c),a=this._rowHeaderExtensionTree[l[h]],h++}}else o=this.rowDimensionTree.getTreePath(s,this.showHeader&&this.showRowHeader?t-(this.rowHeaderTitle?1:0)-this.leftRowSeriesNumberColumnCount:this.rowDimensionTree.totalLevel);this.setRowHeaderPathCache(t,e,o)}return{colHeaderPaths:i,rowHeaderPaths:o,cellLocation:this.getCellLocation(t,e)}}getCellHeaderPaths(t,e){var i,o;const r=this.getCellHeaderPathsWithTreeNode(t,e),s={colHeaderPaths:[],rowHeaderPaths:[],cellLocation:r.cellLocation};return(i=r.colHeaderPaths)===null||i===void 0||i.forEach(l=>{var a,h,d;const u={};u.dimensionKey=l.dimensionKey,u.indicatorKey=l.indicatorKey,u.value=(d=(a=l.value)!==null&&a!==void 0?a:(h=this.getIndicatorInfoByIndicatorKey(l.indicatorKey))===null||h===void 0?void 0:h.title)!==null&&d!==void 0?d:"",u.virtual=l.virtual,s.colHeaderPaths.push(u)}),(o=r.rowHeaderPaths)===null||o===void 0||o.forEach(l=>{var a,h,d;if(l.dimensionKey!=="axis"){const u={};u.dimensionKey=l.dimensionKey,u.indicatorKey=l.indicatorKey,u.value=(d=(a=l.value)!==null&&a!==void 0?a:(h=this.getIndicatorInfoByIndicatorKey(l.indicatorKey))===null||h===void 0?void 0:h.title)!==null&&d!==void 0?d:"",u.virtual=l.virtual,s.rowHeaderPaths.push(u)}}),s}getIndicatorInfoByIndicatorKey(t){var e;return(e=this.indicatorsDefine)===null||e===void 0?void 0:e.find(i=>typeof i!="string"&&!!t&&i.indicatorKey===t)}findFullCellIds(t){const e=[];for(let i=0;i<t.length;i++){let o=t[i];for(e.push(o);;){const r=this._headerObjectMap[o];if(!(r!=null&&r.parentCellId))break;e.unshift(r.parentCellId),o=r.parentCellId}}return e}getHeaderDimension(t,e){var i,o,r;if(this.isHeader(t,e)){const s=this.getHeader(t,e);return(o=(i=this.rowsDefine)===null||i===void 0?void 0:i.find(l=>typeof l!="string"&&l.dimensionKey===s.field))!==null&&o!==void 0?o:(r=this.columnsDefine)===null||r===void 0?void 0:r.find(l=>typeof l!="string"&&l.dimensionKey===s.field)}}isColumnIndicatorHeader(t,e){return this._indicatorShowType==="column"&&e===this.columnHeaderLevelCount-1&&t>=this.rowHeaderLevelCount}isRowIndicatorHeader(t,e){return this._indicatorShowType==="row"&&t===this.rowHeaderLevelCount-1&&e>=this.columnHeaderLevelCount}isIndicatorHeader(t,e){return this.isColumnIndicatorHeader(t,e)||this.isRowIndicatorHeader(t,e)}toggleHierarchyState(t,e){var i,o,r,s,l,a;this.colIndex=0;const h=this._rowHeaderCellFullPathIds_FULL.slice(0),d=h.map((g,f)=>({col:t,row:f+this.columnHeaderLevelCount})),u=this.getHeader(t,e);if(u.define.hierarchyState=u.define.hierarchyState===Pt.collapse?Pt.expand:Pt.collapse,this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._rowHeaderCellFullPathIds_FULL=[],this.rowDimensionKeys=this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),this.fullRowDimensionKeys=[],this.fullRowDimensionKeys=this.fullRowDimensionKeys.concat(this.rowDimensionKeys),this._addHeadersForTreeMode(this._rowHeaderCellFullPathIds_FULL,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0,this.rowsDefine,this.rowHeaderObjs),this.rowHeaderTitle){const g=++this.sharedVar.seqId,f=Array(this.rowCount-this.columnHeaderLevelCount).fill(g);this._rowHeaderCellFullPathIds_FULL.unshift(f);const p={id:g,title:typeof this.rowHeaderTitle.title=="string"?this.rowHeaderTitle.title:this.rowsDefine.reduce((v,m)=>typeof m=="string"?v:v+(v?`/${m.title}`:`${m.title}`),""),field:void 0,headerType:(o=(i=this.rowHeaderTitle)===null||i===void 0?void 0:i.headerType)!==null&&o!==void 0?o:"text",style:(r=this.rowHeaderTitle)===null||r===void 0?void 0:r.headerStyle,define:{field:"",headerType:"text",cellType:"text",disableHeaderHover:!!(!((s=this.rowHeaderTitle)===null||s===void 0)&&s.disableHeaderHover),disableHeaderSelect:!!(!((l=this.rowHeaderTitle)===null||l===void 0)&&l.disableHeaderSelect)}};this.rowHeaderObjs.push(p),this._headerObjects[g]=p}this._rowHeaderCellFullPathIds_FULL=lg(this._rowHeaderCellFullPathIds_FULL),this.rowHierarchyType==="tree"&&((a=this.extensionRows)===null||a===void 0?void 0:a.length)>=1&&this.generateExtensionRowTree(),this.colIndex=0,this._headerObjectMap=this._headerObjects.reduce((g,f)=>(g[f.id]=f,g),{}),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0;const c=Sz(t,e,h.map(g=>g[t-this.leftRowSeriesNumberColumnCount]),this._rowHeaderCellFullPathIds_FULL.map(g=>g[t-this.leftRowSeriesNumberColumnCount]),d,this);return this.generateCellIdsConsiderHideHeader(),this.setPagination(this.pagination),c}isHeaderForColWidth(t,e){return this.isHeader(t,e)}getHeaderForColWidth(t,e){return this.getHeader(t,e)}getPivotCellAdress(t){var e;if(!Array.isArray(t))return;let i,o,r=this.rowTree,s=this.columnTree;for(let h=0;h<t.length;h++){const d=t[h];if((d.isPivotCorner||!I(d.value))&&h===t.length-1){if(((e=this==null?void 0:this.cornerSetting)===null||e===void 0?void 0:e.titleOnDimension)==="row"){let g=0;return this.rowHierarchyType==="grid"&&(g=this.rowDimensionKeys.indexOf(d.dimensionKey)),g===-1?void 0:{col:(this.rowHeaderTitle?g+1:g)+this.leftRowSeriesNumberColumnCount,row:0}}const c=this.colDimensionKeys.indexOf(d.dimensionKey);return c===-1?void 0:{col:0+this.leftRowSeriesNumberColumnCount,row:this.columnHeaderTitle?c+1:c}}let u=!1;for(let c=0;c<s.length;c++){const g=s[c];if((I(d.dimensionKey)&&g.dimensionKey===d.dimensionKey||I(d.indicatorKey)&&g.indicatorKey===d.indicatorKey)&&g.value===d.value){s=g.children,o=g,u=!0;break}}if(!u)for(let c=0;c<r.length;c++){const g=r[c];if((I(d.dimensionKey)&&g.dimensionKey===d.dimensionKey||I(d.indicatorKey)&&g.indicatorKey===d.indicatorKey)&&g.value===d.value){r=g.children,i=g;break}}}let l=0,a=0;if(i){a=this.columnHeaderLevelCount;const{startInTotal:h,level:d}=i;return a+=h,l=this.rowHierarchyType==="grid"?(this.rowHeaderTitle?d+1:d)+this.leftRowSeriesNumberColumnCount:0+this.leftRowSeriesNumberColumnCount,{col:l,row:a}}if(o){l=this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount;const{startInTotal:h,level:d}=o;return l+=h,a=this.columnHeaderTitle?d+1:d,{col:l,row:a}}}getPivotDimensionInfo(t,e){var i;const{colHeaderPaths:o,rowHeaderPaths:r}=this.getCellHeaderPaths(t,e),s=[];return o.length?o.forEach((l,a)=>{s.push({dimensionKey:l.dimensionKey,value:l.value,isPivotCorner:!1,indicatorKey:l.indicatorKey})}):r.length?r.forEach((l,a)=>{s.push({dimensionKey:l.dimensionKey,value:l.value,isPivotCorner:!1,indicatorKey:l.indicatorKey})}):this.isCornerHeader(t,e)&&(((i=this==null?void 0:this.cornerSetting)===null||i===void 0?void 0:i.titleOnDimension)==="row"?s.push({dimensionKey:this.rowDimensionKeys[(this.rowHeaderTitle?t-1:t)-this.leftRowSeriesNumberColumnCount],isPivotCorner:!0}):s.push({dimensionKey:this.colDimensionKeys[this.columnHeaderTitle?e-1:e],isPivotCorner:!0})),s}getIndicatorKey(t,e){var i;return(i=this.getBody(t,e))===null||i===void 0?void 0:i.indicatorKey}getParentCellId(t,e){if(e!==0)return this.isColumnHeader(t,e)?this.getCellId(t,e-1):this.isRowHeader(t,e)?this.getCellId(t-1,e):void 0}getRowHeaderCellAddressByCellId(t){let e,i;if(this._rowHeaderCellIds.find((o,r)=>!!o.find((s,l)=>s===t&&(e=l,!0))&&(i=r,!0)),I(e)&&I(i))return{col:e,row:i+this.columnHeaderLevelCount}}canMoveHeaderPosition(t,e){if(this.isSeriesNumberInHeader(e.col,e.row)||this.isSeriesNumberInHeader(t.col,t.row)||this.isCornerHeader(e.col,e.row)||t.col<0||t.row<0||e.col<0||e.row<0)return!1;this.isSeriesNumberInBody(e.col,e.row)&&this.isSeriesNumberInBody(t.col,t.row)&&(t.col=t.col+this.leftRowSeriesNumberColumnCount+this.rowHeaderLevelCount-1,e.col=e.col+this.leftRowSeriesNumberColumnCount+this.rowHeaderLevelCount-1);const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row))return this.getParentCellId(t.col,i.start.row)===this.getParentCellId(e.col,i.start.row);if(this.isRowHeader(t.col,t.row)){if(this.rowHierarchyType!=="tree")return this.getParentCellId(i.start.col,t.row)===this.getParentCellId(i.start.col,e.row);{const o=Be(this.getCellHeaderPathsWithTreeNode(t.col,t.row).rowHeaderPaths),r=Be(this.getCellHeaderPathsWithTreeNode(e.col,e.row).rowHeaderPaths);if(o.pop(),r.pop(),o.length<=r.length){if(o.length===r.length)return!o.find((s,l)=>s.dimensionKey!==r[l].dimensionKey||s.value!==r[l].value);if(o.length>0){for(let s=0;s<o.length;s++)if(o[s].startInTotal!==r[s].startInTotal)return!1}return!0}}}return!1}moveHeaderPosition(t,e){if(this.canMoveHeaderPosition(t,e)&&!this.isCellRangeEqual(t.col,t.row,e.col,e.row)){const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row)){const o=i.end.col-i.start.col+1;let r;const s=this.getCellRange(e.col,i.start.row);if(r=e.col>=t.col?s.end.col-o+1:s.start.col,r===i.start.col)return null;for(let a=0;a<this._columnHeaderCellFullPathIds.length;a++){const h=this._columnHeaderCellFullPathIds[a].splice(i.start.col-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount,o);h.unshift(r-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount,0),Array.prototype.splice.apply(this._columnHeaderCellFullPathIds[a],h)}const l=this._columnWidths.splice(i.start.col-this.leftRowSeriesNumberColumnCount,o);return l.unshift(r-this.leftRowSeriesNumberColumnCount,0),Array.prototype.splice.apply(this._columnWidths,l),this.columnDimensionTree.movePosition(this.getCellHeaderPathsWithTreeNode(t.col,t.row).colHeaderPaths.length-1,i.start.col-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount,s.start.col-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount),this.columnDimensionTree.reset(this.columnDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0,{sourceIndex:i.start.col,targetIndex:r,sourceSize:o,targetSize:s.end.col-s.start.col+1,moveType:"column"}}if(this.isRowHeader(t.col,t.row)){let o;const r=this.getCellHeaderPathsWithTreeNode(t.col,t.row).rowHeaderPaths,s=this.getCellHeaderPathsWithTreeNode(e.col,e.row).rowHeaderPaths,l=r[r.length-1],a=s[r.length-1],h=l.size;if(o=e.row>=t.row?a.startInTotal+a.size-h:a.startInTotal,o===i.start.row-this.columnHeaderLevelCount)return null;const d=this._rowHeaderCellIds.splice(i.start.row-this.columnHeaderLevelCount,h);d.unshift(o-this.currentPageStartIndex,0),Array.prototype.splice.apply(this._rowHeaderCellIds,d);const u=this._rowHeaderCellFullPathIds.splice(i.start.row-this.columnHeaderLevelCount,h);u.unshift(o-this.currentPageStartIndex,0),Array.prototype.splice.apply(this._rowHeaderCellFullPathIds,u);const c=this._rowHeaderCellIds_FULL.splice(i.start.row-this.columnHeaderLevelCount+this.currentPageStartIndex,h);c.unshift(o,0),Array.prototype.splice.apply(this._rowHeaderCellIds_FULL,c);const g=this._rowHeaderCellFullPathIds_FULL.splice(i.start.row-this.columnHeaderLevelCount+this.currentPageStartIndex,h);return g.unshift(o,0),Array.prototype.splice.apply(this._rowHeaderCellFullPathIds_FULL,g),this.rowDimensionTree.movePosition(r.length-1,i.start.row-this.columnHeaderLevelCount,o+(e.row>t.row?l.size-1:0)),this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0,{sourceIndex:i.start.row,targetIndex:o+this.columnHeaderLevelCount,sourceSize:h,targetSize:a.size,moveType:"row"}}}return null}getCellAdressByHeaderPath(t){var e,i,o,r,s,l;let a,h,d=!1,u=!1;if(Array.isArray(t)){if(t.length>this.rowDimensionKeys.length+this.colDimensionKeys.length)return;a=t.filter(_=>this.colDimensionKeys.indexOf(_.dimensionKey)>=0||this.colDimensionKeys.indexOf(this.indicatorDimensionKey)>=0&&_.indicatorKey),h=t.filter(_=>this.rowDimensionKeys.indexOf(_.dimensionKey)>=0||this.rowDimensionKeys.indexOf(this.indicatorDimensionKey)>=0&&_.indicatorKey)}else a=t.colHeaderPaths,h=t.rowHeaderPaths,(t==null?void 0:t.cellLocation)==="body"&&this._table.isPivotTable()&&(u=!0);if(!Array.isArray(a)&&!Array.isArray(h))return;if(a==null||a.sort((_,y)=>{var x,S;return this.colDimensionKeys.indexOf((x=_.dimensionKey)!==null&&x!==void 0?x:this.indicatorDimensionKey)-this.colDimensionKeys.indexOf((S=y.dimensionKey)!==null&&S!==void 0?S:this.indicatorDimensionKey)}),h==null||h.sort((_,y)=>{var x,S;return this.fullRowDimensionKeys.indexOf((x=_.dimensionKey)!==null&&x!==void 0?x:this.indicatorDimensionKey)-this.fullRowDimensionKeys.indexOf((S=y.dimensionKey)!==null&&S!==void 0?S:this.indicatorDimensionKey)}),a==null||a.forEach(_=>{_.isPivotCorner&&(d=!0)}),h==null||h.forEach(_=>{_.isPivotCorner&&(d=!0)}),d){if(this.cornerSetting.titleOnDimension==="all"&&this.indicatorsAsCol&&a.length===0){for(let _=0;_<this.rowDimensionKeys.length;_++)if(((e=h[0])===null||e===void 0?void 0:e.dimensionKey)===this.rowDimensionKeys[_])return{col:_+this.leftRowSeriesNumberColumnCount,row:this.columnHeaderLevelCount-1}}else if(this.cornerSetting.titleOnDimension!=="all"||this.indicatorsAsCol||h.length!==0){if(this.cornerSetting.titleOnDimension==="row"||this.cornerSetting.titleOnDimension==="all"&&!this.indicatorsAsCol){for(let _=0;_<this.rowDimensionKeys.length;_++)if(((o=h[0])===null||o===void 0?void 0:o.dimensionKey)===this.rowDimensionKeys[_])return{col:_+this.leftRowSeriesNumberColumnCount,row:0}}else for(let _=0;_<this.colDimensionKeys.length;_++)if(((r=a[0])===null||r===void 0?void 0:r.dimensionKey)===this.colDimensionKeys[_])return{col:0,row:_}}else for(let _=0;_<this.colDimensionKeys.length;_++)if(((i=a[0])===null||i===void 0?void 0:i.dimensionKey)===this.colDimensionKeys[_])return{col:this.rowHeaderLevelCount-1,row:_}}let c,g,f,p,v=!1;(a==null?void 0:a.length)>=1&&(h==null?void 0:h.length)>=1&&(v=!0);let m,b,w=this.rowTree,C=this.columnTree;if(a)for(let _=0;_<a.length;_++){const y=a[_];for(let x=0;x<C.length;x++){const S=C[x];if(!I(y.indicatorKey)&&S.dimensionKey===y.dimensionKey&&S.value===y.value||I(y.indicatorKey)&&S.indicatorKey===y.indicatorKey){C=S.children,v&&!C?b=S:v||(b=S);break}}}if((h==null?void 0:h.length)>=1)if(this.rowHierarchyType==="tree"){const _=h[h.length-1],y=this.headerObjects.filter(S=>((S==null?void 0:S.field)===_.dimensionKey||(S==null?void 0:S.field)===_.indicatorKey)&&(S==null?void 0:S.title)===_.value).map(S=>S.id),x=this._rowHeaderCellIds.filter(S=>y.indexOf(S[S.length-1])>=0).find(S=>{const A=this.findFullCellIds(S);return A.length===h.length&&A.every(R=>{const T=this._headerObjectMap[R];return h.find(M=>M.dimensionKey===T.field&&M.value===T.title)})});g=this._rowHeaderCellIds.indexOf(x)+this.columnHeaderLevelCount}else for(let _=0;_<h.length;_++){const y=h[_];for(let x=0;x<w.length;x++){const S=w[x];if(!I(y.indicatorKey)&&S.dimensionKey===y.dimensionKey&&S.value===y.value||I(y.indicatorKey)&&S.indicatorKey===y.indicatorKey&&(!I(y.value)||S.value===y.value)){w=S.children,(!v||w&&!w.some(A=>A.dimensionKey==="axis"))&&v||(m=S);break}}}if(u||!v||(m||I(g))&&b){if(m||u){g=this.columnHeaderLevelCount;const{startInTotal:_,level:y}=(s=m)!==null&&s!==void 0?s:s1;g+=_??0,f=this.rowHierarchyType==="grid"?(this.rowHeaderTitle?y+1:y)+this.leftRowSeriesNumberColumnCount:0}if(b||u){c=this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount;const{startInTotal:_,level:y}=(l=b)!==null&&l!==void 0?l:s1;c+=_??0,p=this.columnHeaderTitle?y+1:y}return I(c)||I(g)?{col:c??f,row:g??p}:void 0}}setChartInstance(t,e,i){var o,r,s,l;const a=this.getCellHeaderPaths(t,e);let h;if(this.indicatorsAsCol){const d=(o=a.colHeaderPaths.find(u=>u.indicatorKey))===null||o===void 0?void 0:o.indicatorKey;h=(r=this._indicators)===null||r===void 0?void 0:r.find(u=>u.indicatorKey===d)}else{const d=(s=a.rowHeaderPaths.find(u=>u.indicatorKey))===null||s===void 0?void 0:s.indicatorKey;h=(l=this._indicators)===null||l===void 0?void 0:l.find(u=>u.indicatorKey===d)}typeof(h==null?void 0:h.chartSpec)!="function"&&h&&(h.chartInstance=i)}getChartInstance(t,e){var i,o,r,s;const l=this.getCellHeaderPaths(t,e);let a;if(this.indicatorsAsCol){const h=(i=l.colHeaderPaths.find(d=>d.indicatorKey))===null||i===void 0?void 0:i.indicatorKey;a=(o=this._indicators)===null||o===void 0?void 0:o.find(d=>d.indicatorKey===h)}else{const h=(r=l.rowHeaderPaths.find(d=>d.indicatorKey))===null||r===void 0?void 0:r.indicatorKey;a=(s=this._indicators)===null||s===void 0?void 0:s.find(d=>d.indicatorKey===h)}return a==null?void 0:a.chartInstance}checkHasChart(){return r3(this)}getDimension(t,e){var i,o;return e==="column"?(i=this.columnsDefine)===null||i===void 0?void 0:i.find(r=>typeof r!="string"&&r.dimensionKey===t):e==="row"?(o=this.rowsDefine)===null||o===void 0?void 0:o.find(r=>typeof r!="string"&&r.dimensionKey===t):void 0}getAxisConfigInPivotChart(t,e){if((this.isFrozenColumn(t,e)||this.isRightFrozenColumn(t,e))&&qr(t,e,"row",this)||(this.isFrozenRow(t,e)||this.isBottomFrozenRow(t,e))&&qr(t,e,"col",this))return St.getFunction("getAxisConfigInPivotChart")(t,e,this)}isEmpty(t,e){return!!this._table.isPivotChart()&&(!!this.isLeftBottomCorner(t,e)||!!this.isRightBottomCorner(t,e)||!!this.isRightTopCorner(t,e))}isAxisCell(t,e){return this._table.isPivotChart()?!!(this.indicatorKeys.length>=1&&af(this.indicatorsDefine)&&(this.isBottomFrozenRow(t,e)&&qr(t,e,"col",this)||this.isRightFrozenColumn(t,e)&&qr(t,e,"row",this)||this.isRowHeader(t,e)&&t===this.rowHeaderLevelCount-1&&qr(t,e,"row",this)||this.hasTwoIndicatorAxes&&this.indicatorsAsCol&&e===this.columnHeaderLevelCount-1&&qr(t,e,"col",this))):!1}getChartAxes(t,e){if(e3(t,e,this)||this.isAxisCell(t,e))return n3(t,e,this)}getRawChartSpec(t,e){return JI(t,e,this)}getChartSpec(t,e){return i3(t,e,this)}isShareChartSpec(t,e){return QI(t,e,this)}getChartDataId(t,e){return o3(t,e,this)}isNoChartDataRenderNothing(t,e){return t3(t,e,this)}setPagination(t){var e,i,o,r,s,l,a;if(this.clearCellRangeMap(),this._table.internalProps.useOneRowHeightFillAll=!1,this.pagination=t,this.rowHierarchyType==="grid"&&I((e=this.pagination)===null||e===void 0?void 0:e.perPageCount)&&I((i=this.pagination)===null||i===void 0?void 0:i.currentPage)){this.indicatorsAsCol===!1&&(this.pagination.perPageCount=Math.ceil(this.pagination.perPageCount/this.indicatorKeys.length)*this.indicatorKeys.length);const{perPageCount:h,currentPage:d}=this.pagination;this.currentPageStartIndex=h*(d||0),this.currentPageEndIndex=this.currentPageStartIndex+h,this._rowHeaderCellIds=(o=this._rowHeaderCellIds_FULL)===null||o===void 0?void 0:o.slice(this.currentPageStartIndex,this.currentPageEndIndex),this._rowHeaderCellFullPathIds=(r=this._rowHeaderCellFullPathIds_FULL)===null||r===void 0?void 0:r.slice(this.currentPageStartIndex,this.currentPageEndIndex)}else this.currentPageStartIndex=0,this.currentPageEndIndex=this._rowHeaderCellIds_FULL.length,this._rowHeaderCellIds=(s=this._rowHeaderCellIds_FULL)===null||s===void 0?void 0:s.slice(this.currentPageStartIndex,this.currentPageEndIndex),this._rowHeaderCellFullPathIds=(l=this._rowHeaderCellFullPathIds_FULL)===null||l===void 0?void 0:l.slice(this.currentPageStartIndex,this.currentPageEndIndex);this.pagination&&(this.pagination.totalCount=(a=this._rowHeaderCellIds_FULL)===null||a===void 0?void 0:a.length)}release(){var t;const e=this._table._getActiveChartInstance();e==null||e.release(),(t=this._indicators)===null||t===void 0||t.forEach(i=>{var o;(o=i.chartInstance)===null||o===void 0||o.release()})}getHeadNode(t,e){var i,o,r;let s;const l=this.getCellHeaderPaths(t,e);return l.rowHeaderPaths&&((o=(i=l.rowHeaderPaths)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0)>0?s=(r=l.rowHeaderPaths)===null||r===void 0?void 0:r.slice(0,l.rowHeaderPaths.length):l.colHeaderPaths&&l.colHeaderPaths.length>0&&(s=l.colHeaderPaths.slice(0,l.colHeaderPaths.length)),this.getHeadNodeByRowOrColDimensions(s,t,e)}getHeadNodeByRowOrColDimensions(t,e,i){var o;if(!Array.isArray(t))return;let r,s,l=this.rowTree,a=this.columnTree;if(I(i)&&I(e)&&this.rowHierarchyType==="tree"&&this.extensionRows&&e>=1+this.leftRowSeriesNumberColumnCount){const h=this.getCellId(e-1,i);l=this._rowHeaderExtensionTree[h].tree.children}for(let h=0;h<t.length;h++){const d=t[h];if((d.isPivotCorner||!I(d.value))&&h===t.length-1)return;let u=!1;for(let c=0;c<a.length;c++){const g=a[c];if(I(d.dimensionKey)&&g.dimensionKey===d.dimensionKey&&g.value===d.value||I(d.indicatorKey)&&g.indicatorKey===d.indicatorKey&&(g.value===d.value||!I(d.value)||!I(g.value))){a=g.children,s=g,u=!0;break}}if(!u)for(let c=0;(o=c<(l==null?void 0:l.length))!==null&&o!==void 0&&o;c++){const g=l[c];if(I(d.dimensionKey)&&g.dimensionKey===d.dimensionKey&&g.value===d.value||I(d.indicatorKey)&&g.indicatorKey===d.indicatorKey&&(g.value===d.value||!I(d.value)||!I(g.value))){l=g.children,r=g;break}}}return r||s||void 0}clearCellRangeMap(){this._largeCellRangeCache.length=0,this._CellHeaderPathMap=new Map}getDimensionKeyInChartSpec(t,e){var i,o,r,s,l,a;let h;if(this.indicatorsAsCol===!1)for(let d=0;d<this.indicatorsDefine.length;d++){const u=this.indicatorsDefine[d].chartSpec;if(u&&(h=(i=u.xField)!==null&&i!==void 0?i:(r=(o=u==null?void 0:u.series)===null||o===void 0?void 0:o[0])===null||r===void 0?void 0:r.xField,h))return h}else for(let d=0;d<this.indicatorsDefine.length;d++){const u=this.indicatorsDefine[d].chartSpec;if(u&&(h=(s=u.yField)!==null&&s!==void 0?s:(a=(l=u==null?void 0:u.series)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.yField,h))return h}return null}_generateChartState(){return{vtable_selected:{filter:t=>{var e;return this._table._selectedDataItemsInChart.length>=1?!!this._table._selectedDataItemsInChart.find(i=>{for(const o in i)if(typeof i[o]!="object"&&i[o]!==t[o])return!1;return!0}):!((e=this._table._selectedDimensionInChart)===null||e===void 0)&&e.length?!!this._table._selectedDimensionInChart.every(i=>typeof i.value=="object"||t[i.key]===i.value):!1}},vtable_selected_reverse:{filter:t=>{var e;return this._table._selectedDataItemsInChart.length>=1?!this._table._selectedDataItemsInChart.find(i=>{for(const o in i)if(typeof i[o]!="object"&&i[o]!==t[o])return!1;return!0}):!((e=this._table._selectedDimensionInChart)===null||e===void 0)&&e.length?!this._table._selectedDimensionInChart.every(i=>typeof i.value=="object"||t[i.key]===i.value):!1}}}}updateDataStateToChartInstance(t){var e;if(((e=t==null?void 0:t.getSpec().select)===null||e===void 0?void 0:e.enable)!==!1){t||(t=this._table._getActiveChartInstance());const i=this._generateChartState();this._indicators.forEach(o=>{var r;const s=o.chartInstance;((r=o.chartSpec.select)===null||r===void 0?void 0:r.enable)!==!1&&s.updateState(i)}),t==null||t.updateState(i)}}updateDataStateToActiveChartInstance(t){var e;if(((e=t==null?void 0:t.getSpec().select)===null||e===void 0?void 0:e.enable)!==!1){t||(t=this._table._getActiveChartInstance());const i=this._generateChartState();t==null||t.updateState(i)}}getIndicatorKeyInChartSpec(t,e){const i=this.getRawChartSpec(t,e),o=[];if(i){if(i.series||i.xField||i.yField)return this.indicatorsAsCol===!1?i.series?i.series.forEach(r=>{const s=r.yField;o.push(s)}):o.push(i.yField):i.series?i.series.forEach(r=>{const s=r.xField;o.push(s)}):o.push(i.xField),o;if(i.valueField&&o.push(i.valueField),o.length>=1)return o}return null}getOptimunHeightForChart(t){var e,i,o,r,s;const l=this.getCellHeaderPaths(this.rowHeaderLevelCount,t).rowHeaderPaths;let a,h;for(const u in this.dataset.collectValuesBy)if(this.dataset.collectValuesBy[u].type==="yField"&&!this.dataset.collectValuesBy[u].range){a=(e=this.dataset.collectedValues[u])===null||e===void 0?void 0:e[l.map(c=>c.value).join(this.dataset.stringJoinChar)];break}if(this._chartItemBandSize)h=l1((i=a==null?void 0:a.length)!==null&&i!==void 0?i:0,this._chartItemBandSize,this._chartPaddingInner,this._chartPaddingOuter);else{const u=this._chartItemSpanSize||25;h=((o=a==null?void 0:a.length)!==null&&o!==void 0?o:0)*(u+u/3)}const d=kt((s=(r=this._chartPadding)!==null&&r!==void 0?r:this._table.theme.bodyStyle.padding)!==null&&s!==void 0?s:0);return h+d[0]+d[2]}getOptimunWidthForChart(t){var e,i,o,r,s;const l=this.getCellHeaderPaths(t,this.columnHeaderLevelCount).colHeaderPaths;let a,h;for(const u in this.dataset.collectValuesBy)if(this.dataset.collectValuesBy[u].type==="xField"&&!this.dataset.collectValuesBy[u].range){a=(e=this.dataset.collectedValues[u])===null||e===void 0?void 0:e[l.map(c=>c.value).join(this.dataset.stringJoinChar)];break}if(this._chartItemBandSize)h=l1((i=a==null?void 0:a.length)!==null&&i!==void 0?i:0,this._chartItemBandSize,this._chartPaddingInner,this._chartPaddingOuter);else{const u=this._chartItemSpanSize||25;h=((o=a==null?void 0:a.length)!==null&&o!==void 0?o:0)*(u+u/3)}const d=kt((s=(r=this._chartPadding)!==null&&r!==void 0?r:this._table.theme.bodyStyle.padding)!==null&&s!==void 0?s:0);return h+d[1]+d[3]}get leftAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find(e=>e.orient==="left");return(t==null?void 0:t.visible)===!1?0:(this.indicatorsAsCol,1)}get topAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find(e=>e.orient==="top");return(t==null?void 0:t.visible)===!1?0:this.indicatorsAsCol&&this.hasTwoIndicatorAxes?1:0}get rightAxesCount(){return this.rightFrozenColCount}get bottomAxesCount(){return this.bottomFrozenRowCount}getColKeysPath(t,e){const i=this.getCellHeaderPaths(t,e),o=[];return i.colHeaderPaths.length&&i.colHeaderPaths.forEach(r=>{r.dimensionKey&&o.push(r.value)}),o==null?void 0:o.join(this.dataset.stringJoinChar)}getRowKeysPath(t,e){const i=this.getCellHeaderPaths(t,e),o=[];return i.rowHeaderPaths.length&&i.rowHeaderPaths.forEach(r=>{r.dimensionKey&&o.push(r.value)}),o==null?void 0:o.join(this.dataset.stringJoinChar)}getIndicatorInfo(t,e=""){var i;return(i=this.indicatorsDefine)===null||i===void 0?void 0:i.find(o=>typeof o!="string"&&(t?o.indicatorKey===t:!!e&&o.title===e))}getLayoutColumnTree(){const t=[],e=this.columnDimensionTree.tree.children;return ef(t,e),t}getLayoutRowTree(){const t=[],e=this.rowDimensionTree.tree.children;return ef(t,e),t}getLayoutColumnTreeCount(){const t=this.columnDimensionTree.tree.children;return Hd(t,this.rowHierarchyType==="tree")}getLayoutRowTreeCount(){var t;const e=this.rowDimensionTree.tree.children;let i=Hd(e,this.rowHierarchyType==="tree");return(t=this.extensionRows)===null||t===void 0||t.forEach(o=>{if(typeof o.rowTree!="function"){const r=Hd(o.rowTree,!0);i*=r}}),i}resetHeaderTree(){var t,e,i;this.colIndex=0,this._rowHeaderCellFullPathIds_FULL=[],this._columnHeaderCellFullPathIds=[],this._columnHeaderCellIds=[];const o=this.dataset;this.rowTree=o.rowHeaderTree,this.columnTree=o.colHeaderTree;const r=this.rowDimensionTree.tree.children;(t=this.rowTree)===null||t===void 0||t.forEach((s,l)=>{const a=r.find(h=>h.dimensionKey===s.dimensionKey&&h.value===s.value);a&&this._table._syncHierarchyState(a,s)}),this.columnDimensionTree=new ci((e=this.columnTree)!==null&&e!==void 0?e:[],this.sharedVar),this.rowDimensionTree=new ci((i=this.rowTree)!==null&&i!==void 0?i:[],this.sharedVar,this.rowHierarchyType,this.rowHierarchyType==="tree"?this.rowExpandLevel:void 0),this.resetColumnHeaderLevelCount(),this._generateColHeaderIds(),this.colIndex=0,this._generateRowHeaderIds(),this._rowHeaderCellFullPathIds_FULL=lg(this._rowHeaderCellFullPathIds_FULL),this._headerObjectMap=this._headerObjects.reduce((s,l)=>(s[l.id]=l,s),{}),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0,this.generateCellIdsConsiderHideHeader(),this.setPagination(this.pagination)}isSeriesNumberInHeader(t,e){return this.leftRowSeriesNumberColumnCount>0&&t>=0&&e>=0&&t<this.leftRowSeriesNumberColumnCount&&e<this.headerLevelCount||this.rightRowSeriesNumberColumnCount>0&&e>=0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount&&e<this.headerLevelCount}isSeriesNumberInBody(t,e){return this.leftRowSeriesNumberColumnCount>0&&t>=0&&t<this.leftRowSeriesNumberColumnCount&&e>=this.headerLevelCount||this.rightRowSeriesNumberColumnCount>0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount&&e>=this.headerLevelCount}isSeriesNumber(t,e){return!!(I(t)&&I(e)&&(this.leftRowSeriesNumberColumnCount>0&&t>=0&&e>=0&&t<this.leftRowSeriesNumberColumnCount||this.rightRowSeriesNumberColumnCount>0&&e>=0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount))}getSeriesNumberHeader(t,e){return this.leftRowSeriesNumberColumnCount>0&&t>=0&&t<this.leftRowSeriesNumberColumnCount&&e<this.headerLevelCount?Object.assign({},this.leftRowSeriesNumberColumn[t],{style:this._table.internalProps.rowSeriesNumber.headerStyle}):this.rightRowSeriesNumberColumnCount>0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount&&e<this.headerLevelCount&&e<this.headerLevelCount?this.rightRowSeriesNumberColumn[t-(this.colCount-this.rightRowSeriesNumberColumnCount)]:void 0}getSeriesNumberBody(t,e){return this.leftRowSeriesNumberColumnCount>0&&t>=0&&t<this.leftRowSeriesNumberColumnCount&&e>=this.headerLevelCount?this.leftRowSeriesNumberColumn[t]:this.rightRowSeriesNumberColumnCount>0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount&&e>=this.headerLevelCount?this.rightRowSeriesNumberColumn[t-(this.colCount-this.rightRowSeriesNumberColumnCount)]:void 0}changeTreeNodeTitle(t,e,i){this.getHeadNode(t,e).value=i;const o=this.getCellId(t,e);this._headerObjectMap[o].title=i}changeCornerTitle(t,e,i){if(this.isCornerHeader(t,e)){const o=this.getCellId(t,e);this._headerObjectMap[o].title=i}}generateCellIdsConsiderHideHeader(){if(this._columnHeaderCellIds=this._columnHeaderCellFullPathIds.slice(),!this.showColumnHeader)if(this.indicatorsAsCol&&!this.hideIndicatorName){const t=this.colDimensionKeys.indexOf(ln),e=this._columnHeaderCellIds.splice(t,1);this._columnHeaderCellIds.splice(0,this._columnHeaderCellIds.length),this._columnHeaderCellIds.push(e[0])}else this._columnHeaderCellIds.splice(0,this._columnHeaderCellIds.length);if(this._rowHeaderCellIds_FULL=this._rowHeaderCellFullPathIds_FULL.slice(),!this.showRowHeader)if(this.indicatorsAsCol||this.hideIndicatorName)this._rowHeaderCellIds_FULL.forEach((t,e)=>{const i=t.slice();i.splice(0,i.length),this._rowHeaderCellIds_FULL[e]=i});else{const t=this.rowDimensionKeys.indexOf(ln);this._rowHeaderCellIds_FULL.forEach((e,i)=>{const o=e.slice(),r=o.splice(t,1);o.splice(0,o.length),o.push(r[0]),this._rowHeaderCellIds_FULL[i]=o})}if(this._rowHeaderCellIds=this._rowHeaderCellIds_FULL.slice(),this._cornerHeaderCellIds=this._cornerHeaderCellFullPathIds.slice(),this.rowHeaderLevelCount===0||this.columnHeaderLevelCount===0)this._cornerHeaderCellIds=[];else if(this.cornerSetting.titleOnDimension!=="row"||this.showRowHeader){if(this.cornerSetting.titleOnDimension==="column"&&!this.showColumnHeader)if(this.indicatorsAsCol&&!this.hideIndicatorName){const t=this.colDimensionKeys.indexOf(ln),e=this._cornerHeaderCellIds.splice(t,1);this._cornerHeaderCellIds.splice(0,this._cornerHeaderCellIds.length),this._cornerHeaderCellIds.push(e[0])}else this._cornerHeaderCellIds.splice(0,this._cornerHeaderCellIds.length)}else if(this.indicatorsAsCol||this.hideIndicatorName)this._cornerHeaderCellIds.forEach((t,e)=>{const i=t.slice();i.splice(0,i.length),this._cornerHeaderCellIds[e]=i});else{const t=this.rowDimensionKeys.indexOf(ln);this._cornerHeaderCellIds.forEach((e,i)=>{const o=e.slice(),r=o.splice(t,1);o.splice(0,o.length),o.push(r[0]),this._cornerHeaderCellIds[i]=o})}}enableUseGetBodyCache(){this._useGetBodyCache=!0,this._getBodyCache.clear()}disableUseGetBodyCache(){this._useGetBodyCache=!1,this._getBodyCache.clear()}enableUseHeaderPathCache(){this._useHeaderPathCache=!0,this._colHeaderPathCache.clear(),this._rowHeaderPathCache.clear()}disableUseHeaderPathCache(){this._useHeaderPathCache=!1,this._colHeaderPathCache.clear(),this._rowHeaderPathCache.clear()}getBodyWidthCache(t,e){if(this._useGetBodyCache&&!this.isHeader(t,e)&&!this.isSeriesNumber(t,e))return this.indicatorsAsCol&&this._getBodyCache.has(t)?this._getBodyCache.get(t):!this.indicatorsAsCol&&this._getBodyCache.has(e)?this._getBodyCache.get(e):void 0}setBodyWidthCache(t,e,i){!this._useGetBodyCache||this.isHeader(t,e)||this.isSeriesNumber(t,e)||(this.indicatorsAsCol?this._getBodyCache.set(t,i):this._getBodyCache.set(e,i))}getColHeaderPathCache(t,e){if(this._useHeaderPathCache&&!this.isHeader(t,e)&&!this.isSeriesNumber(t,e)&&this._colHeaderPathCache.has(t))return this._colHeaderPathCache.get(t)}setColHeaderPathCache(t,e,i){!this._useHeaderPathCache||this.isHeader(t,e)||this.isSeriesNumber(t,e)||this._colHeaderPathCache.set(t,i)}getRowHeaderPathCache(t,e){if(this._useHeaderPathCache&&!this.isHeader(t,e)&&!this.isSeriesNumber(t,e)&&this._rowHeaderPathCache.has(e))return this._rowHeaderPathCache.get(e)}setRowHeaderPathCache(t,e,i){!this._useHeaderPathCache||this.isHeader(t,e)||this.isSeriesNumber(t,e)||this._rowHeaderPathCache.set(e,i)}}function l1(n,t,e,i){e===1&&(e=0);const o=xz(n,e,i),r=t/(1-e);return Math.ceil(o*r)}function xz(n,t,e){let i;return i=n===1?n+2*e:n-t+2*e,n?i>0?i:1:0}class gf{constructor(t,e){this.tree={},this.beforeChangedTree={},this.colFlatKeys={},this.rowFlatKeys={},this.stringJoinChar=String.fromCharCode(0),this.rowsIsTotal=[],this.colsIsTotal=[],this.dataConfig=t,e&&(this.records=e,typeof window<"u"&&window.performance.now(),this.setRecords(e),typeof window<"u"&&window.performance.now())}changeDataConfig(t){this.dataConfig=t}setRecords(t){this.processRecords()}processRecords(){for(let t=0,e=this.records.length;t<e;t++){const i=this.records[t];this.processRecord(i)}}processRecord(t){var e;const i=[],o=[];for(let r=0,s=this.dataConfig.rows.length;r<s;r++){const l=this.dataConfig.rows[r];t[l]!==void 0&&l!==this.dataConfig.indicatorDimensionKey&&o.push(t[l])}for(let r=0,s=this.dataConfig.columns.length;r<s;r++){const l=this.dataConfig.columns[r];t[l]!==void 0&&l!==this.dataConfig.indicatorDimensionKey&&i.push(t[l])}(e=this.dataConfig.indicators)===null||e===void 0||e.forEach(r=>{const s=t[r];s!==void 0&&(this.dataConfig.indicatorsAsCol?i.push(r):o.push(r));const l=o.join(this.stringJoinChar),a=i.join(this.stringJoinChar);o.length!==0&&(this.rowFlatKeys[l]||(this.rowFlatKeys[l]=1)),i.length!==0&&(this.colFlatKeys[a]||(this.colFlatKeys[a]=1)),i.length===0&&o.length===0||(this.tree[l]||(this.tree[l]={}),s!==void 0&&(this.tree[l][a]={value:s,record:t},this.dataConfig.indicatorsAsCol?i.pop():o.pop()))})}getTreeNode(t=[],e=[],i,o=!0){var r,s,l,a;let h,d;if(typeof t=="string")h=t;else{let u=!1;t.map((c,g)=>{c===i&&(t.splice(g,1),u=!0)}),u&&t.push(i),h=t.join(this.stringJoinChar)}if(typeof e=="string")d=e;else{let u=!1;e.map((c,g)=>{c===i&&(e.splice(g,1),u=!0)}),u&&e.push(i),d=e.join(this.stringJoinChar)}return o?(l=(s=(r=this.tree)===null||r===void 0?void 0:r[h])===null||s===void 0?void 0:s[d])!==null&&l!==void 0?l:void 0:I((a=this.beforeChangedTree[h])===null||a===void 0?void 0:a[d])?{value:this.beforeChangedTree[h][d].value,record:this.beforeChangedTree[h][d].record}:void 0}changeTreeNodeValue(t=[],e=[],i,o){var r,s,l,a,h,d,u;let c,g;if(typeof t=="string")c=t;else{let v=!1;t.map((m,b)=>{m===i&&(t.splice(b,1),v=!0)}),v&&t.push(i),c=t.join(this.stringJoinChar)}if(typeof e=="string")g=e;else{let v=!1;e.map((m,b)=>{m===i&&(e.splice(b,1),v=!0)}),v&&e.push(i),g=e.join(this.stringJoinChar)}const f=(s=(r=this.tree[c])===null||r===void 0?void 0:r[g])===null||s===void 0?void 0:s.value,p=Object.assign({},(a=(l=this.tree[c])===null||l===void 0?void 0:l[g])===null||a===void 0?void 0:a.record);!((d=(h=this.tree[c])===null||h===void 0?void 0:h[g])===null||d===void 0)&&d.record?(this.tree[c][g].record[i]=o,this.tree[c][g].value=o):(this.tree[c]||(this.tree[c]={}),this.tree[c][g]={record:this._buildRecord(t,e,i,o),value:o}),!((u=this.beforeChangedTree[c])===null||u===void 0)&&u[g]||(this.beforeChangedTree[c]={},this.beforeChangedTree[c][g]={record:void 0,value:void 0},this.beforeChangedTree[c][g].record=p,this.beforeChangedTree[c][g].value=f)}_buildRecord(t=[],e=[],i,o){const r={},s=this.dataConfig.rows,l=this.dataConfig.columns;return s.forEach((a,h)=>{a!==this.dataConfig.indicatorDimensionKey&&(r[a]=t[h])}),l.forEach((a,h)=>{a!==this.dataConfig.indicatorDimensionKey&&(r[a]=e[h])}),r[i]=o,this.records.push(r),r}addRecords(t){for(let e=0,i=t.length;e<i;e++){const o=t[e];this.processRecord(o)}this.records.push(t)}changeRecordFieldValue(t,e,i){let o=!1;for(let r=0;r<this.dataConfig.indicators.length;r++)this.dataConfig.indicators[r]===t&&(o=!0);if(!o){for(let r=0,s=this.records.length;r<s;r++){const l=this.records[r];l[t]===e&&(l[t]=i)}this.rowFlatKeys={},this.colFlatKeys={},this.tree={},this.processRecords()}}}function a1(n,t){let e="";for(let i=0;i<n.length;i++)e+=n[i],i!==n.length-1&&(e+=t);return e}class h1{constructor(t,e,i,o,r,s,l,a,h,d,u,c,g){var f,p,v,m,b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O,Y;this.tree={},this.changedTree={},this.colFlatKeys={},this.rowFlatKeys={},this.colKeys=[],this.rowKeys=[],this.colKeys_normal=[],this.rowKeys_normal=[],this.rowOrder="key_a_to_z",this.colOrder="key_a_to_z",this.sorted=!1,this.indicatorStatistics=[],this.aggregators={},this.stringJoinChar=String.fromCharCode(0),this.rowsIsTotal=[],this.colsIsTotal=[],this.collectedValues={},this.cacheCollectedValues={},this.totalRecordsTree={},this.registerAggregators(),this.dataConfig=t,this.filterRules=(f=this.dataConfig)===null||f===void 0?void 0:f.filterRules,this.rowHierarchyType=a??"grid",this.sortRules=(p=this.dataConfig)===null||p===void 0?void 0:p.sortRules,this.aggregationRules=(v=this.dataConfig)===null||v===void 0?void 0:v.aggregationRules,this.derivedFieldRules=(m=this.dataConfig)===null||m===void 0?void 0:m.derivedFieldRules,this.mappingRules=(b=this.dataConfig)===null||b===void 0?void 0:b.mappingRules,this.calculatedFieldRules=(w=this.dataConfig)===null||w===void 0?void 0:w.calculatedFieldRules,this.calculatedFiledKeys=(_=(C=this.calculatedFieldRules)===null||C===void 0?void 0:C.map($=>$.key))!==null&&_!==void 0?_:[],this.calculatedFieldDependIndicatorKeys=(x=(y=this.calculatedFieldRules)===null||y===void 0?void 0:y.reduce(($,Q)=>{for(let et=0;et<Q.dependIndicatorKeys.length;et++)$.indexOf(Q.dependIndicatorKeys[et])===-1&&$.push(Q.dependIndicatorKeys[et]);return $},[]))!==null&&x!==void 0?x:[],this.totals=(S=this.dataConfig)===null||S===void 0?void 0:S.totals,this.rows=e,this.columns=i,this.indicatorKeys=o,this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys=[...o];for(let $=0;$<this.calculatedFieldDependIndicatorKeys.length;$++)this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys.indexOf(this.calculatedFieldDependIndicatorKeys[$])===-1&&this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys.push(this.calculatedFieldDependIndicatorKeys[$]);if(this.indicatorsAsCol=s,this.indicators=r,this.customColTree=h,this.customRowTree=d,this.hasExtensionRowTree=c,this.parseCustomTreeToMatchRecords=g,this.parseCustomTreeToMatchRecords&&(this.customColTreeDimensionPaths=this.customTreeToDimensionPathArr(this.customColTree,"col"),this.hasExtensionRowTree||(this.customRowTreeDimensionPaths=this.customTreeToDimensionPathArr(this.customRowTree,"row"))),this.colGrandTotalLabel=(T=(R=(A=this.totals)===null||A===void 0?void 0:A.column)===null||R===void 0?void 0:R.grandTotalLabel)!==null&&T!==void 0?T:"总计",this.colSubTotalLabel=(k=(P=(M=this.totals)===null||M===void 0?void 0:M.column)===null||P===void 0?void 0:P.subTotalLabel)!==null&&k!==void 0?k:"小计",this.rowGrandTotalLabel=(E=(H=(B=this.totals)===null||B===void 0?void 0:B.row)===null||H===void 0?void 0:H.grandTotalLabel)!==null&&E!==void 0?E:"总计",this.rowSubTotalLabel=(z=(L=(F=this.totals)===null||F===void 0?void 0:F.row)===null||L===void 0?void 0:L.subTotalLabel)!==null&&z!==void 0?z:"小计",this.collectValuesBy=(D=this.dataConfig)===null||D===void 0?void 0:D.collectValuesBy,this.needSplitPositiveAndNegative=u!=null&&u,this.rowsIsTotal=new Array((V=(N=this.rows)===null||N===void 0?void 0:N.length)!==null&&V!==void 0?V:0).fill(!1),this.colsIsTotal=new Array((U=(G=this.columns)===null||G===void 0?void 0:G.length)!==null&&U!==void 0?U:0).fill(!1),((Z=this.totals)===null||Z===void 0?void 0:Z.row)&&this.totals.row.showSubTotals!==!1&&this.totals.row.subTotalsDimensions)for(let $=0,Q=(ht=(rt=(j=(q=this.totals)===null||q===void 0?void 0:q.row)===null||j===void 0?void 0:j.subTotalsDimensions)===null||rt===void 0?void 0:rt.length)!==null&&ht!==void 0?ht:0;$<Q;$++){const et=this.totals.row.subTotalsDimensions[$],ot=this.rows.indexOf(et);this.rowsIsTotal[ot]=!0}if(!((gt=this.totals)===null||gt===void 0)&>.column&&this.totals.column.showSubTotals!==!1&&this.totals.column.subTotalsDimensions)for(let $=0,Q=(Y=(O=(W=(vt=this.totals)===null||vt===void 0?void 0:vt.column)===null||W===void 0?void 0:W.subTotalsDimensions)===null||O===void 0?void 0:O.length)!==null&&Y!==void 0?Y:0;$<Q;$++){const et=this.totals.column.subTotalsDimensions[$],ot=this.columns.indexOf(et);this.colsIsTotal[ot]=!0}this.setRecords(l)}setRecords(t){var e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b,w,C;this.records=t,this.collectedValues={},this.cacheCollectedValues={},this.totalRecordsTree={},this.tree={},this.colFlatKeys={},this.rowFlatKeys={},this.colKeys=[],this.rowKeys=[],this.rowsHasValue=[],this.columnsHasValue=[],t&&(this.records=t,typeof window<"u"&&window.performance.now(),this.processRecords(),this.processCollectedValuesWithSumBy(),this.generateCollectedValuesSortRule(),this.processCollectedValuesWithSortBy(),typeof window<"u"&&window.performance.now(),typeof window<"u"&&window.performance.now(),this.totalStatistics(),typeof window<"u"&&window.performance.now(),this.rowKeys_normal=this.rowKeys.slice(),this.colKeys_normal=this.colKeys.slice(),typeof window<"u"&&window.performance.now(),this.sortKeys(),typeof window<"u"&&window.performance.now(),typeof window<"u"&&window.performance.now(),this.customRowTree?this.rowHeaderTree=this.customRowTree:this.rowHierarchyType==="tree"?this.rowHeaderTree=this.ArrToTree1(this.rowKeys,this.rows.filter((_,y)=>this.rowsHasValue[y]),this.indicatorsAsCol?void 0:this.indicators,((i=(e=this.totals)===null||e===void 0?void 0:e.row)===null||i===void 0?void 0:i.showGrandTotals)||!this.indicatorsAsCol&&this.columns.length===0||this.indicatorsAsCol&&this.rows.length===0,this.rowGrandTotalLabel):this.rowHeaderTree=this.ArrToTree(this.rowKeys,this.rows.filter((_,y)=>this.rowsHasValue[y]),this.indicatorsAsCol?void 0:this.indicators,this.rowsIsTotal,((r=(o=this.totals)===null||o===void 0?void 0:o.row)===null||r===void 0?void 0:r.showGrandTotals)||this.indicatorsAsCol&&this.rows.length===0,this.rowGrandTotalLabel,this.rowSubTotalLabel,(a=(l=(s=this.totals)===null||s===void 0?void 0:s.row)===null||l===void 0?void 0:l.showGrandTotalsOnTop)!==null&&a!==void 0&&a,(u=(d=(h=this.totals)===null||h===void 0?void 0:h.row)===null||d===void 0?void 0:d.showSubTotalsOnTop)!==null&&u!==void 0&&u),this.customColTree?this.colHeaderTree=this.customColTree:this.colHeaderTree=this.ArrToTree(this.colKeys,this.columns.filter((_,y)=>this.columnsHasValue[y]),this.indicatorsAsCol?this.indicators:void 0,this.colsIsTotal,((g=(c=this.totals)===null||c===void 0?void 0:c.column)===null||g===void 0?void 0:g.showGrandTotals)||!this.indicatorsAsCol&&this.columns.length===0,this.colGrandTotalLabel,this.colSubTotalLabel,(v=(p=(f=this.totals)===null||f===void 0?void 0:f.column)===null||p===void 0?void 0:p.showGrandTotalsOnLeft)!==null&&v!==void 0&&v,(w=(b=(m=this.totals)===null||m===void 0?void 0:m.column)===null||b===void 0?void 0:b.showSubTotalsOnLeft)!==null&&w!==void 0&&w),typeof window<"u"&&window.performance.now(),!((C=this.dataConfig)===null||C===void 0)&&C.isPivotChart&&this.cacheDeminsionCollectedValues())}registerAggregator(t,e){this.aggregators[t]=e}registerAggregators(){this.registerAggregator(Mt.RECORD,wC),this.registerAggregator(Mt.SUM,xC),this.registerAggregator(Mt.COUNT,AC),this.registerAggregator(Mt.MAX,TC),this.registerAggregator(Mt.MIN,MC),this.registerAggregator(Mt.AVG,RC),this.registerAggregator(Mt.NONE,SC),this.registerAggregator(Mt.RECALCULATE,tE)}processCollectedValuesWithSumBy(){var t,e,i,o,r,s;for(const l in this.collectedValues)if(!((e=(t=this.collectValuesBy)===null||t===void 0?void 0:t[l])===null||e===void 0)&&e.sumBy)for(const a in this.collectedValues[l]){let h;((i=this.collectValuesBy[l])===null||i===void 0?void 0:i.extendRange)==="sum"?(h=Object.values(this.collectedValues[l][a]).reduce((g,f)=>g+f.value(),0),h+=Math.round(h/20)):(h=Object.values(this.collectedValues[l][a]).reduce((g,f)=>f.value()>g?f.value():g,Number.MIN_SAFE_INTEGER),((o=this.collectValuesBy[l])===null||o===void 0?void 0:o.extendRange)==="max"?h+=Math.round(h/20):typeof((r=this.collectValuesBy[l])===null||r===void 0?void 0:r.extendRange)=="number"&&(h=Math.max(h,(s=this.collectValuesBy[l])===null||s===void 0?void 0:s.extendRange)));const d=Object.values(this.collectedValues[l][a]).reduce((g,f)=>f.value()<g?f.value():g,Number.MAX_SAFE_INTEGER);let u,c;this.needSplitPositiveAndNegative&&(u=Object.values(this.collectedValues[l][a]).reduce((g,f)=>f.positiveValue()>g?f.positiveValue():g,Number.MIN_SAFE_INTEGER),c=Object.values(this.collectedValues[l][a]).reduce((g,f)=>f.negativeValue()<g?f.negativeValue():g,Number.MAX_SAFE_INTEGER)),this.collectedValues[l][a]={},this.collectedValues[l][a].max=h,this.collectedValues[l][a].min=d,this.needSplitPositiveAndNegative&&(this.collectedValues[l][a].positiveMax=u,this.collectedValues[l][a].negativeMin=c)}}processCollectedValuesWithSortBy(){var t,e;const i=this;for(const o in this.collectedValues)if(!((e=(t=this.collectValuesBy)===null||t===void 0?void 0:t[o])===null||e===void 0)&&e.sortBy)for(const r in this.collectedValues[o])this.collectedValues[o][r]=this.collectedValues[o][r].sort((s,l)=>{var a,h,d,u;return((h=(a=i.collectValuesBy[o].sortBy)===null||a===void 0?void 0:a.indexOf(s))!==null&&h!==void 0?h:-1)-((u=(d=i.collectValuesBy[o].sortBy)===null||d===void 0?void 0:d.indexOf(l))!==null&&u!==void 0?u:-1)})}generateCollectedValuesSortRule(){for(const t in this.collectedValues)if(this.collectValuesBy&&this.collectValuesBy[t]&&!this.collectValuesBy[t].sortBy){let e=[];for(const i in this.collectedValues[t])Array.isArray(this.collectedValues[t][i])&&(e.push(...this.collectedValues[t][i]),e=Array.from(new Set(e)));e.length>0&&(this.collectValuesBy[t].sortBy=e)}}processRecords(){var t,e;let i=!1;if(((e=(t=this.filterRules)===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0)>=1&&(i=!0),Array.isArray(this.records)){this.filteredRecords||(this.filteredRecords=[]);for(let o=0,r=this.records.length;o<r;o++){const s=this.records[o];i&&!this.filterRecord(s)||(this.filteredRecords.push(s),this.processRecord(s))}}else{this.filteredRecords||(this.filteredRecords={});for(const o in this.records)for(let r=0,s=this.records[o].length;r<s;r++){const l=this.records[o][r];i&&!this.filterRecord(l)||(this.filteredRecords[o]||(this.filteredRecords[o]=[]),this.filteredRecords[o].push(l),this.processRecord(l,o))}}this.rowFlatKeys={},this.colFlatKeys={}}filterRecord(t){var e,i;let o=!0;if(this.filterRules)for(let r=0;r<this.filterRules.length;r++){const s=this.filterRules[r];if(s.filterKey){const l=t[s.filterKey];if(((e=s.filteredValues)===null||e===void 0?void 0:e.indexOf(l))===-1){o=!1;break}}else if(!(!((i=s.filterFunc)===null||i===void 0)&&i.call(s,t))){o=!1;break}}return o}processRecord(t,e){var i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O,Y,$,Q,et,ot,K,at,tt,_t,yt,ut,xt,de,Re,Ge,Qe,$i;(i=this.derivedFieldRules)===null||i===void 0||i.forEach((pt,mt)=>{pt.fieldName&&pt.derivedFunc&&(t[pt.fieldName]=pt.derivedFunc(t))});for(const pt in this.collectValuesBy)if(I(t[pt])){this.collectedValues[pt]||(this.collectedValues[pt]={});const mt=this.collectValuesBy[pt].by.map(It=>t[It]).join(this.stringJoinChar);if(this.collectedValues[pt][mt]||(this.collectValuesBy[pt].sumBy?this.collectedValues[pt][mt]={}:this.collectValuesBy[pt].range?this.collectedValues[pt][mt]={min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER}:this.collectedValues[pt][mt]=[]),this.collectValuesBy[pt].sumBy){const It=this.collectValuesBy[pt].sumBy.map(Vt=>t[Vt]).join(this.stringJoinChar);this.collectedValues[pt][mt][It]||(this.collectedValues[pt][mt][It]=new this.aggregators[Mt.SUM]({key:pt,dimension:pt,isRecord:void 0,needSplitPositiveAndNegative:this.needSplitPositiveAndNegative})),this.collectedValues[pt][mt][It].push(t)}else if(this.collectValuesBy[pt].range){const It=this.collectedValues[pt][mt],Vt=Math.max(t[pt],It.max),se=Math.min(t[pt],It.min);isNaN(Vt)||(It.max=Vt,It.min=se)}else{const It=this.collectedValues[pt][mt];It.indexOf(t[pt])===-1&&It.push(t[pt])}}let si=!1;const ti=[],ue=[];if(!this.parseCustomTreeToMatchRecords||!((o=this.dataConfig)===null||o===void 0)&&o.isPivotChart||!(!((r=this.customRowTree)===null||r===void 0)&&r.length)||e||this.hasExtensionRowTree){const pt=[];ue.push({rowKey:pt,indicatorKey:e});for(let mt=0,It=this.rows.length;mt<It;mt++){const Vt=this.rows[mt];if(Vt in t)this.rowsHasValue[mt]=!0,pt.push(t[Vt]);else if(Vt!==ln){if(!((a=(l=(s=this.dataConfig)===null||s===void 0?void 0:s.totals)===null||l===void 0?void 0:l.row)===null||a===void 0)&&a.showGrandTotals&&mt===0&&!this.rows.find(se=>se in t)){pt.push(this.rowGrandTotalLabel),si=!0;break}if(!((u=(d=(h=this.dataConfig)===null||h===void 0?void 0:h.totals)===null||d===void 0?void 0:d.row)===null||u===void 0)&&u.subTotalsDimensions&&((f=(g=(c=this.dataConfig)===null||c===void 0?void 0:c.totals)===null||g===void 0?void 0:g.row)===null||f===void 0?void 0:f.subTotalsDimensions.indexOf(this.rows[mt-1]))>=0){this.rowHierarchyType==="grid"&&pt.push(this.rowSubTotalLabel),si=!0;break}}}}else{const pt=this.getFieldMatchRowDimensionPaths(t);if(pt.length>0)for(let mt=0,It=pt.length;mt<It;mt++){const Vt=pt[mt],se=[];let zt;for(let At=0,le=Vt.length;At<le;At++)I(Vt[At].indicatorKey)?zt=Vt[At].indicatorKey:se.push(Vt[At].value);ue.push({rowKey:se,indicatorKey:zt})}}if(!this.parseCustomTreeToMatchRecords||!((p=this.dataConfig)===null||p===void 0)&&p.isPivotChart||!(!((v=this.customColTree)===null||v===void 0)&&v.length)||e||this.hasExtensionRowTree){const pt=[];ti.push({colKey:pt,indicatorKey:e});for(let mt=0,It=this.columns.length;mt<It;mt++){const Vt=this.columns[mt];if(Vt in t)this.columnsHasValue[mt]=!0,pt.push(t[Vt]);else if(Vt!==ln){if(!((w=(b=(m=this.dataConfig)===null||m===void 0?void 0:m.totals)===null||b===void 0?void 0:b.column)===null||w===void 0)&&w.showGrandTotals&&mt===0&&!this.columns.find(se=>se in t)){pt.push(this.colGrandTotalLabel),si=!0;break}if(!((y=(_=(C=this.dataConfig)===null||C===void 0?void 0:C.totals)===null||_===void 0?void 0:_.column)===null||y===void 0)&&y.subTotalsDimensions&&((A=(S=(x=this.dataConfig)===null||x===void 0?void 0:x.totals)===null||S===void 0?void 0:S.column)===null||A===void 0?void 0:A.subTotalsDimensions.indexOf(this.columns[mt-1]))>=0){pt.push(this.colSubTotalLabel),si=!0;break}}}}else{const pt=this.getFieldMatchColDimensionPaths(t);if(pt.length>0)for(let mt=0,It=pt.length;mt<It;mt++){const Vt=pt[mt],se=[];let zt;for(let At=0,le=Vt.length;At<le;At++)I(Vt[At].indicatorKey)?zt=Vt[At].indicatorKey:se.push(Vt[At].value);ti.push({colKey:se,indicatorKey:zt})}}for(let pt=0;pt<ue.length;pt++){const mt=ue[pt].rowKey;let It;this.indicatorsAsCol||(It=ue[pt].indicatorKey);for(let Vt=0;Vt<ti.length;Vt++){const se=ti[Vt].colKey;this.indicatorsAsCol&&(It=ti[Vt].indicatorKey);const zt=mt.join(this.stringJoinChar),At=se.join(this.stringJoinChar);if(si){this.totalRecordsTree[zt]||(this.totalRecordsTree[zt]={}),this.totalRecordsTree[zt][At]||(this.totalRecordsTree[zt][At]=[]);const wt=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let Lt=0;Lt<wt.length;Lt++)if(this.calculatedFiledKeys.indexOf(wt[Lt])>=0){const ge=(R=this.calculatedFieldRules)===null||R===void 0?void 0:R.find(Yi=>Yi.key===wt[Lt]);!((M=(T=this.totalRecordsTree[zt])===null||T===void 0?void 0:T[At])===null||M===void 0)&&M[Lt]||(this.totalRecordsTree[zt][At][Lt]=new this.aggregators[Mt.RECALCULATE]({key:wt[Lt],dimension:wt[Lt],isRecord:!0,formatFun:(k=(P=this.indicators)===null||P===void 0?void 0:P.find(Yi=>typeof Yi!="string"&&Yi.indicatorKey===wt[Lt]))===null||k===void 0?void 0:k.format,calculateFun:ge==null?void 0:ge.calculateFun,dependAggregators:this.totalRecordsTree[zt][At],dependIndicatorKeys:ge==null?void 0:ge.dependIndicatorKeys})),wt[Lt]in t&&((H=(B=this.totalRecordsTree[zt])===null||B===void 0?void 0:B[At])===null||H===void 0||H[Lt].push(t))}else{const ge=this.getAggregatorRule(wt[Lt]);!((F=(E=this.totalRecordsTree[zt])===null||E===void 0?void 0:E[At])===null||F===void 0)&&F[Lt]||(this.totalRecordsTree[zt][At][Lt]=new this.aggregators[(L=ge==null?void 0:ge.aggregationType)!==null&&L!==void 0?L:Mt.SUM]({key:wt[Lt],dimension:(z=ge==null?void 0:ge.field)!==null&&z!==void 0?z:wt[Lt],formatFun:(D=ge==null?void 0:ge.formatFun)!==null&&D!==void 0?D:(V=(N=this.indicators)===null||N===void 0?void 0:N.find(Yi=>typeof Yi!="string"&&Yi.indicatorKey===wt[Lt]))===null||V===void 0?void 0:V.format})),wt[Lt]in t&&((U=(G=this.totalRecordsTree[zt])===null||G===void 0?void 0:G[At])===null||U===void 0||U[Lt].push(t))}return}mt.length!==0&&(this.rowFlatKeys[zt]||(this.rowKeys.push(mt),this.rowFlatKeys[zt]=1)),se.length!==0&&(this.colFlatKeys[At]||(this.colKeys.push(se),this.colFlatKeys[At]=1)),this.tree[zt]||(this.tree[zt]={}),!((Z=this.tree[zt])===null||Z===void 0)&&Z[At]||(this.tree[zt][At]=[]);const le=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let wt=0;wt<le.length;wt++)if(this.calculatedFiledKeys.indexOf(le[wt])>=0){const Lt=(q=this.calculatedFieldRules)===null||q===void 0?void 0:q.find(ge=>ge.key===le[wt]);!((rt=(j=this.tree[zt])===null||j===void 0?void 0:j[At])===null||rt===void 0)&&rt[wt]||(this.tree[zt][At][wt]=new this.aggregators[Mt.RECALCULATE]({key:le[wt],dimension:le[wt],isRecord:!0,formatFun:(gt=(ht=this.indicators)===null||ht===void 0?void 0:ht.find(ge=>typeof ge!="string"&&ge.indicatorKey===le[wt]))===null||gt===void 0?void 0:gt.format,calculateFun:Lt==null?void 0:Lt.calculateFun,dependAggregators:this.tree[zt][At],dependIndicatorKeys:Lt==null?void 0:Lt.dependIndicatorKeys})),(W=(vt=this.tree[zt])===null||vt===void 0?void 0:vt[At])===null||W===void 0||W[wt].push(t)}else{const Lt=this.getAggregatorRule(le[wt]);let ge=!1;It?e===It?le[wt]===It&&(ge=!0):le[wt]===It&&le[wt]in t&&(ge=!0):Lt!=null&&Lt.field?typeof(Lt==null?void 0:Lt.field)=="string"?(Lt==null?void 0:Lt.field)in t&&(ge=!0):Lt!=null&&Lt.field.find(Yi=>Yi in t)&&(ge=!0):le[wt]in t&&(ge=!0),!(!((Y=(O=this.tree[zt])===null||O===void 0?void 0:O[At])===null||Y===void 0)&&Y[wt])&&ge&&(this.tree[zt][At][wt]=new this.aggregators[($=Lt==null?void 0:Lt.aggregationType)!==null&&$!==void 0?$:Mt.SUM]({key:le[wt],dimension:(Q=Lt==null?void 0:Lt.field)!==null&&Q!==void 0?Q:le[wt],formatFun:(et=Lt==null?void 0:Lt.formatFun)!==null&&et!==void 0?et:(K=(ot=this.indicators)===null||ot===void 0?void 0:ot.find(Yi=>typeof Yi!="string"&&Yi.indicatorKey===le[wt]))===null||K===void 0?void 0:K.format})),ge&&((tt=(at=this.tree[zt])===null||at===void 0?void 0:at[At])===null||tt===void 0||tt[wt].push(t))}if(this.mappingRules)for(let wt=0;wt<this.indicatorKeys.length;wt++){if(!this.indicatorStatistics[wt]){const Lt=this.getAggregatorRule(this.indicatorKeys[wt]);this.indicatorStatistics[wt]={max:new this.aggregators[Mt.MAX]({key:this.indicatorKeys[wt],dimension:this.indicatorKeys[wt]}),min:new this.aggregators[Mt.MIN]({key:this.indicatorKeys[wt],dimension:this.indicatorKeys[wt]}),total:new this.aggregators[(_t=Lt==null?void 0:Lt.aggregationType)!==null&&_t!==void 0?_t:Mt.SUM]({key:this.indicatorKeys[wt],dimension:(yt=Lt==null?void 0:Lt.field)!==null&&yt!==void 0?yt:this.indicatorKeys[wt],formatFun:(ut=Lt==null?void 0:Lt.formatFun)!==null&&ut!==void 0?ut:(de=(xt=this.indicators)===null||xt===void 0?void 0:xt.find(ge=>typeof ge!="string"&&ge.indicatorKey===this.indicatorKeys[wt]))===null||de===void 0?void 0:de.format})}}this.indicatorStatistics[wt].max.push((Ge=(Re=this.tree[zt])===null||Re===void 0?void 0:Re[At])===null||Ge===void 0?void 0:Ge[wt].value()),this.indicatorStatistics[wt].min.push(($i=(Qe=this.tree[zt])===null||Qe===void 0?void 0:Qe[At])===null||$i===void 0?void 0:$i[wt].value()),this.indicatorStatistics[wt].total.push(t)}}}}updateSortRules(t){var e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b,w;this.sorted=!1,this.sortRules=t,this.sortKeys(),this.customRowTree||(this.rowHierarchyType==="tree"?this.rowHeaderTree=this.ArrToTree1(this.rowKeys,this.rows.filter((C,_)=>this.rowsHasValue[_]),this.indicatorsAsCol?void 0:this.indicators,((i=(e=this.totals)===null||e===void 0?void 0:e.row)===null||i===void 0?void 0:i.showGrandTotals)||!this.indicatorsAsCol&&this.columns.length===0||this.indicatorsAsCol&&this.rows.length===0,this.rowGrandTotalLabel):this.rowHeaderTree=this.ArrToTree(this.rowKeys,this.rows.filter((C,_)=>this.rowsHasValue[_]),this.indicatorsAsCol?void 0:this.indicators,this.rowsIsTotal,((r=(o=this.totals)===null||o===void 0?void 0:o.row)===null||r===void 0?void 0:r.showGrandTotals)||this.indicatorsAsCol&&this.rows.length===0,this.rowGrandTotalLabel,this.rowSubTotalLabel,(a=(l=(s=this.totals)===null||s===void 0?void 0:s.row)===null||l===void 0?void 0:l.showGrandTotalsOnTop)!==null&&a!==void 0&&a,(u=(d=(h=this.totals)===null||h===void 0?void 0:h.row)===null||d===void 0?void 0:d.showSubTotalsOnTop)!==null&&u!==void 0&&u)),this.customColTree||(this.colHeaderTree=this.ArrToTree(this.colKeys,this.columns.filter((C,_)=>this.columnsHasValue[_]),this.indicatorsAsCol?this.indicators:void 0,this.colsIsTotal,((g=(c=this.totals)===null||c===void 0?void 0:c.column)===null||g===void 0?void 0:g.showGrandTotals)||!this.indicatorsAsCol&&this.columns.length===0,this.colGrandTotalLabel,this.colSubTotalLabel,(v=(p=(f=this.totals)===null||f===void 0?void 0:f.column)===null||p===void 0?void 0:p.showGrandTotalsOnLeft)!==null&&v!==void 0&&v,(w=(b=(m=this.totals)===null||m===void 0?void 0:m.column)===null||b===void 0?void 0:b.showSubTotalsOnLeft)!==null&&w!==void 0&&w))}updateFilterRules(t,e=!1){var i,o;if(this.filterRules=t,this.filteredRecords=void 0,e)this.tree={};else for(const r in this.tree)for(const s in this.tree[r])for(let l=0;l<this.tree[r][s].length;l++)(i=this.tree[r][s][l])===null||i===void 0||i.reset();this.collectedValues={},this.processRecords(),this.processCollectedValuesWithSumBy(),this.processCollectedValuesWithSortBy(),this.totalStatistics(),!((o=this.dataConfig)===null||o===void 0)&&o.isPivotChart&&this.cacheDeminsionCollectedValues()}getAggregatorRule(t){var e;return(e=this.aggregationRules)===null||e===void 0?void 0:e.find((i,o)=>t===i.indicatorKey)}getAggregator(t=[],e=[],i,o=!0,r){var s,l,a,h;const d=this.indicatorKeys.indexOf(i);let u,c;typeof t=="string"?u=t:(r&&r.position!=="row"||t.map((f,p)=>{f!==i||I(r==null?void 0:r.index)&&p!==r.index||t.splice(p,1)}),u=a1(t,this.stringJoinChar)),typeof e=="string"?c=e:(r&&r.position!=="col"||e.map((f,p)=>{f!==i||I(r==null?void 0:r.index)&&p!==r.index||e.splice(p,1)}),c=a1(e,this.stringJoinChar));const g=(l=(s=this.tree[u])===null||s===void 0?void 0:s[c])===null||l===void 0?void 0:l[d];if(o&&I((h=(a=this.changedTree[u])===null||a===void 0?void 0:a[c])===null||h===void 0?void 0:h[d])){const f=this.changedTree[u][c][d];return g?{value:()=>f,formatValue:g.formatValue,formatFun:g.formatFun,records:g.records,className:"",recalculate(){},push(){},deleteRecord(){},updateRecord(){},clearCacheValue(){},reset(){}}:{value:()=>f,className:"",push(){},deleteRecord(){},updateRecord(){},recalculate(){},formatValue:()=>f,clearCacheValue(){},reset(){}}}return g||{className:"",push(){},deleteRecord(){},updateRecord(){},recalculate(){},value:()=>null,clearCacheValue(){},reset(){}}}sortKeys(){if(this.colKeys=this.colKeys_normal.slice(),this.rowKeys=this.rowKeys_normal.slice(),!this.sorted){this.sorted=!0,this.rowKeys.sort(this.arrSort(this.rows,!0));const t=this.arrSort(this.columns,!1);this.colKeys.sort(t)}}arrSort(t,e){let i;const o=this,r=function(s){const l=[];for(let a=0,h=t.length;a<h;a++)if(i=t[a],o.sortRules)for(let d=0,u=o.sortRules.length;d<u;d++)o.sortRules[d].sortField===i&&l.push({field:i,fieldIndex:a,sortRule:o.sortRules[d],func:o.getSort(o.sortRules[d],e)});return l}.call(this);return function(s,l){var a,h,d,u;let c,g;for(let f=0;f<r.length;f++){if(g=r[f],(a=g.sortRule)===null||a===void 0?void 0:a.sortByIndicator){let p=s,v=l;g.fieldIndex<t.length-1&&(p=s.slice(0,g.fieldIndex+1),o.rowHierarchyType==="grid"&&e?p.push(o.rowSubTotalLabel):e||p.push(o.colSubTotalLabel),v=l.slice(0,g.fieldIndex+1),o.rowHierarchyType==="grid"&&e?v.push(o.rowSubTotalLabel):e||v.push(o.colSubTotalLabel)),c=g.func(p,v,(h=g.sortRule)===null||h===void 0?void 0:h.sortType)}else c=(d=g.func)===null||d===void 0?void 0:d.call(g,s[g.fieldIndex],l[g.fieldIndex],(u=g.sortRule)===null||u===void 0?void 0:u.sortType);if(c!==0)return c}return 0}}getSort(t,e){const i=this;return t.sortByIndicator?(o,r,s)=>{const l=function(a,h){return i.rowHierarchyType==="grid"&&a.length<i.rows.length&&a[a.length-1]!==i.rowSubTotalLabel&&a[a.length-1]!==i.rowGrandTotalLabel&&a.push(i.rowSubTotalLabel),h.length<i.columns.length&&h[h.length-1]!==i.colSubTotalLabel&&h[h.length-1]!==i.colGrandTotalLabel&&h.push(i.colSubTotalLabel),i.getAggregator(a,h,t.sortByIndicator).value()};return e?Fh(l(o,t.query),l(r,t.query),s):Fh(l(t.query,o),l(t.query,r),s)}:t.sortBy?iE(t.sortBy):t.sortFunc?t.sortFunc:t.sortType?eE:Fh}totalStatistics(){var t,e,i,o,r,s,l,a,h,d,u,c,g,f;const p=this,v=(m,b)=>{var w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O,Y,$,Q,et,ot,K,at,tt,_t,yt,ut,xt,de,Re,Ge,Qe,$i,si;if(!((C=(w=this.totalRecordsTree)===null||w===void 0?void 0:w[m])===null||C===void 0)&&C[b])return this.tree[m]||(this.tree[m]={}),void(this.tree[m][b]=(y=(_=this.totalRecordsTree)===null||_===void 0?void 0:_[m])===null||y===void 0?void 0:y[b]);const ti=b.split(this.stringJoinChar);if(!((S=(x=p.totals)===null||x===void 0?void 0:x.column)===null||S===void 0)&&S.subTotalsDimensions&&((T=(R=(A=p.totals)===null||A===void 0?void 0:A.column)===null||R===void 0?void 0:R.subTotalsDimensions)===null||T===void 0?void 0:T.length)>0&&p.totals.column.showSubTotals!==!1)for(let ue=0,pt=(k=(P=(M=p.totals)===null||M===void 0?void 0:M.column)===null||P===void 0?void 0:P.subTotalsDimensions)===null||k===void 0?void 0:k.length;ue<pt;ue++){const mt=p.totals.column.subTotalsDimensions[ue],It=p.columns.indexOf(mt);if(It>=0){const Vt=ti.slice(0,It+1);Vt.push(p.colSubTotalLabel);const se=Vt.join(this.stringJoinChar);if(!((H=(B=this.totalRecordsTree)===null||B===void 0?void 0:B[m])===null||H===void 0)&&H[se])return void(this.tree[m][se]=(F=(E=this.totalRecordsTree)===null||E===void 0?void 0:E[m])===null||F===void 0?void 0:F[se]);this.tree[m][se]||(this.tree[m][se]=[]);const zt=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let At=0;At<zt.length;At++)if(this.calculatedFiledKeys.indexOf(zt[At])>=0){const le=(L=this.calculatedFieldRules)===null||L===void 0?void 0:L.find(wt=>wt.key===zt[At]);!((D=(z=this.tree[m])===null||z===void 0?void 0:z[se])===null||D===void 0)&&D[At]||(this.tree[m][se][At]=new this.aggregators[Mt.RECALCULATE]({key:zt[At],dimension:zt[At],isRecord:!0,formatFun:(V=(N=this.indicators)===null||N===void 0?void 0:N.find(wt=>typeof wt!="string"&&wt.indicatorKey===zt[At]))===null||V===void 0?void 0:V.format,calculateFun:le==null?void 0:le.calculateFun,dependAggregators:this.tree[m][se],dependIndicatorKeys:le==null?void 0:le.dependIndicatorKeys})),se!==b&&this.tree[m][se][At].push((U=(G=p.tree[m])===null||G===void 0?void 0:G[b])===null||U===void 0?void 0:U[At])}else{if(!this.tree[m][se][At]){const le=this.getAggregatorRule(zt[At]);this.tree[m][se][At]=new this.aggregators[(Z=le==null?void 0:le.aggregationType)!==null&&Z!==void 0?Z:Mt.SUM]({key:zt[At],dimension:(q=le==null?void 0:le.field)!==null&&q!==void 0?q:zt[At],formatFun:(j=le==null?void 0:le.formatFun)!==null&&j!==void 0?j:(ht=(rt=this.indicators)===null||rt===void 0?void 0:rt.find(wt=>typeof wt!="string"&&wt.indicatorKey===zt[At]))===null||ht===void 0?void 0:ht.format})}se!==b&&this.tree[m][se][At].push((vt=(gt=p.tree[m])===null||gt===void 0?void 0:gt[b])===null||vt===void 0?void 0:vt[At])}}}if(!((O=(W=p.totals)===null||W===void 0?void 0:W.column)===null||O===void 0)&&O.showGrandTotals||this.rows.length===0){const ue=p.colGrandTotalLabel;if(!(($=(Y=this.totalRecordsTree)===null||Y===void 0?void 0:Y[m])===null||$===void 0)&&$[ue])return void(this.tree[m][ue]=(et=(Q=this.totalRecordsTree)===null||Q===void 0?void 0:Q[m])===null||et===void 0?void 0:et[ue]);this.tree[m][ue]||(this.tree[m][ue]=[]);const pt=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let mt=0;mt<pt.length;mt++)if(this.calculatedFiledKeys.indexOf(pt[mt])>=0){const It=(ot=this.calculatedFieldRules)===null||ot===void 0?void 0:ot.find(Vt=>Vt.key===pt[mt]);!((at=(K=this.tree[m])===null||K===void 0?void 0:K[ue])===null||at===void 0)&&at[mt]||(this.tree[m][ue][mt]=new this.aggregators[Mt.RECALCULATE]({key:pt[mt],dimension:pt[mt],isRecord:!0,formatFun:(_t=(tt=this.indicators)===null||tt===void 0?void 0:tt.find(Vt=>typeof Vt!="string"&&Vt.indicatorKey===pt[mt]))===null||_t===void 0?void 0:_t.format,calculateFun:It==null?void 0:It.calculateFun,dependAggregators:this.tree[m][ue],dependIndicatorKeys:It==null?void 0:It.dependIndicatorKeys})),ue!==b&&this.tree[m][ue][mt].push((ut=(yt=p.tree[m])===null||yt===void 0?void 0:yt[b])===null||ut===void 0?void 0:ut[mt])}else{if(!this.tree[m][ue][mt]){const It=this.getAggregatorRule(pt[mt]);this.tree[m][ue][mt]=new this.aggregators[(xt=It==null?void 0:It.aggregationType)!==null&&xt!==void 0?xt:Mt.SUM]({key:pt[mt],dimension:(de=It==null?void 0:It.field)!==null&&de!==void 0?de:pt[mt],formatFun:(Re=It==null?void 0:It.formatFun)!==null&&Re!==void 0?Re:(Qe=(Ge=this.indicators)===null||Ge===void 0?void 0:Ge.find(Vt=>typeof Vt!="string"&&Vt.indicatorKey===pt[mt]))===null||Qe===void 0?void 0:Qe.format})}ue!==b&&this.tree[m][ue][mt].push((si=($i=p.tree[m])===null||$i===void 0?void 0:$i[b])===null||si===void 0?void 0:si[mt])}}};if(!((e=(t=p==null?void 0:p.totals)===null||t===void 0?void 0:t.column)===null||e===void 0)&&e.subTotalsDimensions&&((r=(o=(i=p==null?void 0:p.totals)===null||i===void 0?void 0:i.column)===null||o===void 0?void 0:o.subTotalsDimensions)===null||r===void 0?void 0:r.length)>=1||!((l=(s=p==null?void 0:p.totals)===null||s===void 0?void 0:s.row)===null||l===void 0)&&l.subTotalsDimensions&&((d=(h=(a=p==null?void 0:p.totals)===null||a===void 0?void 0:a.row)===null||h===void 0?void 0:h.subTotalsDimensions)===null||d===void 0?void 0:d.length)>=1||!((c=(u=p==null?void 0:p.totals)===null||u===void 0?void 0:u.column)===null||c===void 0)&&c.showGrandTotals||!((f=(g=p==null?void 0:p.totals)===null||g===void 0?void 0:g.row)===null||f===void 0)&&f.showGrandTotals){const m=[];Object.keys(p.tree).forEach(b=>{const w=b.split(this.stringJoinChar);Object.keys(p.tree[b]).forEach(C=>{var _,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O;if(!((y=(_=p.totals)===null||_===void 0?void 0:_.row)===null||y===void 0)&&y.subTotalsDimensions&&((A=(S=(x=p.totals)===null||x===void 0?void 0:x.row)===null||S===void 0?void 0:S.subTotalsDimensions)===null||A===void 0?void 0:A.length)>0&&p.totals.row.showSubTotals!==!1)for(let Y=0,$=(M=(T=(R=p.totals)===null||R===void 0?void 0:R.row)===null||T===void 0?void 0:T.subTotalsDimensions)===null||M===void 0?void 0:M.length;Y<$;Y++){const Q=p.totals.row.subTotalsDimensions[Y],et=p.rows.indexOf(Q);if(et>=0&&et<p.rows.length-1){const ot=w.slice(0,et+1);this.rowHierarchyType==="grid"&&ot.push(p.rowSubTotalLabel);const K=ot.join(this.stringJoinChar);this.tree[K]||(this.tree[K]={},m.push(K)),this.tree[K][C]||(this.tree[K][C]=[]);const at=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let tt=0;tt<at.length;tt++){if(!this.tree[K][C][tt])if(this.calculatedFiledKeys.indexOf(at[tt])>=0){const _t=(P=this.calculatedFieldRules)===null||P===void 0?void 0:P.find(yt=>yt.key===at[tt]);this.tree[K][C][tt]=new this.aggregators[Mt.RECALCULATE]({key:at[tt],dimension:at[tt],isRecord:!0,formatFun:(B=(k=this.indicators)===null||k===void 0?void 0:k.find(yt=>typeof yt!="string"&&yt.indicatorKey===at[tt]))===null||B===void 0?void 0:B.format,calculateFun:_t==null?void 0:_t.calculateFun,dependAggregators:this.tree[K][C],dependIndicatorKeys:_t==null?void 0:_t.dependIndicatorKeys})}else{const _t=this.getAggregatorRule(at[tt]);this.tree[K][C][tt]=new this.aggregators[(H=_t==null?void 0:_t.aggregationType)!==null&&H!==void 0?H:Mt.SUM]({key:at[tt],dimension:(E=_t==null?void 0:_t.field)!==null&&E!==void 0?E:at[tt],formatFun:(F=_t==null?void 0:_t.formatFun)!==null&&F!==void 0?F:(z=(L=this.indicators)===null||L===void 0?void 0:L.find(yt=>typeof yt!="string"&&yt.indicatorKey===at[tt]))===null||z===void 0?void 0:z.format})}K!==b&&this.tree[K][C][tt].push((N=(D=p.tree[b])===null||D===void 0?void 0:D[C])===null||N===void 0?void 0:N[tt])}}}if(!((G=(V=p.totals)===null||V===void 0?void 0:V.row)===null||G===void 0)&&G.showGrandTotals||this.columns.length===0){const Y=p.rowGrandTotalLabel;this.tree[Y]||(this.tree[Y]={},m.push(Y)),this.tree[Y][C]||(this.tree[Y][C]=[]);const $=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let Q=0;Q<$.length;Q++){if(!this.tree[Y][C][Q])if(this.calculatedFiledKeys.indexOf($[Q])>=0){const et=(U=this.calculatedFieldRules)===null||U===void 0?void 0:U.find(ot=>ot.key===$[Q]);this.tree[Y][C][Q]=new this.aggregators[Mt.RECALCULATE]({key:$[Q],dimension:$[Q],isRecord:!0,formatFun:(q=(Z=this.indicators)===null||Z===void 0?void 0:Z.find(ot=>typeof ot!="string"&&ot.indicatorKey===$[Q]))===null||q===void 0?void 0:q.format,calculateFun:et==null?void 0:et.calculateFun,dependAggregators:this.tree[Y][C],dependIndicatorKeys:et==null?void 0:et.dependIndicatorKeys})}else{const et=this.getAggregatorRule($[Q]);this.tree[Y][C][Q]=new this.aggregators[(j=et==null?void 0:et.aggregationType)!==null&&j!==void 0?j:Mt.SUM]({key:$[Q],dimension:(rt=et==null?void 0:et.field)!==null&&rt!==void 0?rt:$[Q],formatFun:(ht=et==null?void 0:et.formatFun)!==null&&ht!==void 0?ht:(vt=(gt=this.indicators)===null||gt===void 0?void 0:gt.find(ot=>typeof ot!="string"&&ot.indicatorKey===$[Q]))===null||vt===void 0?void 0:vt.format})}Y!==b&&this.tree[Y][C][Q].push((O=(W=p.tree[b])===null||W===void 0?void 0:W[C])===null||O===void 0?void 0:O[Q])}}v(b,C)})}),m.forEach(b=>{Object.keys(p.tree[b]).forEach(w=>{v(b,w)})})}for(const m in p.totalRecordsTree)for(const b in p.totalRecordsTree[m])v(m,b)}ArrToTree1(t,e,i,o,r){const s=[],l=this.stringJoinChar,a=new Map;function h(d){const u=[];let c;d.forEach((g,f)=>{var p;u.push(g);const v=u.join(l);let m=a.get(v);m||(m={value:g,dimensionKey:e[f],children:f===d.length-1&&((p=i==null?void 0:i.length)!==null&&p!==void 0?p:0)>=1?i==null?void 0:i.map(b=>typeof b=="string"?{indicatorKey:b,value:b}:{indicatorKey:b.indicatorKey,value:b.title}):[]},a.set(v,m),c?c.children.push(m):s.push(m)),c=m})}return t.forEach(d=>h(d)),o&&h([r]),s}ArrToTree(t,e,i,o,r,s,l,a,h){var d;let u=[];const c=this.stringJoinChar,g=new Map;if(t!=null&&t.length?t.forEach(f=>function(p){const v=[];let m;p.forEach((b,w)=>{var C,_,y,x;v.push(b);const S=v.join(c);let A=g.get(S);if(!A){if(A={value:b,dimensionKey:e[w],children:w===p.length-1&&((C=i==null?void 0:i.length)!==null&&C!==void 0?C:0)>=1?i==null?void 0:i.map(R=>typeof R=="string"?{indicatorKey:R,value:R}:{indicatorKey:R.indicatorKey,value:R.title}):[]},o[w]){let R=(_=A.children)!==null&&_!==void 0?_:[];const T={value:l,dimensionKey:e[w+1],levelSpan:o.length-w-1,children:((y=i==null?void 0:i.length)!==null&&y!==void 0?y:0)>=1?i==null?void 0:i.map(M=>typeof M=="string"?{indicatorKey:M,value:M}:{indicatorKey:M.indicatorKey,value:M.title}):[]};R.push(T),R=(x=T.children)!==null&&x!==void 0?x:[]}g.set(S,A),m?o[w-1]&&!h?m.children.splice(m.children.length-1,0,A):m.children.push(A):u.push(A)}m=A})}(f)):i&&(u=i==null?void 0:i.map(f=>{var p;return typeof f=="string"?{indicatorKey:f,value:f}:{indicatorKey:f.indicatorKey,value:(p=f.title)!==null&&p!==void 0?p:f.indicatorKey}})),r&&(t==null?void 0:t.length)){const f={value:s,dimensionKey:e[0],levelSpan:o.length,children:(d=i==null?void 0:i.map(p=>typeof p=="string"?{indicatorKey:p,value:p}:{indicatorKey:p.indicatorKey,value:p.title}))!==null&&d!==void 0?d:[]};a?u.unshift(f):u.push(f)}return u}cacheDeminsionCollectedValues(){for(const t in this.collectValuesBy)this.collectValuesBy[t].type!=="xField"&&this.collectValuesBy[t].type!=="yField"||(this.dataConfig.dimensionSortArray?this.cacheCollectedValues[t]=Az(this.collectedValues[t],this.dataConfig.dimensionSortArray):this.cacheCollectedValues[t]=this.collectedValues[t])}changeTreeNodeValue(t=[],e=[],i,o){var r,s,l;const a=this.indicatorKeys.indexOf(i);let h,d;h=typeof t=="string"?t:t.join(this.stringJoinChar),d=typeof e=="string"?e:e.join(this.stringJoinChar),!((r=this.changedTree[h])===null||r===void 0)&&r[d]?this.changedTree[h][d][a]=o:this.changedTree[h]?(this.changedTree[h][d]=[],this.changedTree[h][d][a]=o):(this.changedTree[h]={},this.changedTree[h][d]=[],this.changedTree[h][d][a]=o);const u=(l=(s=this.tree[h])===null||s===void 0?void 0:s[d])===null||l===void 0?void 0:l[a];(u==null?void 0:u.records.length)===1&&(u.records[0][this.indicatorKeys[a]]=o)}changeRecordFieldValue(t,e,i){let o=!1;for(let r=0;r<this.indicatorKeys.length;r++)this.indicatorKeys[r]===t&&(o=!0);if(!o){if(Array.isArray(this.records))for(let r=0,s=this.records.length;r<s;r++){const l=this.records[r];l[t]===e&&(l[t]=i)}else for(const r in this.records)for(let s=0,l=this.records[r].length;s<l;s++){const a=this.records[r][s];a[t]===e&&(a[t]=i)}this.rowFlatKeys={},this.colFlatKeys={},this.tree={},this.processRecords()}}_rowTreeHasChanged(){this.hasExtensionRowTree||(this.customRowTreeDimensionPaths=this.customTreeToDimensionPathArr(this.customRowTree,"row"))}changeDataConfig(t){this.rows=t.rows,this.columns=t.columns}addRecords(t){for(let e=0,i=t.length;e<i;e++){const o=t[e];this.processRecord(o)}Array.isArray(this.records)&&this.records.push(t)}customTreeToDimensionPathArr(t,e){const i=[],o=this;function r(s,l){var a,h,d;s.virtual||(!((a=l[l.length-1])===null||a===void 0)&&a.childKeys&&s.dimensionKey&&l[l.length-1].childKeys.indexOf(s.dimensionKey)===-1&&s.dimensionKey!==l[l.length-1].dimensionKey&&l[l.length-1].childKeys.push(s.dimensionKey),l.push({dimensionKey:I(s.indicatorKey)?void 0:s.dimensionKey,value:s.value,indicatorKey:s.indicatorKey,virtual:s.virtual})),((h=s.children)===null||h===void 0?void 0:h.length)>0?(o.rowHierarchyType==="tree"&&e==="row"&&(l[l.length-1].childKeys=[],i.push([...l])),(d=s.children)===null||d===void 0||d.forEach(u=>r(u,[...l]))):i.push(l)}return t==null||t.forEach(s=>r(s,[])),i}getFieldMatchColDimensionPaths(t){var e,i;const o=[];for(let r=0;(i=r<((e=this.customColTreeDimensionPaths)===null||e===void 0?void 0:e.length))!==null&&i!==void 0&&i;r++){const s=this.customColTreeDimensionPaths[r];let l=!0;for(let a=0;a<s.length;a++){const h=s[a];if(h.dimensionKey&&t[h.dimensionKey]!==h.value||h.indicatorKey&&t[h.indicatorKey]===void 0){l=!1;break}}l&&o.push(s)}return o}getFieldMatchRowDimensionPaths(t){var e,i;const o=[];for(let r=0;(i=r<((e=this.customRowTreeDimensionPaths)===null||e===void 0?void 0:e.length))!==null&&i!==void 0&&i;r++){const s=this.customRowTreeDimensionPaths[r];let l=!0;for(let a=0;a<s.length;a++){const h=s[a];if(h.dimensionKey&&t[h.dimensionKey]!==h.value||h.indicatorKey&&t[h.indicatorKey]===void 0){l=!1;break}if(h.childKeys&&a===s.length-1&&h.childKeys.length>0&&h.childKeys.find(d=>I(t[d]))){l=!1;break}}l&&(this.indicatorsAsCol||this.rowHierarchyType!=="tree"||s.find(a=>a.indicatorKey)||(l=!1)),l&&o.push(s)}return o}}function Az(n,t){return n.sort((e,i)=>{const o=t.indexOf(e),r=t.indexOf(i);return o<r?-1:o>r?1:0})}let Rz=class extends NI{constructor(t,e){var i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b;if(Wt.mode==="node"?(e=t,t=null):t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e),this.layoutNodeId={seqId:0},e){e.layout&&Object.assign(e,e.layout),this.internalProps.columns=Be(e.columns),this.internalProps.rows=Be(e.rows),this.internalProps.indicators=Ld(e.indicators),(i=e.indicators)===null||i===void 0||i.forEach((C,_)=>{typeof C=="object"&&(C!=null&&C.editor)&&(this.internalProps.indicators[_].editor=C.editor)}),this.internalProps.columnTree=!e.indicatorsAsCol||!((o=e.columns)===null||o===void 0)&&o.length||e.columnTree?Be(e.columnTree):[],this.internalProps.rowTree=e.indicatorsAsCol||!((r=e.rows)===null||r===void 0)&&r.length||e.rowTree?Be(e.rowTree):[],this.internalProps.records=e.records,this.pagination=e.pagination,this.internalProps.columnResizeType=(s=e.columnResizeType)!==null&&s!==void 0?s:"column",this.internalProps.rowResizeType=(l=e.rowResizeType)!==null&&l!==void 0?l:"row",this.internalProps.dataConfig=Be(e.dataConfig),this.internalProps.columnWidthConfig=e.columnWidthConfig;const w=this.internalProps.records;if(this.internalProps.recordsIsTwoDimensionalArray=!1,((a=w==null?void 0:w[0])===null||a===void 0?void 0:a.constructor)===Array&&(this.internalProps.recordsIsTwoDimensionalArray=!0),((h=e.customConfig)===null||h===void 0?void 0:h.enableDataAnalysis)===!1){const C=new ci((d=this.internalProps.columnTree)!==null&&d!==void 0?d:[],this.layoutNodeId),_=new ci((u=this.internalProps.rowTree)!==null&&u!==void 0?u:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(c=this.options.rowExpandLevel)!==null&&c!==void 0?c:1:void 0);this.internalProps.layoutMap=new Rl(this,null,C,_),this.internalProps.recordsIsTwoDimensionalArray===!1&&(this.flatDataToObjects=new gf({rows:this.internalProps.layoutMap.fullRowDimensionKeys,columns:this.internalProps.layoutMap.colDimensionKeys,indicators:this.internalProps.layoutMap.indicatorKeys,indicatorsAsCol:this.internalProps.layoutMap.indicatorsAsCol,indicatorDimensionKey:this.internalProps.layoutMap.indicatorDimensionKey},w))}else{const C=Ly(this,e),{rowKeys:_,columnKeys:y,indicatorKeys:x}=C;let{columnDimensionTree:S,rowDimensionTree:A}=C;this.dataset=new h1(this.internalProps.dataConfig,_,y,x,this.internalProps.indicators,(g=e.indicatorsAsCol)===null||g===void 0||g,e.records,e.rowHierarchyType,this.internalProps.columnTree,this.internalProps.rowTree,!1,!!e.extensionRows,!!e.parseCustomTreeToMatchRecords),e.columnTree||(e.indicatorsAsCol!==!1&&(this.dataset.colHeaderTree=$r(this.dataset.colHeaderTree,e.indicators)),S=new ci((f=this.dataset.colHeaderTree)!==null&&f!==void 0?f:[],this.layoutNodeId)),e.rowTree||(e.indicatorsAsCol===!1&&(this.dataset.rowHeaderTree=$r(this.dataset.rowHeaderTree,e.indicators)),A=new ci((p=this.dataset.rowHeaderTree)!==null&&p!==void 0?p:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(v=this.options.rowExpandLevel)!==null&&v!==void 0?v:1:void 0)),this.internalProps.layoutMap=new Rl(this,this.dataset,S,A)}if(this._changePivotSortStateBySortRules(),((b=(m=e.pivotSortState)===null||m===void 0?void 0:m.length)!==null&&b!==void 0?b:0)>0&&(this.pivotSortState=[],this.pivotSortState=e.pivotSortState),Wt.mode!=="node"&&(this.editorManager=new s3(this)),this.refreshHeader(),this.internalProps.useOneRowHeightFillAll=!1,this.stateManager.initCheckedState(w),this.scenegraph.createSceneGraph(),e.title){const C=St.getComponent("title");this.internalProps.title=new C(e.title,this),this.scenegraph.resize()}if(this.options.emptyTip)if(this.internalProps.emptyTip)this.internalProps.emptyTip.resetVisible();else{const C=St.getComponent("emptyTip");this.internalProps.emptyTip=new C(this.options.emptyTip,this),this.internalProps.emptyTip.resetVisible()}setTimeout(()=>{this.fireListeners(J.INITIALIZED,null)},0)}}static get EVENT_TYPE(){return po}isListTable(){return!1}isPivotTable(){return!0}isPivotChart(){return!1}get recordsCount(){var t;return(t=this.records)===null||t===void 0?void 0:t.length}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i){if(this.internalProps.layoutMap.isSeriesNumber(t,e)&&this.internalProps.rowSeriesNumber.disableColumnResize===!0)return!1;if(!this.internalProps.layoutMap.indicatorsAsCol){const o=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(o!=null&&o.disableColumnResize)return!1}}return i}updateOption(t){var e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b,w;const C=this.internalProps;if(super.updateOption(t),this.layoutNodeId={seqId:0},this.internalProps.columns=Be(t.columns),this.internalProps.rows=Be(t.rows),this.internalProps.indicators=!((e=t.indicators)===null||e===void 0)&&e.length?Ld(t.indicators):[],(i=t.indicators)===null||i===void 0||i.forEach((y,x)=>{typeof y=="object"&&(y!=null&&y.editor)&&(this.internalProps.indicators[x].editor=y.editor)}),this.internalProps.columnTree=!t.indicatorsAsCol||!((o=t.columns)===null||o===void 0)&&o.length||t.columnTree?Be(t.columnTree):[],this.internalProps.rowTree=t.indicatorsAsCol||!((r=t.rows)===null||r===void 0)&&r.length||t.rowTree?Be(t.rowTree):[],t.records&&(this.internalProps.records=t.records),this.stateManager.initCheckedState(this.internalProps.records),this.stateManager.updateDrillState(void 0,void 0,!1,!1,-1,-1),this.pagination=t.pagination,C.columnResizeType=(s=t.columnResizeType)!==null&&s!==void 0?s:"column",C.rowResizeType=(l=t.rowResizeType)!==null&&l!==void 0?l:"row",C.dataConfig=Be(t.dataConfig),this.internalProps.columnWidthConfig=t.columnWidthConfig,(t==null?void 0:t.rowHierarchyType)==="tree"&&this.internalProps.layoutMap.rowHierarchyType==="tree"&&this.internalProps.layoutMap.rowExpandLevel===(t==null?void 0:t.rowExpandLevel)){const y=this.internalProps.layoutMap.rowDimensionTree.tree.children;(a=this.internalProps.rowTree)===null||a===void 0||a.forEach((x,S)=>{const A=y.find(R=>R.dimensionKey===x.dimensionKey&&R.value===x.value);A&&this._syncHierarchyState(A,x)})}const _=this.internalProps.records;if(this.internalProps.recordsIsTwoDimensionalArray=!1,((h=_==null?void 0:_[0])===null||h===void 0?void 0:h.constructor)===Array&&(this.internalProps.recordsIsTwoDimensionalArray=!0),((d=t.customConfig)===null||d===void 0?void 0:d.enableDataAnalysis)===!1){let y,x;t.columnTree&&(y=new ci((u=this.internalProps.columnTree)!==null&&u!==void 0?u:[],this.layoutNodeId)),t.rowTree&&(x=new ci((c=this.internalProps.rowTree)!==null&&c!==void 0?c:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(g=this.options.rowExpandLevel)!==null&&g!==void 0?g:1:void 0)),C.layoutMap=new Rl(this,null,y,x),this.internalProps.recordsIsTwoDimensionalArray===!1&&(this.flatDataToObjects=new gf({rows:C.layoutMap.fullRowDimensionKeys,columns:C.layoutMap.colDimensionKeys,indicators:C.layoutMap.indicatorKeys,indicatorsAsCol:C.layoutMap.indicatorsAsCol,indicatorDimensionKey:C.layoutMap.indicatorDimensionKey},_))}else{const y=Ly(this,t),{rowKeys:x,columnKeys:S,indicatorKeys:A}=y;let{columnDimensionTree:R,rowDimensionTree:T}=y;this.dataset=new h1(C.dataConfig,x,S,A,this.internalProps.indicators,(f=t.indicatorsAsCol)===null||f===void 0||f,_,t.rowHierarchyType,this.internalProps.columnTree,this.internalProps.rowTree,!1,!!t.extensionRows,!!t.parseCustomTreeToMatchRecords),t.columnTree||(t.indicatorsAsCol!==!1&&(this.dataset.colHeaderTree=$r(this.dataset.colHeaderTree,t.indicators)),R=new ci((p=this.dataset.colHeaderTree)!==null&&p!==void 0?p:[],this.layoutNodeId)),t.rowTree||(t.indicatorsAsCol===!1&&(this.dataset.rowHeaderTree=$r(this.dataset.rowHeaderTree,t.indicators)),T=new ci((v=this.dataset.rowHeaderTree)!==null&&v!==void 0?v:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(m=this.options.rowExpandLevel)!==null&&m!==void 0?m:1:void 0)),C.layoutMap=new Rl(this,this.dataset,R,T)}if(this._changePivotSortStateBySortRules(),((w=(b=t.pivotSortState)===null||b===void 0?void 0:b.length)!==null&&w!==void 0?w:0)>0&&(this.pivotSortState=[],this.pivotSortState=t.pivotSortState),this.refreshHeader(),this.internalProps.useOneRowHeightFillAll=!1,C.releaseList&&(C.releaseList.forEach(y=>{var x;return(x=y==null?void 0:y.release)===null||x===void 0?void 0:x.call(y)}),C.releaseList=null),this.scenegraph.clearCells(),this.scenegraph.createSceneGraph(),t.title){const y=St.getComponent("title");this.internalProps.title=new y(t.title,this),this.scenegraph.resize()}if(this.options.emptyTip)if(this.internalProps.emptyTip)this.internalProps.emptyTip.resetVisible();else{const y=St.getComponent("emptyTip");this.internalProps.emptyTip=new y(this.options.emptyTip,this),this.internalProps.emptyTip.resetVisible()}return new Promise(y=>{setTimeout(y,0)})}updatePagination(t){t?(this.pagination||(this.pagination={currentPage:0,perPageCount:0}),typeof t.currentPage=="number"&&t.currentPage>=0&&(this.pagination.currentPage=t.currentPage),t.perPageCount&&(this.pagination.perPageCount=t.perPageCount||this.pagination.perPageCount),this.scenegraph.clearCells(),this.internalProps.layoutMap.setPagination(this.pagination),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render()):this.pagination&&(this.pagination=void 0,this.scenegraph.clearCells(),this.internalProps.layoutMap.setPagination(void 0),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render())}refreshHeader(){this.setMinMaxLimitWidth(!0),this.refreshRowColCount()}refreshRowColCount(){var t,e,i,o,r,s,l,a,h;const d=this,{layoutMap:u}=d.internalProps;u&&(d.colCount=(t=u.colCount)!==null&&t!==void 0?t:0,d.rowCount=(e=u.rowCount)!==null&&e!==void 0?e:0,this.internalProps.frozenColCount=Math.max(((i=u.rowHeaderLevelCount)!==null&&i!==void 0?i:0)+u.leftRowSeriesNumberColumnCount,(o=this.options.frozenColCount)!==null&&o!==void 0?o:0),d.frozenRowCount=Math.max(u.headerLevelCount,(r=this.options.frozenRowCount)!==null&&r!==void 0?r:0),d.bottomFrozenRowCount!==((s=this.options.bottomFrozenRowCount)!==null&&s!==void 0?s:0)&&(d.bottomFrozenRowCount=(l=this.options.bottomFrozenRowCount)!==null&&l!==void 0?l:0),d.rightFrozenColCount!==((a=this.options.rightFrozenColCount)!==null&&a!==void 0?a:0)&&(d.rightFrozenColCount=(h=this.options.rightFrozenColCount)!==null&&h!==void 0?h:0),this.stateManager.setFrozenCol(this.internalProps.frozenColCount))}_getSortFuncFromHeaderOption(t,e,i){}get rowHierarchyType(){return this.internalProps.layoutMap.rowHierarchyType}_syncHierarchyState(t,e){var i,o;t.value===e.value&&t.dimensionKey===e.dimensionKey&&(e.hierarchyState=(i=e.hierarchyState)!==null&&i!==void 0?i:e!=null&&e.children?t.hierarchyState:void 0,(o=e==null?void 0:e.children)===null||o===void 0||o.forEach((r,s)=>{var l;if(!((l=t==null?void 0:t.children)===null||l===void 0)&&l[s]&&r){const a=t.children.find(h=>h.dimensionKey===r.dimensionKey&&h.value===r.value);a&&this._syncHierarchyState(a,r)}}))}getRecordShowIndexByCell(t,e){}getTableIndexByRecordIndex(t){}getTableIndexByField(t){}getCellAddrByFieldRecord(t,e){}getBodyIndexByRow(t){const{layoutMap:e}=this.internalProps;return e.getBodyIndexByRow(t)}getBodyIndexByCol(t){const{layoutMap:e}=this.internalProps;return e.getBodyIndexByCol(t)}getFieldData(t,e,i){var o,r,s;if(!this.internalProps.layoutMap.isHeader(e,i)){if(this.internalProps.recordsIsTwoDimensionalArray){const l=this.getBodyIndexByRow(i),a=this.getBodyIndexByCol(e);return(o=this.records[l])===null||o===void 0?void 0:o[a]}if(this.dataset){const l=this.internalProps.layoutMap.getCellHeaderPaths(e,i);if(l){let a;const h=(r=l.colHeaderPaths)===null||r===void 0?void 0:r.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(a={position:"col",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),d=(s=l.rowHeaderPaths)===null||s===void 0?void 0:s.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(a={position:"row",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),u=this.dataset.getAggregator(d,h,this.internalProps.layoutMap.getIndicatorKey(e,i),!0,a);if(u.records&&u.records.length>=1)return u.records[0][t]}}else if(this.flatDataToObjects){const l=this.internalProps.layoutMap.getCellHeaderPaths(e,i),a=l.colHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),h=l.rowHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),d=this.flatDataToObjects.getTreeNode(h,a,this.internalProps.layoutMap.getBody(e,i).indicatorKey,!1);if(d!=null&&d.record)return d==null?void 0:d.record[t]}}}getCellValue(t,e,i){var o,r,s,l,a,h,d;if(!i){const u=this.getCustomMergeValue(t,e);if(u)return u}if(this.internalProps.layoutMap.isSeriesNumber(t,e)){if(this.internalProps.layoutMap.isSeriesNumberInHeader(t,e)){const{title:c}=this.internalProps.layoutMap.getSeriesNumberHeader(t,e);return c}const{format:u}=this.internalProps.layoutMap.getSeriesNumberBody(t,e);return typeof u=="function"?u(t,e,this):e-this.columnHeaderLevelCount+1}if(this.internalProps.layoutMap.isHeader(t,e)){const{title:u,fieldFormat:c}=this.internalProps.layoutMap.getHeader(t,e);return typeof c=="function"?c(u,t,e,this):u}if(this.internalProps.recordsIsTwoDimensionalArray){const{fieldFormat:u}=this.internalProps.layoutMap.getBody(t,e),c=this.getBodyIndexByRow(e),g=this.getBodyIndexByCol(t),f=(o=this.records[c])===null||o===void 0?void 0:o[g];return typeof u=="function"?u(f,t,e,this):f}if(this.dataset){const u=this.internalProps.layoutMap.getCellHeaderPaths(t,e);let c;const g=(s=(r=u.colHeaderPaths)===null||r===void 0?void 0:r.filter(m=>!m.virtual))===null||s===void 0?void 0:s.map((m,b)=>{var w;return m.indicatorKey&&(c={position:"col",index:b}),(w=m.indicatorKey)!==null&&w!==void 0?w:m.value}),f=(a=(l=u.rowHeaderPaths)===null||l===void 0?void 0:l.filter(m=>!m.virtual))===null||a===void 0?void 0:a.map((m,b)=>{var w;return m.indicatorKey&&(c={position:"row",index:b}),(w=m.indicatorKey)!==null&&w!==void 0?w:m.value}),p=this.dataset.getAggregator(f,g,this.internalProps.layoutMap.getIndicatorKey(t,e),!0,c),{fieldFormat:v}=this.internalProps.layoutMap.getBody(t,e);return p.formatValue?p.formatValue(t,e,this):typeof v=="function"?v(p==null?void 0:p.value(),t,e,this):(h=p==null?void 0:p.value())!==null&&h!==void 0?h:""}if(this.flatDataToObjects){const u=this.internalProps.layoutMap.getCellHeaderPaths(t,e),c=u.colHeaderPaths.map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value}),g=u.rowHeaderPaths.map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value}),f=this.flatDataToObjects.getTreeNode(g,c,this.internalProps.layoutMap.getBody(t,e).indicatorKey),{fieldFormat:p}=this.internalProps.layoutMap.getBody(t,e);return typeof p=="function"?p(f==null?void 0:f.value,t,e,this):(d=f==null?void 0:f.value)!==null&&d!==void 0?d:""}}getCellOriginValue(t,e){var i,o,r;const s=this;if(s.internalProps.layoutMap.isHeader(t,e)){const{title:l}=s.internalProps.layoutMap.getHeader(t,e);return typeof l=="function"?l():l}if(this.internalProps.recordsIsTwoDimensionalArray){const l=this.getBodyIndexByRow(e),a=this.getBodyIndexByCol(t);return(i=this.records[l])===null||i===void 0?void 0:i[a]}if(this.dataset){let l;const a=this.internalProps.layoutMap.getCellHeaderPaths(t,e),h=(o=a.colHeaderPaths)===null||o===void 0?void 0:o.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(l={position:"col",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),d=(r=a.rowHeaderPaths)===null||r===void 0?void 0:r.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(l={position:"row",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),u=this.dataset.getAggregator(d,h,this.internalProps.layoutMap.getIndicatorKey(t,e),!0,l);return u.value?u.value():void 0}if(this.flatDataToObjects){const l=this.internalProps.layoutMap.getCellHeaderPaths(t,e),a=l.colHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),h=l.rowHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),d=this.flatDataToObjects.getTreeNode(h,a,this.internalProps.layoutMap.getBody(t,e).indicatorKey);return d==null?void 0:d.value}}getCellRawValue(t,e){var i,o,r;const s=this;if(s.internalProps.layoutMap.isHeader(t,e)){const{title:l}=s.internalProps.layoutMap.getHeader(t,e);return typeof l=="function"?l():l}if(this.internalProps.recordsIsTwoDimensionalArray){const l=this.getBodyIndexByRow(e),a=this.getBodyIndexByCol(t);return(i=this.records[l])===null||i===void 0?void 0:i[a]}if(this.dataset){let l;const a=this.internalProps.layoutMap.getCellHeaderPaths(t,e),h=(o=a.colHeaderPaths)===null||o===void 0?void 0:o.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(l={position:"col",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),d=(r=a.rowHeaderPaths)===null||r===void 0?void 0:r.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(l={position:"row",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),u=this.dataset.getAggregator(d,h,this.internalProps.layoutMap.getIndicatorKey(t,e),!1,l);return u.value?u.value():void 0}if(this.flatDataToObjects){const l=this.internalProps.layoutMap.getCellHeaderPaths(t,e),a=l.colHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),h=l.rowHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),d=this.flatDataToObjects.getTreeNode(h,a,this.internalProps.layoutMap.getBody(t,e).indicatorKey,!1);return d==null?void 0:d.value}}getCellOriginRecord(t,e){var i,o,r;if(!this.internalProps.layoutMap.isHeader(t,e)){if(this.internalProps.recordsIsTwoDimensionalArray){const s=this.getBodyIndexByRow(e),l=this.getBodyIndexByCol(t);return(i=this.records[s])===null||i===void 0?void 0:i[l]}if(this.dataset){let s;const l=this.internalProps.layoutMap.getCellHeaderPaths(t,e),a=(o=l.colHeaderPaths)===null||o===void 0?void 0:o.filter(d=>!d.virtual).map((d,u)=>{var c;return d.indicatorKey&&(s={position:"col",index:u}),(c=d.indicatorKey)!==null&&c!==void 0?c:d.value}),h=(r=l.rowHeaderPaths)===null||r===void 0?void 0:r.filter(d=>!d.virtual).map((d,u)=>{var c;return d.indicatorKey&&(s={position:"row",index:u}),(c=d.indicatorKey)!==null&&c!==void 0?c:d.value});return this.dataset.getAggregator(h,a,this.internalProps.layoutMap.getIndicatorKey(t,e),!0,s).records}if(this.flatDataToObjects){const s=this.internalProps.layoutMap.getCellHeaderPaths(t,e),l=s.colHeaderPaths.map(d=>{var u;return(u=d.indicatorKey)!==null&&u!==void 0?u:d.value}),a=s.rowHeaderPaths.map(d=>{var u;return(u=d.indicatorKey)!==null&&u!==void 0?u:d.value}),h=this.flatDataToObjects.getTreeNode(a,l,this.internalProps.layoutMap.getBody(t,e).indicatorKey);return h==null?void 0:h.record}}}getCellRawRecord(t,e){var i,o,r;if(!this.internalProps.layoutMap.isHeader(t,e)){if(this.internalProps.recordsIsTwoDimensionalArray){const s=this.getBodyIndexByRow(e),l=this.getBodyIndexByCol(t);return(i=this.records[s])===null||i===void 0?void 0:i[l]}if(this.dataset){let s;const l=this.internalProps.layoutMap.getCellHeaderPaths(t,e),a=(o=l.colHeaderPaths)===null||o===void 0?void 0:o.filter(d=>!d.virtual).map((d,u)=>{var c;return d.indicatorKey&&(s={position:"col",index:u}),(c=d.indicatorKey)!==null&&c!==void 0?c:d.value}),h=(r=l.rowHeaderPaths)===null||r===void 0?void 0:r.filter(d=>!d.virtual).map((d,u)=>{var c;return d.indicatorKey&&(s={position:"row",index:u}),(c=d.indicatorKey)!==null&&c!==void 0?c:d.value});return this.dataset.getAggregator(h,a,this.internalProps.layoutMap.getIndicatorKey(t,e),!1,s).records}if(this.flatDataToObjects){const s=this.internalProps.layoutMap.getCellHeaderPaths(t,e),l=s.colHeaderPaths.map(d=>{var u;return(u=d.indicatorKey)!==null&&u!==void 0?u:d.value}),a=s.rowHeaderPaths.map(d=>{var u;return(u=d.indicatorKey)!==null&&u!==void 0?u:d.value}),h=this.flatDataToObjects.getTreeNode(a,l,this.internalProps.layoutMap.getBody(t,e).indicatorKey,!1);return h==null?void 0:h.record}}}updateSortRules(t,e,i){this.internalProps.dataConfig?this.internalProps.dataConfig.sortRules=t:this.internalProps.dataConfig={sortRules:t},this.dataset.updateSortRules(t),this._changePivotSortStateBySortRules();const{layoutMap:o}=this.internalProps;o.resetHeaderTree(),this.scenegraph.clearCells(),nt(e)&&nt(i)?(this.isRowHeader(e,i)?(this.setMinMaxLimitWidth(!0),this.internalProps._widthResizedColMap.clear()):this.isCornerHeader(e,i)?o.cornerSetting.titleOnDimension==="column"?(this.setMinMaxLimitWidth(!0),this.internalProps._widthResizedColMap.clear()):o.cornerSetting.titleOnDimension==="row"&&this.internalProps._heightResizedRowMap.clear():this.isColumnHeader(e,i)&&this.internalProps._heightResizedRowMap.clear(),this.refreshRowColCount()):this.refreshHeader(),this.internalProps.useOneRowHeightFillAll=!1,this.scenegraph.createSceneGraph(!0),this.render()}_changePivotSortStateBySortRules(){var t,e,i,o;this.pivotSortState=[];const r=(e=(t=this.internalProps.dataConfig)===null||t===void 0?void 0:t.sortRules)!==null&&e!==void 0?e:[];for(let s=0;s<r.length;s++){const l=r[s],a=[];if(l.sortByIndicator&&l.sortField===(this.dataset.indicatorsAsCol?this.dataset.rows[this.dataset.rows.length-1]:this.dataset.columns[this.dataset.columns.length-1])){for(let d=0;d<l.query.length;d++)a.push({dimensionKey:this.dataset.indicatorsAsCol?this.dataset.columns[d]:this.dataset.rows[d],value:l.query[d]});a.push({indicatorKey:l.sortByIndicator,value:(o=(i=this.internalProps.layoutMap.getIndicatorInfo(l.sortByIndicator))===null||i===void 0?void 0:i.title)!==null&&o!==void 0?o:l.sortByIndicator})}else a.push({dimensionKey:l.sortField,isPivotCorner:!0,value:l.sortField});const h=l.sortType?l.sortType.toUpperCase():"ASC";this.pivotSortState.push({dimensions:a,order:Ve[h]})}}_parseColumnWidthConfig(t){for(let e=0;e<(t==null?void 0:t.length);e++){const i=t[e],o=i.dimensions,r=i.width,s=this.getCellAddressByHeaderPaths(o);s&&!this.internalProps._widthResizedColMap.has(s.col)&&(this._setColWidth(s.col,r),this.internalProps._widthResizedColMap.add(s.col))}}updatePivotSortState(t){this.pivotSortState=t}sort(t,e,i){var o;let r;if(this.isCornerHeader(t,e)){const a=this.getHeaderDefine(t,e);r=[];const h={isPivotCorner:!0,dimensionKey:a.value,value:a.value};r.push(h)}else r=this.isColumnHeader(t,e)?this.getCellHeaderPaths(t,e).colHeaderPaths:this.getCellHeaderPaths(t,e).rowHeaderPaths;const s=r[r.length-1].indicatorKey,l=this.getHeaderDefine(t,e);if(l.sort){if(this.dataset.sortRules){const a={};for(let h=this.dataset.sortRules.length-1;h>=0;h--){const d=this.dataset.sortRules[h];l.dimensionKey&&d.sortField===l.dimensionKey?(a[d.sortField]=d,this.dataset.sortRules.splice(h,1)):s&&d.sortField===(this.dataset.indicatorsAsCol?this.dataset.rows[this.dataset.rows.length-1]:this.dataset.columns[this.dataset.columns.length-1])&&this.dataset.sortRules.splice(h,1)}s?this.dataset.sortRules.push({sortField:this.dataset.indicatorsAsCol?this.dataset.rows[this.dataset.rows.length-1]:this.dataset.columns[this.dataset.columns.length-1],sortType:Ve[i],sortByIndicator:s,query:r.reduce((h,d)=>(d.dimensionKey&&h.push(d.value),h),[])}):this.dataset.sortRules.push(Object.assign((o=a[l.dimensionKey])!==null&&o!==void 0?o:{},{sortField:l.dimensionKey,sortType:Ve[i]}))}else this.dataset.sortRules=s?[{sortField:this.dataset.indicatorsAsCol?this.dataset.rows[this.dataset.rows.length-1]:this.dataset.columns[this.dataset.columns.length-1],sortType:Ve[i],sortByIndicator:s,query:r.reduce((a,h)=>(h.dimensionKey&&a.push(h.value),a),[])}]:[{sortField:l.dimensionKey,sortType:Ve[i]}];this.updateSortRules(this.dataset.sortRules,t,e)}}getPivotSortState(t,e){if(!this.pivotSortState)return;const i=this.getCellRange(t,e);for(let o=0;o<this.pivotSortState.length;o++){const r=this.pivotSortState[o],s=r.dimensions,l=this.getCellAddressByHeaderPaths(s),a=r.order;if(l&&Ti(i,l.col,l.row))return a}}_moveHeaderPosition(t,e){const i=this.getCellRange(t.col,t.row),o=this.getCellRange(e.col,e.row),r=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(r){if(r.moveType==="column"){if(this.internalProps.recordsIsTwoDimensionalArray)for(let s=0;s<this.internalProps.records.length;s++){const l=this.internalProps.records[s].splice(r.sourceIndex-this.rowHeaderLevelCount,r.sourceSize);l.unshift(r.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records[s],l)}this.colWidthsMap.exchangeOrder(i.start.col,i.end.col-i.start.col+1,o.start.col,o.end.col-o.start.col+1,r.targetIndex),this.setMinMaxLimitWidth()}else if(r.moveType==="row"){if(this.internalProps.recordsIsTwoDimensionalArray){const s=this.internalProps.records.splice(r.sourceIndex-this.columnHeaderLevelCount,r.sourceSize);s.unshift(r.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records,s)}r.targetIndex>r.sourceIndex?this.rowHeightsMap.exchangeOrder(r.sourceIndex,r.sourceSize,r.targetIndex+r.sourceSize-r.targetSize,r.targetSize,r.targetIndex):this.rowHeightsMap.exchangeOrder(r.sourceIndex,r.sourceSize,r.targetIndex,r.targetSize,r.targetIndex)}return r}return null}toggleHierarchyState(t,e,i=!0){const o=this.getHierarchyState(t,e);if(o===Pt.expand)this._refreshHierarchyState(t,e,i),this.fireListeners(po.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Pt.collapse});else if(o===Pt.collapse){const r=this.internalProps.layoutMap.getHeadNode(t,e);Array.isArray(r.children)&&this._refreshHierarchyState(t,e,i),this.fireListeners(po.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Pt.expand,originData:r})}}_refreshHierarchyState(t,e,i=!0,o){let r=!1,s=!1;this.stateManager.updateHoverIcon(t,e,void 0,void 0);const l=this.internalProps.layoutMap.checkHasChart();l&&(this.autoFillWidth&&(r=this.getAllColsWidth()<=this.tableNoFrameWidth),this.autoFillHeight&&(s=this.getAllRowsHeight()<=this.tableNoFrameHeight));const a=this.internalProps.layoutMap.toggleHierarchyState(t,e);o&&o(),this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(a.removeCellPositions,a.addCellPositions,a.updateCellPositions,i),l&&(this.autoFillWidth&&!r&&(r=this.getAllColsWidth()<=this.tableNoFrameWidth),this.autoFillHeight&&!s&&(s=this.getAllRowsHeight()<=this.tableNoFrameHeight),(this.widthMode==="adaptive"||r||this.heightMode==="adaptive"||s)&&this.scenegraph.updateChartSizeForResizeColWidth(-1))}getHeaderCellAddressByPath(t){return this.internalProps.layoutMap.getPivotCellAdress(t)}getCellAddressByHeaderPaths(t){return this.internalProps.layoutMap.getCellAdressByHeaderPath(t)}getHeaderPathByXY(t){let e;return e=t?this.getCellAt(t.x+this.getFrozenColsWidth()+this.scrollLeft+1,t.y+this.getFrozenRowsHeight()+this.scrollTop+1):this.getCellAt(this.getFrozenColsWidth()+this.scrollLeft+1,this.getFrozenRowsHeight()+this.scrollTop+1),this.internalProps.layoutMap.getCellHeaderPaths(e.col,e.row)}getHierarchyState(t,e){var i;return(i=this._getHeaderLayoutMap(t,e))===null||i===void 0?void 0:i.hierarchyState}getLayoutColumnTree(){return this.internalProps.layoutMap.getLayoutColumnTree()}getLayoutColumnTreeCount(){return this.internalProps.layoutMap.getLayoutColumnTreeCount()}getLayoutRowTree(){return this.internalProps.layoutMap.getLayoutRowTree()}getLayoutRowTreeCount(){return this.internalProps.layoutMap.getLayoutRowTreeCount()}getCellHeaderTreeNodes(t,e){return this.internalProps.layoutMap.getCellHeaderPathsWithTreeNode(t,e)}_hasHierarchyTreeHeader(){return this.internalProps.layoutMap.rowHierarchyType==="tree"}getMenuInfo(t,e,i){const o=this.internalProps.layoutMap.getPivotDimensionInfo(t,e);return{dimensionKey:o[o.length-1].dimensionKey,value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e),isPivotCorner:this.isCornerHeader(t,e),event:void 0}}setRecords(t){var e,i,o,r,s;const l={col:this.stateManager.hover.cellPos.col,row:this.stateManager.hover.cellPos.row};this.options.records=this.internalProps.records=t,this.internalProps.recordsIsTwoDimensionalArray=!1,((e=t==null?void 0:t[0])===null||e===void 0?void 0:e.constructor)===Array&&(this.internalProps.recordsIsTwoDimensionalArray=!0);const a=this.options,h=this.internalProps;if(((i=this.options.customConfig)===null||i===void 0?void 0:i.enableDataAnalysis)===!1)this.internalProps.recordsIsTwoDimensionalArray===!1&&(this.flatDataToObjects=new gf({rows:h.layoutMap.fullRowDimensionKeys,columns:h.layoutMap.colDimensionKeys,indicators:h.layoutMap.indicatorKeys,indicatorsAsCol:h.layoutMap.indicatorsAsCol,indicatorDimensionKey:h.layoutMap.indicatorDimensionKey},t));else{let d,u;this.dataset.setRecords(t),d=a.columnTree?h.layoutMap.columnDimensionTree:new ci((o=this.dataset.colHeaderTree)!==null&&o!==void 0?o:[],this.layoutNodeId),u=a.rowTree?h.layoutMap.rowDimensionTree:new ci((r=this.dataset.rowHeaderTree)!==null&&r!==void 0?r:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(s=this.options.rowExpandLevel)!==null&&s!==void 0?s:1:void 0),h.layoutMap=new Rl(this,this.dataset,d,u),this.pivotSortState=[],a.pivotSortState&&(this.pivotSortState=a.pivotSortState)}if(this.refreshHeader(),this.internalProps.useOneRowHeightFillAll=!1,this.scenegraph.clearCells(),this.clearCellStyleCache(),this.scenegraph.createSceneGraph(),this.stateManager.updateHoverPos(l.col,l.row),this.internalProps.title&&!this.internalProps.title.isReleased&&(this._updateSize(),this.internalProps.title.resize(),this.scenegraph.resize()),this.eventManager.updateEventBinder(),this.options.emptyTip)if(this.internalProps.emptyTip)this.internalProps.emptyTip.resetVisible();else{const d=St.getComponent("emptyTip");this.internalProps.emptyTip=new d(this.options.emptyTip,this),this.internalProps.emptyTip.resetVisible()}}startEditCell(t,e,i){var o;if(I(t)&&I(e))this.eventManager.isDraging=!1,this.selectCell(t,e),this.editorManager.startEditCell(t,e,i);else if(!((o=this.stateManager.select)===null||o===void 0)&&o.cellPos){const{col:r,row:s}=this.stateManager.select.cellPos;I(r)&&I(s)&&this.editorManager.startEditCell(r,s,i)}}completeEditCell(){this.editorManager.completeEdit()}getEditor(t,e){var i,o,r;let s;if(this.isCornerHeader(t,e)){const l=this.getHeaderDefine(t,e);s=(i=l==null?void 0:l.headerEditor)!==null&&i!==void 0?i:this.options.headerEditor}else if(this.isHeader(t,e)){const l=this.getHeaderDefine(t,e);s=(o=l==null?void 0:l.headerEditor)!==null&&o!==void 0?o:this.options.headerEditor}else{const l=this.getBodyColumnDefine(t,e);s=(r=l==null?void 0:l.editor)!==null&&r!==void 0?r:this.options.editor}return typeof s=="function"&&(s=s({col:t,row:e,dataValue:this.getCellOriginValue(t,e),value:this.getCellValue(t,e)||"",table:this})),typeof s=="string"?jI(s):s}isHasEditorDefine(t,e){var i;const o=this.getBodyColumnDefine(t,e);let r=(i=o==null?void 0:o.editor)!==null&&i!==void 0?i:this.options.editor;return typeof r=="function"&&(r=r({col:t,row:e,dataValue:this.getCellOriginValue(t,e),value:this.getCellValue(t,e)||"",table:this})),I(r)}changeCellValue(t,e,i,o=!1){if(o&&this.isHasEditorDefine(t,e)||o===!1){let r=i;const s=this.getCellOriginValue(t,e),l=this.getCellRawValue(t,e);typeof l=="number"&&ug(i)&&(r=parseFloat(i)),this._changeCellValueToDataSet(t,e,s,r);const a=this.getCellRange(t,e);for(let h=a.start.col;h<=a.end.col;h++)for(let d=a.start.row;d<=a.end.row;d++)this.scenegraph.updateCellContent(h,d);if(this.widthMode==="adaptive"||this.autoFillWidth&&this.getAllColsWidth()<=this.tableNoFrameWidth)this.internalProps._widthResizedColMap.size===0&&this.scenegraph.recalculateColWidths();else if(!this.internalProps._widthResizedColMap.has(t)){const h=this.getColWidth(t),d=Gr(t,0,this.rowCount-1,this,!1);d!==h&&this.scenegraph.updateColWidth(t,d-h)}if(this.heightMode==="adaptive"||this.autoFillHeight&&this.getAllRowsHeight()<=this.tableNoFrameHeight)this.internalProps._heightResizedRowMap.size===0&&this.scenegraph.recalculateRowHeights();else if(this.heightMode==="autoHeight"&&!this.internalProps._heightResizedRowMap.has(e)){const h=this.getRowHeight(e),d=dn(e,0,this.colCount-1,this);this.scenegraph.updateRowHeight(e,d-h)}this.fireListeners(J.CHANGE_CELL_VALUE,{col:t,row:e,rawValue:l,currentValue:s,changedValue:r}),this.scenegraph.updateNextFrame()}}changeCellValues(t,e,i,o=!1){let r=t,s=e;const l=[],a=[];for(let u=0;u<i.length&&!(e+u>this.rowCount-1);u++){const c=i[u],g=[],f=[];l.push(g),a.push(f);for(let p=0;p<c.length&&!(t+p>this.colCount-1);p++){const v=this.getCellRawValue(t+p,e+u);g.push(v);const m=this.getCellOriginValue(t+p,e+u);f.push(m)}}for(let u=0;u<i.length&&!(e+u>this.rowCount-1);u++){s=e+u;const c=i[u];let g=t;for(let f=0;f<c.length&&!(t+f>this.colCount-1);f++)if(g=t+f,o&&this.isHasEditorDefine(t+f,e+u)||o===!1){const p=c[f];let v=p;const m=a[u][f],b=l[u][f];typeof b=="number"&&ug(p)&&(v=parseFloat(p)),this._changeCellValueToDataSet(t+f,e+u,m,v),this.fireListeners(J.CHANGE_CELL_VALUE,{col:t+f,row:e+u,rawValue:b,currentValue:m,changedValue:this.getCellOriginValue(t+f,e+u)})}r=Math.max(r,g)}const h=this.getCellRange(t,e),d=this.getCellRange(r,s);for(let u=h.start.col;u<=d.end.col;u++)for(let c=h.start.row;c<=d.end.row;c++)this.scenegraph.updateCellContent(u,c);if(this.widthMode==="adaptive"||this.autoFillWidth&&this.getAllColsWidth()<=this.tableNoFrameWidth)this.internalProps._widthResizedColMap.size===0&&this.scenegraph.recalculateColWidths();else for(let u=t;u<=d.end.col;u++)if(!this.internalProps._widthResizedColMap.has(u)){const c=this.getColWidth(u),g=Gr(u,0,this.rowCount-1,this,!1);g!==c&&this.scenegraph.updateColWidth(u,g-c)}if(this.heightMode==="adaptive"||this.autoFillHeight&&this.getAllRowsHeight()<=this.tableNoFrameHeight)this.scenegraph.recalculateRowHeights();else if(this.heightMode==="autoHeight"){const u=[],c=[];for(let g=e;g<=d.end.row;g++)if(this.rowHeightsMap.get(g)){const f=this.getRowHeight(g),p=dn(g,0,this.colCount-1,this);u.push(g),c.push(p-f)}this.scenegraph.updateRowsHeight(u,c)}this.scenegraph.updateNextFrame()}_changeCellValueToDataSet(t,e,i,o){var r,s,l,a,h,d,u,c;if(this.internalProps.recordsIsTwoDimensionalArray){const g=this.getBodyIndexByRow(e),f=this.getBodyIndexByCol(t);this.records[g][f]=o}else if(this.dataset){const g=this.internalProps.layoutMap.getCellHeaderPaths(t,e);if(this.isCornerHeader(t,e))this.internalProps.layoutMap.changeCornerTitle(t,e,o);else if(this.isHeader(t,e))this.internalProps.layoutMap.changeTreeNodeTitle(t,e,o),!this.isCornerHeader(t,e)&&this.dataset.changeRecordFieldValue(!((r=g.colHeaderPaths)===null||r===void 0)&&r.length?(s=g.colHeaderPaths[g.colHeaderPaths.length-1].indicatorKey)!==null&&s!==void 0?s:g.colHeaderPaths[g.colHeaderPaths.length-1].dimensionKey:(l=g.rowHeaderPaths[g.rowHeaderPaths.length-1].indicatorKey)!==null&&l!==void 0?l:g.rowHeaderPaths[g.rowHeaderPaths.length-1].dimensionKey,i,o);else{const f=(a=g.colHeaderPaths)===null||a===void 0?void 0:a.filter(v=>!v.virtual).map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value}),p=(h=g.rowHeaderPaths)===null||h===void 0?void 0:h.filter(v=>!v.virtual).map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value});this.dataset.changeTreeNodeValue(this.internalProps.layoutMap.indicatorsAsCol?p:p.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?f.slice(0,-1):f,this.internalProps.layoutMap.getIndicatorKey(t,e),o)}}else if(this.flatDataToObjects){const g=this.internalProps.layoutMap.getCellHeaderPaths(t,e);if(this.isHeader(t,e))this.internalProps.layoutMap.changeTreeNodeTitle(t,e,o),!this.isCornerHeader(t,e)&&this.flatDataToObjects.changeRecordFieldValue(!((d=g.colHeaderPaths)===null||d===void 0)&&d.length?(u=g.colHeaderPaths[g.colHeaderPaths.length-1].indicatorKey)!==null&&u!==void 0?u:g.colHeaderPaths[g.colHeaderPaths.length-1].dimensionKey:(c=g.rowHeaderPaths[g.rowHeaderPaths.length-1].indicatorKey)!==null&&c!==void 0?c:g.rowHeaderPaths[g.rowHeaderPaths.length-1].dimensionKey,i,o);else{const f=g.colHeaderPaths.map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value}),p=g.rowHeaderPaths.map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value});this.flatDataToObjects.changeTreeNodeValue(p,f,this.internalProps.layoutMap.getBody(t,e).indicatorKey,o)}}}_hasCustomRenderOrLayout(){if(this.options.customRender)return!0;const{columnsDefine:t,rowsDefine:e,indicatorsDefine:i}=this.internalProps.layoutMap;for(let o=0;o<t.length;o++){const r=t[o];if(typeof r!="string"&&(r.headerCustomLayout||r.headerCustomRender))return!0}for(let o=0;o<e.length;o++){const r=e[o];if(typeof r!="string"&&(r.headerCustomLayout||r.headerCustomRender))return!0}for(let o=0;o<i.length;o++){const r=i[o];if(typeof r!="string"&&(r.customLayout||r.headerCustomLayout||r.customRender||r.headerCustomRender))return!0}return!1}changeRecordOrder(t,e){}setTreeNodeChildren(t,e,i,o){this.flatDataToObjects?(this.internalProps.layoutMap.getHeadNode(i,o).children=t,this._refreshHierarchyState(i,o,!0,()=>{this.flatDataToObjects.changeDataConfig({rows:this.internalProps.layoutMap.fullRowDimensionKeys,columns:this.internalProps.layoutMap.colDimensionKeys,indicators:this.internalProps.layoutMap.indicatorKeys,indicatorsAsCol:this.internalProps.layoutMap.indicatorsAsCol,indicatorDimensionKey:this.internalProps.layoutMap.indicatorDimensionKey}),this.flatDataToObjects.addRecords(e)})):(this.internalProps.layoutMap.getHeadNode(i,o).children=t,this._refreshHierarchyState(i,o,!0,()=>{this.dataset._rowTreeHasChanged(),this.dataset.changeDataConfig({rows:this.internalProps.layoutMap.fullRowDimensionKeys,columns:this.internalProps.layoutMap.colDimensionKeys}),this.dataset.addRecords(e)}))}updateFilterRules(t){this.internalProps.dataConfig.filterRules=t,this.dataset.updateFilterRules(t),this.renderWithRecreateCells()}getFilteredRecords(){var t;return(t=this.dataset)===null||t===void 0?void 0:t.filterRules}};Y3(),X3(),q3(),Z3(),J3(),Q3(),pz(),vz(),mz(),bz(),Cz(),_z(),yz(),wz();class Tz extends Rz{}const Mz=ft.defineComponent({name:"PivotTable",components:{},props:{id:String,name:String,keyName:String,type:String,width:String,height:String,position:String,top:String,left:String,zIndex:Number,events:{type:Array,default:()=>[]},dataType:String,graphicConfig:Object,data:{type:Array,default:()=>[]},scale:Number,dimensionList:{type:Array,default:()=>[]},indicatorList:{type:Array,default:()=>[]},pageMode:String},setup(n,{expose:t}){const e=ft.ref(),i=ft.ref(""),o=ft.ref({}),r=ft.ref(),s=ft.ref({}),l=ft.ref({}),a=ft.ref(),h=ft.ref(),d=ft.ref({}),u=ft.ref(),c=ft.ref(),g=ft.ref(),f=ft.ref(),p=ft.ref(),v=ft.ref(),m={sqz:"上期值",tqz:"同期值",zje:"增减额",hb:"环比(%)",tb:"同比(%)",zb:"占比(%)"},b=[{text:"度量属性",menuKey:"property"},{text:"条件属性",menuKey:"conditionalProperty"},{text:"图形",menuKey:"graph"},{text:"筛选",menuKey:"filter"},{text:"排序",children:[{text:"升序",menuKey:"asc"},{text:"降序",menuKey:"desc"},{text:"默认",menuKey:"default-sort"}],menuKey:"sort"},{text:"删除",menuKey:"delete"}],w={SUM:"合计",AVG:"平均值",COUNT:"计数",MAX:"Max",MIN:"最小值",VAR:"方差",STDEV:"标准差"},C=ft.reactive({records:[],columnHeaderTitle:!0,excelOptions:{fillHandle:!0},rows:[],columns:[],indicators:[],corner:{titleOnDimension:"row",headerStyle:{textStick:!0}},dataConfig:{sortRules:[],filterRules:[]},widthMode:"standard",menu:{renderMode:"html",dropDownMenuHighlight:[]}}),_=ft.ref([]);function y(W,O=!0,Y=-1){if(Y>-1)C.indicators.splice(Y,0,...W);else for(const $ of W)C.indicators.push($);O&&ft.unref(e).updateOption(C)}function x(W="",O=[]){const Y=[],$=Object.keys(m),Q=$.map(et=>`${W}-${et}`);return O.forEach(et=>{let ot=et;typeof et=="object"&&(ot=et.indicatorKey);const K=Q.indexOf(ot);K>-1&&$.splice(K,1)}),$.forEach(et=>{Y.push({text:m[et],menuKey:et})}),[{text:"计算",menuKey:"calculate",children:Y},...b]}function S(){const W=C.rows.map(Y=>Y.dimensionKey),O=C.columns.map(Y=>Y.dimensionKey);return W.concat(O)}function A(){const W=[{text:"升序",menuKey:"asc"},{text:"降序",menuKey:"desc"},{text:"行列互换",menuKey:"trans"},{text:"筛选",menuKey:"filter"},{text:"聚合",menuKey:"aggregate"},{text:"取top",menuKey:"top"},{text:"钻取",menuKey:"drill"},{text:"删除",menuKey:"delete"}],O=[],Y=S(),$=ft.unref(_).filter(Q=>!Y.includes(Q));if($!=null&&$.length)for(const Q of $)O.push({text:Q,menuKey:Q});return W[6].children=O,W}function R(W){var Y,$;if(!W){(Y=C.aggregate)!=null&&Y.type&&(C.records.splice(-C.aggregate.len),C.aggregate={});return}const O=ft.unref(e).getAllBodyCells();if(O.length>0&&O[0][0]){let Q=O.length;($=C.aggregate)!=null&&$.type&&C.aggregate.len&&(Q=O.length-1,C.records.splice(-C.aggregate.len));const et=O[0].length;console.log(O[0][0]);const{rowHeaderPaths:ot}=O[0][0].cellHeaderPaths,K={};ot.forEach(tt=>{K[tt.dimensionKey]=w[W]});const at=[];for(let tt=0;tt<et;tt++){const{colHeaderPaths:_t}=O[0][tt].cellHeaderPaths,yt=O[0][tt].field,ut={};_t.forEach(Re=>{Re.dimensionKey&&(ut[Re.dimensionKey]=Re.value)});let xt=0;const de=[];if(W!=="COUNT"){let Re=0;for(let Ge=0;Ge<Q;Ge++){const Qe=O[Ge][tt].dataValue;Re+=Qe,de.push(Qe)}if(W==="SUM")xt=Re;else if(W==="AVG")xt=Re/Q;else if(W==="MAX")xt=Math.max(...de);else if(W==="MIN")xt=Math.min(...de);else if(W==="VAR"||W==="STDEV"){const Ge=Re/Q;de.forEach(Qe=>{xt+=Math.pow(Qe-Ge,2)}),xt=xt/(Q-1),W==="STDEV"&&(xt=Math.sqrt(xt))}}else xt=Q;at.push({...K,...ut,[yt]:xt})}C.aggregate={type:W,len:at.length,rowPathObj:K},C.records=[...C.records,...at]}ft.unref(e).updateOption(C)}function T(W,O=!0){var Y,$,Q,et;for(const ot of W){const{key:K,name:at,type:tt}=ot,_t=n.dimensionList.find(yt=>yt.key===K);if(C[tt].push({dimensionKey:K,title:at,width:_t!=null&&_t.width?`${_t.width}%`:"auto"}),(Y=C[tt])!=null&&Y.length)for(const yt of C[tt])yt.cornerDropDownMenu=A();C.dataConfig.sortRules.push({sortField:K,sortType:ft.unref(i)})}O&&(ft.unref(e).updateOption(C),($=C.aggregate)!=null&&$.type&&((Q=C.aggregate)==null?void 0:Q.type)!=="SUM"&&R((et=C.aggregate)==null?void 0:et.type)),ft.nextTick(()=>{P()})}function M(W){const O={},Y=C.records;for(const $ of Y)for(const Q of W)yf(O,Q)?O[Q].find(et=>et.value===$[Q])||O[Q].push({value:$[Q]}):O[Q]=[{value:$[Q]}];return O}function P(){console.log("unref(tableInstance)",ft.unref(e));const{dataset:{columns:W,rows:O}}=ft.unref(e),Y=O.concat(W);o.value=M(Y)}const k=W=>{const{data:{rows:O}}=(W==null?void 0:W.data)||{};console.log("rows",O),C.records=O;const{queryColumnList:Y=[],indicators:$=[]}=n.graphicConfig||{},Q=x(),et=[],ot=[];for(const K of Y){if(!K.show)continue;const at=n.dimensionList.find(tt=>tt.key===K.label);_.value.push(K.label),ot.push({key:K.label,name:K.label,type:(at==null?void 0:at.position)||"rows"})}for(const K of $){if(!K.show)continue;const at=n.indicatorList.find(tt=>tt.key===K.label);et.push({indicatorKey:K.label,title:K.label,width:at!=null&&at.width?`${at.width}%`:"auto",showSort:!1,headerStyle:{fontWeight:"normal"},style:{padding:[16,28,16,28],bgColor(tt){var yt,ut;const _t=tt.cellHeaderPaths.rowHeaderPaths;if(((yt=_t==null?void 0:_t[1])==null?void 0:yt.value)==="Sub Totals")return"#ba54ba";if(((ut=_t==null?void 0:_t[0])==null?void 0:ut.value)==="Row Totals")return"#ff9900"}},dropDownMenu:Q})}if(C.indicators=[],C.rows=[],C.columns=[],y(et,!1),T(ot,!1),ft.unref(e))ft.unref(e).updateOption(C);else{const K=document.getElementById(`pivotTableContainer_${n.id}`);e.value=new Tz(K,C),ht()}};function B(W){const{aggregate:O}=C;if(O!=null&&O.type&&(O!=null&&O.len)){const Y=O.rowPathObj||{};for(const $ in Y)if(W[$]===Y[$])return!0}}function H(){if(ft.unref(e)){const{dataset:{rows:W}}=ft.unref(e),O={};for(const Y of W)O[Y]="";ft.unref(e).updateOption({...C,dataConfig:{...C.dataConfig,filterRules:[]},records:[O]})}}function E(){var $;const{type:W,len:O}=C.aggregate||{};W&&(C.records.splice(-O),C.aggregate={type:W,len:0});const Y=[];if(Object.keys(s.value))for(const Q in s.value)Y.push({filterFunc:et=>{const ot=B(et);return ot||ft.unref(s)[Q].includes(et[Q])}});C.dataConfig.filterRules=Y,ft.unref(e).updateOption(C),($=C.aggregate)!=null&&$.type&&R(C.aggregate.type),ft.nextTick(()=>{const{dataset:{rowHeaderTree:Q}}=ft.unref(e);Q!=null&&Q.length||H()})}function F(W,O){var Q,et,ot;const Y=C[O].findIndex(K=>K.dimensionKey===W),$=C.dataConfig.sortRules.findIndex(K=>K.sortField===W);if(Y!==-1){C[O].splice(Y,1);for(const K of C[O])K.cornerDropDownMenu=A()}$!==-1&&(C.dataConfig.sortRules[$].sortType=i),ft.unref(e).updateOption(C),(Q=C.aggregate)!=null&&Q.type&&((et=C.aggregate)==null?void 0:et.type)!=="SUM"&&R((ot=C.aggregate)==null?void 0:ot.type),ft.nextTick(()=>{P(),delete s.value[W],E()})}function L(W){const{indicators:O}=C,Y=O.findIndex($=>$.indicatorKey===W);if(Y!==-1){const $=O[Y];if(O.splice(Y,1),$.calculateType){const Q=$.indicatorKey.split("-"+$.calculateType)[0],et=O.findIndex(ot=>ot.indicatorKey===Q);O[et].dropDownMenu=x(Q,O)}}ft.unref(e).updateOption(C)}function z(W,O,Y,$){var _t;let{dataConfig:{sortRules:Q},menu:{dropDownMenuHighlight:et}}=C;const ot=ft.unref(e).getAllCells();$=$+1;let K=[];const at=(_t=C.aggregate)!=null&&_t.type?ot.length-1:ot.length;for(let yt=$;yt<at;yt++){const{cellLocation:ut,dataValue:xt}=ot[yt][Y];ut==="rowHeader"&&K.push(xt)}W==="asc"?K=K.sort((yt,ut)=>yt.localeCompare(ut)):W==="desc"&&(K=K.sort((yt,ut)=>ut.localeCompare(yt)));const tt={sortField:O,sortBy:K};Q=Q.filter(yt=>yt.sortField!==O),Q.push(tt),C.dataConfig.sortRules=Q,et=et.filter(yt=>!(yt.type==="dimension"&&yt.field===O)||yt.type==="indicator"),et.push({col:Y,row:$-1,field:O,type:"dimension",menuKey:W}),C.menu.dropDownMenuHighlight=et,ft.unref(e).updateOption(C)}function D(W,O,Y,$,Q){var xt;const{dataConfig:et,menu:ot}=C;let K=et.sortRules,at=ot.dropDownMenuHighlight;const tt=Y.filter((de,Re)=>Re<Y.length-1).map(de=>de.value);let _t="";(xt=C.rows)!=null&&xt.length&&(_t=C.rows[C.rows.length-1].dimensionKey);const yt=K.findIndex(de=>de.sortField===_t);yt!==-1&&K.splice(yt,1);const ut=at.findIndex(de=>de.field===_t&&de.type==="dimension");ut!==-1&&at.splice(ut,1),K=K.filter(de=>!yf(de,"sortByIndicator")),at=at.filter(de=>de.type==="dimension"),(W==="asc"||W==="desc")&&K.push({sortField:_t,sortByIndicator:O,sortType:W.toUpperCase(),query:tt}),at.push({col:$,row:Q,field:O,type:"indicator",menuKey:W}),C.dataConfig.sortRules=K,C.menu.dropDownMenuHighlight=at,ft.unref(e).updateOption(C)}function N(W,O,Y){const $=ft.unref(e).getCellValue(O,Y),Q={};ft.unref(s)[W]&&(Q.filterData=ft.unref(s)[W]),a.value={tableInstance:e,fieldName:$,key:W,valueList:ft.unref(o)[W]||[],type:"dimension",...Q},ft.nextTick(()=>{h.value.show()})}function V(W,O){a.value={tableInstance:e,fieldName:O,key:W,type:"indicators",filterData:ft.unref(l)[W]},ft.nextTick(()=>{h.value.show()})}function G({indicatorKey:W,menuKey:O}){const Y=C.indicators.map(et=>et.indicatorKey);let $=C.indicators.length-1;const Q=`${W}-${O}`;C.indicators.forEach((et,ot)=>{et.indicatorKey===W&&($=ot+1,et.dropDownMenu=x(W,[...Y,Q]))}),y([{indicatorKey:Q,title:m[O],calculateType:O,width:"auto",showSort:!1,headerStyle:{fontWeight:"normal"},style:{padding:[16,28,16,28],bgColor(et){var K,at;const ot=et.cellHeaderPaths.rowHeaderPaths;if(((K=ot==null?void 0:ot[1])==null?void 0:K.value)==="Sub Totals")return"#ba54ba";if(((at=ot==null?void 0:ot[0])==null?void 0:at.value)==="Row Totals")return"#ff9900"}},dropDownMenu:[{text:"删除",menuKey:"delete"}]}],!0,$)}function U(){var ot;const W=C.rows[0]?C.rows[0].cornerDropDownMenu:[],O=C.columns[0]?C.columns[0].cornerDropDownMenu:[],Y=C.rows.map(K=>({...K,cornerDropDownMenu:O})),$=C.columns.map(K=>({...K,cornerDropDownMenu:W}));C.columns=Y,C.rows=$;const{type:Q,len:et}=C.aggregate||{};Q&&(C.records.splice(-et),C.aggregate={type:Q,len:0}),C.menu.dropDownMenuHighlight=[],s.value={},l.value={},d.value={},C.dataConfig.filterRules=[],ft.unref(e).updateOption(C),z("",$[0].dimensionKey,0,0),(ot=C.aggregate)!=null&&ot.type&&R(C.aggregate.type)}function Z({indicatorKey:W,fieldName:O}){const Y=j(W);if(Y>-1){const $=C.indicators[Y].formatConfig||{};ft.unref(u).showModal({...$,indicatorKey:W,fieldName:O})}}function q(W){const O=j(W);if(O>-1){const Y=C.indicators[O].conditionalConfig||[];ft.unref(c).showModal(W,Y)}}function j(W){return C.indicators.findIndex(O=>O.indicatorKey===W)}function rt(W){const O=ft.unref(_)[0],Y=M(ft.unref(_)),$={xLabel:O,yLabel:W,dimensionData:Y,records:C.records};console.log($),ft.unref(p).showModal($)}function ht(){e.value.on("dropdown_menu_click",W=>{var at;const{menuKey:O,field:Y,col:$,row:Q}=W,{dimensionKey:et,indicatorKey:ot,value:K}=Y[Y.length-1];switch(r.value=W,ft.unref(_).includes(O)&&T([{key:O,name:O,type:"rows"}]),O){case"drill":alert("无维度可钻取");break;case"delete":et?F(et,"rows"):ot&&L(ot);break;case"asc":case"desc":case"default-sort":et?z(O,et,$,Q):ot&&D(O,ot,Y,$,Q);break;case"filter":et?N(et,$,Q):ot&&V(ot,K);break;case"sqz":case"tqz":case"zje":case"hb":case"tb":case"zb":G({indicatorKey:ot,menuKey:O});break;case"trans":U();break;case"property":Z({indicatorKey:ot,fieldName:K});break;case"conditionalProperty":q(ot);break;case"aggregate":ft.unref(g).showModal((at=C.aggregate)==null?void 0:at.type,$,Q);break;case"top":ft.unref(f).showModal(C.topNum);break;case"graph":rt(ot);break}setTimeout(()=>{console.log("option",C)},500)})}const gt=W=>{k(W)},vt=()=>{};return t({refreshData:gt,click:vt}),ft.onMounted(()=>{}),{pivotTableRef:v,click:vt}}}),lD="",Bz=(n,t)=>{const e=n.__vccOpts||n;for(const[i,o]of t)e[i]=o;return e},Pz={key:0,class:"design-template"},Hz=["id"];function Ez(n,t,e,i,o,r){return n.pageMode==="design"?(ft.openBlock(),ft.createElementBlock("div",Pz," 透视表格 ")):(ft.openBlock(),ft.createElementBlock("div",{key:1,class:"table-instance",id:n.pageMode!=="design"?`pivotTableContainer_${n.id}`:"",ref:"pivotTableRef"},null,8,Hz))}const d1=f1(Bz(Mz,[["render",Ez],["__scopeId","data-v-d23b8c93"]])),u1=Object.freeze(Object.defineProperty({__proto__:null,EcanPivotTable:d1},Symbol.toStringTag,{value:"Module"})),Lz={install:(n,t)=>{const{request:e}=t;n.provide("$request",e),Object.keys(u1).forEach(i=>{const o=u1[i];o.install&&n.use(o)})}};$n.EcanPivotTable=d1,$n.default=Lz,Object.defineProperties($n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
306
|
+
${h}`:h,referencePosition:{placement:Ri.bottom,rect:d},disappearDelay:(r=l.internalProps.tooltip.overflowTextTooltipDisappearDelay)!==null&&r!==void 0?r:0,style:l.theme.tooltipStyle})}s?this._bindToCell(t,e,s):this._unbindFromCell()}_getTooltipInstanceInfo(t,e){const i=this._table,o=this._tooltipInstances;return o&&o["bubble-tooltip"]||o&&(o["bubble-tooltip"]=K3["bubble-tooltip"](i))}isBinded(t){var e;return JSON.stringify(t)===JSON.stringify((e=this._attachInfo)===null||e===void 0?void 0:e.tooltipOptions)}}const Y3=()=>{St.registerComponent("axis",b3),St.registerFunction("computeAxisComponentWidth",y3),St.registerFunction("computeAxisComponentHeight",w3),St.registerFunction("getAxisConfigInPivotChart",PI)},X3=()=>{St.registerComponent("emptyTip",x3)},q3=()=>{St.registerFunction("createLegend",F3)},Z3=()=>{St.registerComponent("menuHandler",W3)},J3=()=>{St.registerComponent("title",N3)},Q3=()=>{St.registerComponent("tooltipHandler",$3)},tz={};function ez(){return qs(tz,VI)}function iz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b){var w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q;const j=ez()[d],rt=f._getCellStyle(o,r),ht=Kh("padding",rt,o,r,f);if(I(ht)&&(a=ht),!n){const gt=$o(o,r,p,f);m&&(n=f.scenegraph.highPerformanceGetCell(o,r,!0))&&n.role==="cell"&&n.setAttributes({x:e,y:i,width:s,height:l,lineWidth:(C=(w=p==null?void 0:p.group)===null||w===void 0?void 0:w.lineWidth)!==null&&C!==void 0?C:void 0,fill:(y=(_=p==null?void 0:p.group)===null||_===void 0?void 0:_.fill)!==null&&y!==void 0?y:void 0,stroke:(S=(x=p==null?void 0:p.group)===null||x===void 0?void 0:x.stroke)!==null&&S!==void 0?S:void 0,strokeArrayWidth:gt,strokeArrayColor:(R=(A=p==null?void 0:p.group)===null||A===void 0?void 0:A.strokeArrayColor)!==null&&R!==void 0?R:void 0,cursor:(M=(T=p==null?void 0:p.group)===null||T===void 0?void 0:T.cursor)!==null&&M!==void 0?M:void 0,lineDash:(k=(P=p==null?void 0:p.group)===null||P===void 0?void 0:P.lineDash)!==null&&k!==void 0?k:void 0,lineCap:"butt",clip:!0,cornerRadius:p.group.cornerRadius}),n&&n.role==="cell"||((n=new Kt({x:e,y:i,width:s,height:l,lineWidth:(H=(B=p==null?void 0:p.group)===null||B===void 0?void 0:B.lineWidth)!==null&&H!==void 0?H:void 0,fill:(F=(E=p==null?void 0:p.group)===null||E===void 0?void 0:E.fill)!==null&&F!==void 0?F:void 0,stroke:(z=(L=p==null?void 0:p.group)===null||L===void 0?void 0:L.stroke)!==null&&z!==void 0?z:void 0,strokeArrayWidth:gt,strokeArrayColor:(N=(D=p==null?void 0:p.group)===null||D===void 0?void 0:D.strokeArrayColor)!==null&&N!==void 0?N:void 0,cursor:(G=(V=p==null?void 0:p.group)===null||V===void 0?void 0:V.cursor)!==null&&G!==void 0?G:void 0,lineDash:(Z=(U=p==null?void 0:p.group)===null||U===void 0?void 0:U.lineDash)!==null&&Z!==void 0?Z:void 0,lineCap:"butt",clip:!0,cornerRadius:p.group.cornerRadius})).role="cell",n.col=o,n.row=r,t==null||t.addCellGroup(n))}if(n.AABBBounds.width(),b&&Array.isArray(f.getCellValue(o,r))||!b){const gt=new Vr(v,{stroke:!1,x:a[3],y:a[0],canvas:(q=f.canvas)!==null&&q!==void 0?q:f.scenegraph.stage.window.getContext().canvas,mode:f.options.mode,modeParams:f.options.modeParams,spec:u,ClassType:j,width:s-a[3]-a[1],height:l-a[2]-a[0],chartInstance:c,dataId:g,data:f.getCellValue(o,r)||[],cellPadding:a,dpr:f.internalProps.pixelRatio,axes:f.isPivotChart()?f.internalProps.layoutMap.getChartAxes(o,r):[],tableChartOption:f.options.chartOption});n.appendChild(gt),f.internalProps.layoutMap.setChartInstance(o,r,gt.chartInstance)}return n}function nz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m){var b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U;if(!n){const ht=$o(o,r,f,g);m&&(n=g.scenegraph.highPerformanceGetCell(o,r,!0))&&n.role==="cell"&&n.setAttributes({x:e,y:i,width:l,height:a,lineWidth:(w=(b=f==null?void 0:f.group)===null||b===void 0?void 0:b.lineWidth)!==null&&w!==void 0?w:void 0,fill:(_=(C=f==null?void 0:f.group)===null||C===void 0?void 0:C.fill)!==null&&_!==void 0?_:void 0,stroke:(x=(y=f==null?void 0:f.group)===null||y===void 0?void 0:y.stroke)!==null&&x!==void 0?x:void 0,strokeArrayWidth:ht,strokeArrayColor:(A=(S=f==null?void 0:f.group)===null||S===void 0?void 0:S.strokeArrayColor)!==null&&A!==void 0?A:void 0,cursor:(T=(R=f==null?void 0:f.group)===null||R===void 0?void 0:R.cursor)!==null&&T!==void 0?T:void 0,lineDash:(P=(M=f==null?void 0:f.group)===null||M===void 0?void 0:M.lineDash)!==null&&P!==void 0?P:void 0,lineCap:"butt",clip:!0,cornerRadius:f.group.cornerRadius}),n&&n.role==="cell"||((n=new Kt({x:e,y:i,width:l,height:a,lineWidth:(B=(k=f==null?void 0:f.group)===null||k===void 0?void 0:k.lineWidth)!==null&&B!==void 0?B:void 0,fill:(E=(H=f==null?void 0:f.group)===null||H===void 0?void 0:H.fill)!==null&&E!==void 0?E:void 0,stroke:(L=(F=f==null?void 0:f.group)===null||F===void 0?void 0:F.stroke)!==null&&L!==void 0?L:void 0,strokeArrayWidth:ht,strokeArrayColor:(D=(z=f==null?void 0:f.group)===null||z===void 0?void 0:z.strokeArrayColor)!==null&&D!==void 0?D:void 0,cursor:(V=(N=f==null?void 0:f.group)===null||N===void 0?void 0:N.cursor)!==null&&V!==void 0?V:void 0,lineDash:(U=(G=f==null?void 0:f.group)===null||G===void 0?void 0:G.lineDash)!==null&&U!==void 0?U:void 0,lineCap:"butt",clip:!0,cornerRadius:f.group.cornerRadius})).role="cell",n.col=o,n.row=r,t==null||t.addCellGroup(n))}let Z;if(c){let ht=o,gt=r;v&&(ht=v.start.col,gt=v.start.row),Z=g.getCellIcons(ht,gt)}let q=0,j=0;if(Array.isArray(Z)&&Z.length!==0){const{leftIconWidth:ht,rightIconWidth:gt,absoluteLeftIconWidth:vt,absoluteRightIconWidth:W}=qh(Z,n,v,g);q=ht+gt,j=ht,n.forEachChildren(O=>{O.role==="icon-left"?O.setAttribute("x",O.attribute.x+h[3]):O.role==="icon-right"?O.setAttribute("x",O.attribute.x+l-gt-h[1]):O.role==="icon-absolute-right"&&O.setAttribute("x",O.attribute.x+l-W-h[1])}),n.forEachChildren(O=>{u==="middle"?O.setAttribute("y",(a-O.AABBBounds.height())/2):u==="bottom"?O.setAttribute("y",a-O.AABBBounds.height()-h[2]):O.setAttribute("y",h[0])})}const rt=oz(o,r,s-q,l,a,h,f,p,g);return rt&&n.appendChild(rt),rt.render(),l-=h[1]+h[3]+q,a-=h[0]+h[2],d==="center"?rt.setAttribute("x",h[3]+j+(l-rt.AABBBounds.width())/2):d==="right"?rt.setAttribute("x",h[3]+j+l-rt.AABBBounds.width()):rt.setAttribute("x",h[3]+j),u==="middle"?rt.setAttribute("y",h[0]+(a-rt.AABBBounds.height())/2):u==="bottom"?rt.setAttribute("y",h[0]+a-rt.AABBBounds.height()):rt.setAttribute("y",h[0]),n}function oz(n,t,e,i,o,r,s,l,a){var h,d,u,c;const g=a._getCellStyle(n,t),f=lt("size",g,n,t,a),p=lt("spaceBetweenTextAndIcon",g,n,t,a),v=lt("defaultFill",g,n,t,a),m=lt("defaultStroke",g,n,t,a),b=lt("disableFill",g,n,t,a),w=lt("checkedFill",g,n,t,a),C=lt("checkedStroke",g,n,t,a),_=lt("disableCheckedFill",g,n,t,a),y=lt("disableCheckedStroke",g,n,t,a),x=lt("checkIconImage",g,n,t,a),S=lt("indeterminateIconImage",g,n,t,a),A=a.getCellValue(n,t),R=a.getCellOriginValue(n,t);let T,M,P=(h=A)!==null&&h!==void 0?h:"";$t(A)?(T=A.checked,M=A.disable,P=(d=A.text)!==null&&d!==void 0?d:""):typeof A=="boolean"&&(T=A,P=""),T=a.stateManager.syncCheckedState(n,t,l.field,T);const k=hn(n,t,a),B=a._getCellStyle(n,t),H=(u=B.autoWrapText)!==null&&u!==void 0?u:a.internalProps.autoWrapText,{lineClamp:E}=B,{checked:F,disable:L}=l;if(T==null||typeof T=="function"){const Z=xe(F,{col:n,row:t,table:a,context:null,value:A,dataValue:R});T=a.stateManager.syncCheckedState(n,t,l.field,Z)}const z=xe(L,{col:n,row:t,table:a,context:null,value:A,dataValue:R}),D=e==="auto",N=a.isAutoRowHeight(t),V={text:P.length===1?P[0]:P,maxLineWidth:D?1/0:i-(r[1]+r[3]+k)-f-p,textBaseline:"top",autoWrapText:H,lineClamp:E,wordBreak:"break-word",heightLimit:N?-1:o-Math.floor(r[0]+r[2]),pickable:!1,dx:k,whiteSpace:P.length!==1||H?"normal":"no-wrap"},G={x:0,y:0,text:s.text?Object.assign({},s.text,V):V,icon:{width:Math.floor(f/1.4),height:Math.floor(f/1.4)},box:{width:f,height:f},spaceBetweenTextAndIcon:p,disabled:(c=M??z)!==null&&c!==void 0&&c};T==="indeterminate"?(G.checked=void 0,G.indeterminate=!0):(G.checked=T,G.indeterminate=void 0),v&&(G.box.fill=v),m&&(G.box.stroke=m),b&&(G.box.disableFill=b),w&&(G.box.checkedFill=w),C&&(G.box.checkedStroke=C),_&&(G.box.disableCheckedFill=_),y&&(G.box.disableCheckedStroke=y),x&&(G.icon.checkIconImage=x),S&&(G.icon.indeterminateIconImage=S);const U=new kr(G);return U.name="checkbox",U}function rz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f){var p,v,m,b,w,C,_,y,x,S,A,R;if(!n){const P=$o(o,r,g,c);(n=new Kt({x:e,y:i,width:l,height:a,lineWidth:(v=(p=g==null?void 0:g.group)===null||p===void 0?void 0:p.lineWidth)!==null&&v!==void 0?v:void 0,fill:(b=(m=g==null?void 0:g.group)===null||m===void 0?void 0:m.fill)!==null&&b!==void 0?b:void 0,stroke:(C=(w=g==null?void 0:g.group)===null||w===void 0?void 0:w.stroke)!==null&&C!==void 0?C:void 0,strokeArrayWidth:P,strokeArrayColor:(y=(_=g==null?void 0:g.group)===null||_===void 0?void 0:_.strokeArrayColor)!==null&&y!==void 0?y:void 0,cursor:(S=(x=g==null?void 0:g.group)===null||x===void 0?void 0:x.cursor)!==null&&S!==void 0?S:void 0,lineDash:(R=(A=g==null?void 0:g.group)===null||A===void 0?void 0:A.lineDash)!==null&&R!==void 0?R:void 0,lineCap:"butt",clip:!0,cornerRadius:g.group.cornerRadius})).role="cell",n.col=o,n.row=r,t==null||t.addCellGroup(n)}const{width:T,height:M}=sz(o,r,s,l,a,h,g,f,n,c);return l-=h[1]+h[3],a-=h[0]+h[2],n.forEachChildren(P=>{d==="center"?P.setAttribute("x",h[3]+P.attribute.x+(l-T)/2):d==="right"?P.setAttribute("x",h[3]+P.attribute.x+l-T):P.setAttribute("x",h[3]+P.attribute.x),u==="middle"?P.setAttribute("y",h[0]+P.attribute.y+(a-M)/2):u==="bottom"?P.setAttribute("y",h[0]+P.attribute.y+a-M):P.setAttribute("y",h[0]+P.attribute.y)}),n}function sz(n,t,e,i,o,r,s,l,a,h){var d,u;const c=h._getCellStyle(n,t);let g=lt("size",c,n,t,h),f=lt("innerRadius",c,n,t,h),p=lt("outerRadius",c,n,t,h);const v=lt("spaceBetweenTextAndIcon",c,n,t,h),m=lt("spaceBetweenRadio",c,n,t,h),b=lt("defaultFill",c,n,t,h),w=lt("defaultStroke",c,n,t,h),C=lt("disableFill",c,n,t,h),_=lt("checkedFill",c,n,t,h),y=lt("checkedStroke",c,n,t,h),x=lt("disableCheckedFill",c,n,t,h),S=lt("disableCheckedStroke",c,n,t,h);nt(p)?g=2*p:p=Math.round(g/2),(!nt(f)||f<0)&&(f=Math.round(p/7*3));const A=h.getCellValue(n,t),R=h.getCellOriginValue(n,t),T=hn(n,t,h),M=h._getCellStyle(n,t),P=(d=M.autoWrapText)!==null&&d!==void 0?d:h.internalProps.autoWrapText,{lineClamp:k}=M,B=e==="auto",H=h.heightMode==="autoHeight",E={maxLineWidth:B?1/0:i-(r[1]+r[3]+T)-g-v,textBaseline:"top",autoWrapText:P,lineClamp:k,wordBreak:"break-word",heightLimit:H?-1:o-Math.floor(r[0]+r[2]),pickable:!1,dx:T},F={x:0,y:0,text:s.text?Object.assign({},s.text,E):E,circle:{innerRadius:f,outerRadius:p},spaceBetweenTextAndIcon:v};b&&(F.circle.fill=b),w&&(F.circle.stroke=w),C&&(F.circle.disableFill=C),_&&(F.circle.checkedFill=_),y&&(F.circle.checkedStroke=y),x&&(F.circle.disableCheckedFill=x),S&&(F.circle.disableCheckedStroke=S);let L=0,z=0;const D=(u=l.radioDirectionInCell)!==null&&u!==void 0?u:"vertical";if(it(A))A.forEach((N,V)=>{const G=n1(N,R,V,n,t,l,P,F,h);G&&a.appendChild(G),G.id=`radio-${n}-${t}-${V}`,G.render();const U=G.AABBBounds;D==="vertical"?(G.setAttribute("y",z),z+=U.height()+(V!==A.length-1?m:0),L=Math.max(L,U.width())):D==="horizontal"&&(G.setAttribute("x",L),L+=U.width()+(V!==A.length-1?m:0),z=Math.max(z,U.height()))});else{const N=n1(A,R,void 0,n,t,l,P,F,h);N&&a.appendChild(N),N.id=`radio-${n}-${t}`,N.render();const V=N.AABBBounds;L=V.width(),z=V.height()}return{width:L,height:z}}function n1(n,t,e,i,o,r,s,l,a){const h=lz(n,t,e,i,o,r,a),d=az(n,t,i,o,r,a),u=$t(n)?n.text:ze(n)?"":n??"",c=dt({},l,{checked:h,disabled:d,text:{text:u.length===1?u[0]:u,whiteSpace:u.length!==1||s?"normal":"no-wrap"},boundsPadding:0}),g=new Ir(c);return g.name="radio",g}function lz(n,t,e,i,o,r,s){var l,a;const h=(l=r.radioCheckType)!==null&&l!==void 0?l:"column";let d,u;return $t(n)?d=n.checked:typeof n=="boolean"&&(d=n),d=s.stateManager.syncRadioState(i,o,r.field,h,e,d),d!=null&&typeof d!="function"||(u=xe(r.checked,{col:i,row:o,table:s,context:null,value:n,dataValue:t}),d=s.stateManager.syncRadioState(i,o,r.field,h,e,u)),(a=d??u)!==null&&a!==void 0&&a}function az(n,t,e,i,o,r){var s;let l;$t(n)&&(l=n.disable);const a=xe(o.disable,{col:e,row:i,table:r,context:null,value:n,dataValue:t});return(s=l??a)!==null&&s!==void 0&&s}const mo=new rH,bo=new ko;function hz(n,t,e,i,o,r,s,l,a,h,d,u){var c,g,f,p,v,m,b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L;if(!n){const D=$o(o,r,d,h);u&&(n=h.scenegraph.highPerformanceGetCell(o,r,!0))&&n.role==="cell"&&n.setAttributes({x:e,y:i,width:s,height:l,lineWidth:(g=(c=d==null?void 0:d.group)===null||c===void 0?void 0:c.lineWidth)!==null&&g!==void 0?g:void 0,fill:(p=(f=d==null?void 0:d.group)===null||f===void 0?void 0:f.fill)!==null&&p!==void 0?p:void 0,stroke:(m=(v=d==null?void 0:d.group)===null||v===void 0?void 0:v.stroke)!==null&&m!==void 0?m:void 0,strokeArrayWidth:D,strokeArrayColor:(w=(b=d==null?void 0:d.group)===null||b===void 0?void 0:b.strokeArrayColor)!==null&&w!==void 0?w:void 0,cursor:(_=(C=d==null?void 0:d.group)===null||C===void 0?void 0:C.cursor)!==null&&_!==void 0?_:void 0,lineDash:(x=(y=d==null?void 0:d.group)===null||y===void 0?void 0:y.lineDash)!==null&&x!==void 0?x:void 0,lineCap:"butt",clip:!0,cornerRadius:d.group.cornerRadius}),n&&n.role==="cell"||((n=new Kt({x:e,y:i,width:s,height:l,lineWidth:(A=(S=d==null?void 0:d.group)===null||S===void 0?void 0:S.lineWidth)!==null&&A!==void 0?A:void 0,fill:(T=(R=d==null?void 0:d.group)===null||R===void 0?void 0:R.fill)!==null&&T!==void 0?T:void 0,stroke:(P=(M=d==null?void 0:d.group)===null||M===void 0?void 0:M.stroke)!==null&&P!==void 0?P:void 0,strokeArrayWidth:D,strokeArrayColor:(B=(k=d==null?void 0:d.group)===null||k===void 0?void 0:k.strokeArrayColor)!==null&&B!==void 0?B:void 0,cursor:(E=(H=d==null?void 0:d.group)===null||H===void 0?void 0:H.cursor)!==null&&E!==void 0?E:void 0,lineDash:(L=(F=d==null?void 0:d.group)===null||F===void 0?void 0:F.lineDash)!==null&&L!==void 0?L:void 0,lineCap:"butt",clip:!0,cornerRadius:d.group.cornerRadius})).role="cell",n.col=o,n.row=r,t==null||t.addCellGroup(n))}const z=dz(o,r,s,l,a,h);return z&&n.appendChild(z),n}function dz(n,t,e,i,o,r){let s,l;const a=r.internalProps.layoutMap.getBody(n,t).sparklineSpec,h=r.getCellValue(n,t);if(!Array.isArray(h))return;const d=o[3],u=o[0];e-=o[1]+o[3];const c=i-=o[0]+o[2];if(typeof a=="function"){const w={col:n,row:t,dataValue:r.getCellOriginValue(n,t)||"",value:r.getCellValue(n,t)||"",rect:r.getCellRangeRelativeRect(r.getCellRange(n,t)),table:r};s=a(w),l=o1(s,d,u,e,i)}else s=a,l=o1(a,d,u,e,i);const g=[],f=[];let p,v;if(typeof s.xField=="object")mo.domain(s.xField.domain),p=s.xField.field;else if(typeof s.xField=="string"){const w=h.map(C=>C[s.xField]);mo.domain(w),p=s.xField}else Array.isArray(h)&&(mo.domain(Array.from({length:h.length},(w,C)=>C)),p=s.xField);if(mo.range([0,e]),typeof s.yField=="object")bo.domain(s.yField.domain),v=s.yField.field;else if(typeof s.yField=="string"){const w=r1(h,s.yField);bo.domain([Math.min(...w),Math.max(...w)]),v=s.yField}else if(Array.isArray(h)){const w=r1(h);bo.domain([Math.min(...w),Math.max(...w)]),v=s.yField}if(bo.range([0,i]),typeof s.xField=="object"&&Array.isArray(s.xField.domain)){const w=h.map(_=>_[s.xField.field]),C=s.xField.domain;for(let _=0;_<C.length;_++){let y=!1;for(let x=0;x<w.length;x++)if(C[_]===w[x]){const S=h[x];if(!I(S[p])||!I(S[v]))break;g.push({x:0+mo.scale(S[p]),y:c-bo.scale(S[v]),defined:I(S[v])}),f.push(S),y=!0;break}y||(g.push({x:0+mo.scale(C[_]),y:0,defined:!1}),f.push({[p]:C[_],[v]:null}))}}else for(let w=0;w<h.length;w++){const C=h[w];g.push({x:0+mo.scale(p?C[p]:w),y:c-bo.scale(v?C[v]:C),defined:I(v?C[v]:C),rawData:C}),f.push(C)}const m=l.getChildByName("sparkline-line");m&&m.setAttribute("points",g),m.bandwidth=mo.step(),m.min=bo.range()[0],m.max=bo.range()[1];const b=l.getChildByName("sparkline-symbol-group");if(b){const w=s.pointShowRule==="isolatedPoint";if(s.pointShowRule==="all")for(let C=0;C<g.length;C++){const{x:_,y,defined:x}=g[C];if(x){const S=Ms({x:_,y});b.appendChild(S)}}else if(w)for(let C=0;C<g.length;C++){const{x:_,y,defined:x}=g[C];if(x&&(!g[C-1]||!g[C-1].defined)&&(!g[C+1]||!g[C+1].defined)){const S=Ms({x:_,y});b.appendChild(S)}}}return l}function o1(n,t,e,i,o){var r,s,l,a,h,d,u,c,g,f,p,v,m,b,w,C,_,y,x,S,A,R;let T;T=typeof n=="function"?n(null):n;const M=new Kt({x:t,y:e,width:i,height:o,stroke:!1,fill:!1});if(M.name="sparkline",T.type==="line"){const P=Si({x:0,y:0,curveType:T.smooth?"monotoneX":"linear",stroke:(l=(s=(r=T.line)===null||r===void 0?void 0:r.style)===null||s===void 0?void 0:s.stroke)!==null&&l!==void 0?l:"blue",lineWidth:(d=(h=(a=T.line)===null||a===void 0?void 0:a.style)===null||h===void 0?void 0:h.strokeWidth)!==null&&d!==void 0?d:2});P.name="sparkline-line",M.addChild(P),T.crosshair&&(P.hover=(c=(u=T.crosshair)===null||u===void 0?void 0:u.style)!==null&&c!==void 0?c:{stroke:"#000",interpolate:"linear"});const k=new Kt({x:0,y:0,width:i,height:o,stroke:!1,fill:!1});k.name="sparkline-symbol-group",k.setTheme({symbol:{stroke:(p=(f=(g=T.point)===null||g===void 0?void 0:g.style)===null||f===void 0?void 0:f.stroke)!==null&&p!==void 0?p:"#000",lineWidth:(b=(m=(v=T.point)===null||v===void 0?void 0:v.style)===null||m===void 0?void 0:m.strokeWidth)!==null&&b!==void 0?b:1,fill:(_=(C=(w=T.point)===null||w===void 0?void 0:w.style)===null||C===void 0?void 0:C.fill)!==null&&_!==void 0?_:"#000",size:2*((S=(x=(y=T.point)===null||y===void 0?void 0:y.style)===null||x===void 0?void 0:x.size)!==null&&S!==void 0?S:3),symbolType:"circle"}}),M.addChild(k),k.hover=(R=(A=T.point)===null||A===void 0?void 0:A.hover)!==null&&R!==void 0&&R}return M}function r1(n,t){const e=[];for(let i=0;i<n.length;i++){const o=n[i];I(t)&&I(o[t])?e.push(o[t]):!I(t)&&I(o)&&e.push(o)}return e}const cf=an();function uz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p,v){var m,b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht;const gt=g._getCellStyle(i,o),vt=Kh("padding",gt,i,o,g);!((m=g.options.customConfig)===null||m===void 0)&&m.imageMargin?h=kt((b=g.options.customConfig)===null||b===void 0?void 0:b.imageMargin):I(vt)&&(h=vt),!((w=f==null?void 0:f.text)===null||w===void 0)&&w.textAlign&&(d=(C=f==null?void 0:f.text)===null||C===void 0?void 0:C.textAlign),!((_=f==null?void 0:f.text)===null||_===void 0)&&_.textBaseline&&(u=(y=f==null?void 0:f.text)===null||y===void 0?void 0:y.textBaseline);const W=$o(i,o,f,g);let O,Y;if(v&&(O=g.scenegraph.highPerformanceGetCell(i,o,!0),O&&O.role==="cell"&&O.setAttributes({x:t,y:e,width:r,height:s,lineWidth:(S=(x=f==null?void 0:f.group)===null||x===void 0?void 0:x.lineWidth)!==null&&S!==void 0?S:void 0,fill:(R=(A=f==null?void 0:f.group)===null||A===void 0?void 0:A.fill)!==null&&R!==void 0?R:void 0,stroke:(M=(T=f==null?void 0:f.group)===null||T===void 0?void 0:T.stroke)!==null&&M!==void 0?M:void 0,strokeArrayWidth:W,strokeArrayColor:(k=(P=f==null?void 0:f.group)===null||P===void 0?void 0:P.strokeArrayColor)!==null&&k!==void 0?k:void 0,cursor:(H=(B=f==null?void 0:f.group)===null||B===void 0?void 0:B.cursor)!==null&&H!==void 0?H:void 0,lineDash:(F=(E=f==null?void 0:f.group)===null||E===void 0?void 0:E.lineDash)!==null&&F!==void 0?F:void 0,lineCap:"butt",clip:!0,cornerRadius:f.group.cornerRadius})),O&&O.role==="cell"||(O=new Kt({x:t,y:e,width:r,height:s,lineWidth:(z=(L=f==null?void 0:f.group)===null||L===void 0?void 0:L.lineWidth)!==null&&z!==void 0?z:void 0,fill:(N=(D=f==null?void 0:f.group)===null||D===void 0?void 0:D.fill)!==null&&N!==void 0?N:void 0,stroke:(G=(V=f==null?void 0:f.group)===null||V===void 0?void 0:V.stroke)!==null&&G!==void 0?G:void 0,strokeArrayWidth:W,strokeArrayColor:(Z=(U=f==null?void 0:f.group)===null||U===void 0?void 0:U.strokeArrayColor)!==null&&Z!==void 0?Z:void 0,cursor:(j=(q=f==null?void 0:f.group)===null||q===void 0?void 0:q.cursor)!==null&&j!==void 0?j:void 0,lineDash:(ht=(rt=f==null?void 0:f.group)===null||rt===void 0?void 0:rt.lineDash)!==null&&ht!==void 0?ht:void 0,lineCap:"butt",clip:!0,cornerRadius:f.group.cornerRadius}),O.role="cell",O.col=i,O.row=o,n==null||n.addCellGroup(O)),c){let at=i,tt=o;p&&(at=p.start.col,tt=p.start.row),Y=g.getCellIcons(at,tt)}let $=0,Q=0;if(Array.isArray(Y)&&Y.length!==0){const{leftIconWidth:at,rightIconWidth:tt,absoluteLeftIconWidth:_t,absoluteRightIconWidth:yt}=qh(Y,O,p,g);$=at,Q=tt,O.forEachChildren(ut=>{ut.role==="icon-left"?ut.setAttribute("x",ut.attribute.x+h[3]):ut.role==="icon-right"?ut.setAttribute("x",ut.attribute.x+r-tt-h[1]):ut.role==="icon-absolute-right"&&ut.setAttribute("x",ut.attribute.x+r-yt-h[1])}),O.forEachChildren(ut=>{u==="middle"?ut.setAttribute("y",(s-ut.AABBBounds.height())/2):u==="bottom"?ut.setAttribute("y",s-ut.AABBBounds.height()-h[2]):ut.setAttribute("y",h[0])}),O._cellLeftIconWidth=$,O._cellRightIconWidth=Q}const et=g.getCellValue(i,o),ot=document.createElement("video");ot.addEventListener("loadeddata",()=>{a&&t_(i,o,ot.videoWidth,ot.videoHeight,g.scenegraph,h,O);const{width:at,height:tt,isMerge:_t}=Or(O,g);if(l){const{width:Qe,height:$i}=Uh(ot.videoWidth,ot.videoHeight,at-h[1]-h[3],tt-h[0]-h[2]),si=Tg(0,0,at,tt,Qe,$i,d,u,h);K.setAttributes({width:Qe,height:$i,x:si.x,y:si.y,dx:0})}else K.setAttributes({x:h[3],y:h[0],width:at-h[1]-h[3],height:tt-h[2]-h[0],dy:0});_t&&Mg(O.mergeStartCol,O.mergeEndCol,O.mergeStartRow,O.mergeEndRow,g);const{width:yt,height:ut}=Or(O,g),xt=Math.floor(Math.min(yt-h[1]-h[3],ut-h[2]-h[0])/2),de=0+(yt>K.attribute.width?K.attribute.x-0+K.attribute.width/2:yt/2),Re=0+(ut>K.attribute.height?K.attribute.y-0+K.attribute.height/2:ut/2),Ge=new Wo({x:de-xt/2,y:Re-xt/2,width:xt,height:xt,image:cf.play.svg,cursor:cf.play.cursor});Ge.name="play-icon",O.appendChild(Ge),g.scenegraph.updateNextFrame()}),ot.onerror=()=>{K.image=cf.damage_pic.svg},ot.src=et,ot.setAttribute("preload","auto");const K=Pa({x:h[3],y:h[0],width:r-h[1]-h[3],height:s-h[2]-h[0],image:ot,cursor:"pointer"});return K.name="image",K.keepAspectRatio=l,K.textAlign=d,K.textBaseline=u,O.appendChild(K),O}function cz(n,t,e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b){var w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O;const Y=n._getCellStyle(r,s),$=Kh("padding",Y,r,s,n);I($)&&(d=$),!((w=v==null?void 0:v.text)===null||w===void 0)&&w.textAlign&&(u=(C=v==null?void 0:v.text)===null||C===void 0?void 0:C.textAlign),!((_=v==null?void 0:v.text)===null||_===void 0)&&_.textBaseline&&(c=(y=v==null?void 0:v.text)===null||y===void 0?void 0:y.textBaseline);const Q=n.isAutoRowHeight(s),et=l==="auto",ot=(x=Y.autoWrapText)!==null&&x!==void 0?x:n.internalProps.autoWrapText,K=Y.lineClamp,at=$o(r,s,v,n);let tt;if(b&&(tt=n.scenegraph.getCell(r,s,!0),tt&&tt.role==="cell"&&tt.setAttributes({x:i,y:o,width:a,height:h,lineWidth:(A=(S=v==null?void 0:v.group)===null||S===void 0?void 0:S.lineWidth)!==null&&A!==void 0?A:void 0,fill:(T=(R=v==null?void 0:v.group)===null||R===void 0?void 0:R.fill)!==null&&T!==void 0?T:void 0,stroke:(P=(M=v==null?void 0:v.group)===null||M===void 0?void 0:M.stroke)!==null&&P!==void 0?P:void 0,strokeArrayWidth:at??void 0,strokeArrayColor:(B=(k=v==null?void 0:v.group)===null||k===void 0?void 0:k.strokeArrayColor)!==null&&B!==void 0?B:void 0,cursor:(E=(H=v==null?void 0:v.group)===null||H===void 0?void 0:H.cursor)!==null&&E!==void 0?E:void 0,lineDash:(L=(F=v==null?void 0:v.group)===null||F===void 0?void 0:F.lineDash)!==null&&L!==void 0?L:void 0,lineCap:"butt",clip:!0,cornerRadius:v.group.cornerRadius})),tt&&tt.role==="cell"||(tt=new Kt({x:i,y:o,width:a,height:h,lineWidth:(D=(z=v==null?void 0:v.group)===null||z===void 0?void 0:z.lineWidth)!==null&&D!==void 0?D:void 0,fill:(V=(N=v==null?void 0:v.group)===null||N===void 0?void 0:N.fill)!==null&&V!==void 0?V:void 0,stroke:(U=(G=v==null?void 0:v.group)===null||G===void 0?void 0:G.stroke)!==null&&U!==void 0?U:void 0,strokeArrayWidth:at??void 0,strokeArrayColor:(q=(Z=v==null?void 0:v.group)===null||Z===void 0?void 0:Z.strokeArrayColor)!==null&&q!==void 0?q:void 0,cursor:(rt=(j=v==null?void 0:v.group)===null||j===void 0?void 0:j.cursor)!==null&&rt!==void 0?rt:void 0,lineDash:(gt=(ht=v==null?void 0:v.group)===null||ht===void 0?void 0:ht.lineDash)!==null&>!==void 0?gt:void 0,lineCap:"butt",clip:!0,cornerRadius:v.group.cornerRadius}),tt.role="cell",tt.col=r,tt.row=s,e==null||e.addCellGroup(tt)),f&&tt.appendChild(f),p){const _t=t;let yt;if(g){let ut=r,xt=s;m&&(ut=m.start.col,xt=m.start.row),yt=n.getCellIcons(ut,xt)}if(eL(tt,yt,_t,d,et,Q,ot,typeof K=="number"?K:void 0,tt.attribute.width,tt.attribute.height,u,c,n,v,m),(vt=v==null?void 0:v._vtable)===null||vt===void 0?void 0:vt.marked){const ut=ac({x:tt.attribute.width,y:0,startAngle:Math.PI/2,endAngle:Math.PI,outerRadius:6,fill:"#3073F2",pickable:!1});ut.name="mark",tt.appendChild(ut)}}return f&&tt.setAttributes({width:Math.max(tt.attribute.width,(W=f.attribute.width)!==null&&W!==void 0?W:0),height:Math.max(tt.attribute.height,(O=f.attribute.height)!==null&&O!==void 0?O:0)}),tt}function gz(n,t,e,i,o,r,s,l,a,h){var d,u,c,g,f,p;n.dependField&&(o=(u=(d=a.getCellOriginRecord(r,s))===null||d===void 0?void 0:d[n.dependField])!==null&&u!==void 0?u:o),n.barType=(c=n.barType)!==null&&c!==void 0?c:"default",n.min=(g=xe(n.min,{col:r,row:s,table:a,value:i,dataValue:o,cellHeaderPaths:void 0}))!==null&&g!==void 0?g:0,n.max=(f=xe(n.max,{col:r,row:s,table:a,value:i,dataValue:o,cellHeaderPaths:void 0}))!==null&&f!==void 0?f:n.min+100;let v=0;v=h?a.getRowsHeight(h.start.row,h.end.row):a.getRowHeight(s);let m=e,b=v,w=0;nt(a.theme._contentOffset)&&(w=a.theme._contentOffset);const C=new Kt({x:-w,y:-w,width:m,height:b});C.name="progress-bar";const{showBar:_,barColor:y,barBgColor:x,barPositiveColor:S,barNegativeColor:A,barAxisColor:R,barRightToLeft:T,showBarMark:M,barMarkPositiveColor:P,barMarkNegativeColor:k,barMarkWidth:B,barMarkPosition:H}=t;let{barHeight:E,barBottom:F,barPadding:L}=t;L.length===1?L=[L[0],L[0],L[0],L[0]]:L.length===2?L=[L[0],L[1],L[0],L[1]]:L.length===3&&(L=[L[0],L[1],L[2],L[1]]),L=L.map((j,rt)=>{if(typeof j=="string"&&Eh.endsWith(j,"%")){const ht=Number(j.substr(0,j.length-1));return rt===0||rt===2?v*ht/100:e*ht/100}return Number(j)});const z=kt(lt("borderLineWidth",t,r,s,a)),D=Math.max(L[0],Math.ceil(z[0]/2)),N=Math.max(L[1],Math.floor(z[1]/2)),V=Math.max(L[2],Math.floor(z[2]/2)),G=Math.max(L[3],Math.ceil(z[3]/2));m-=N+G,b-=V+D,s===a.rowCount-1&&[0,"0"].includes(F)&&(b-=1);const U=D,Z=G,q=m;if(typeof E=="string"&&Eh.endsWith(E,"%")?(E=Number(E.substr(0,E.length-1)),E=b*E/100):E=Number(E),typeof F=="string"&&Eh.endsWith(F,"%")?(F=Number(F.substr(0,F.length-1)),F=b*F/100):F=Number(F),xe(_,{col:r,row:s,table:a,context:null,value:i,dataValue:o})){let j=`${o}`;Eh.endsWith(j,"%")&&(j=j.substr(0,j.length-1));const rt=Number(j);if(isNaN(rt))return C;if(((p=n.barType)!==null&&p!==void 0?p:"default")==="default"){const ht=rt<n.min?0:rt>n.max?1:(rt-n.min)/(n.max-n.min),gt=m,vt=U+b-E-F;let W=Math.min(gt*ht,gt);const O=T?Z+q-W:Z;r!==a.colCount-1||ht!==1||T||(W-=1);const Y=xe(x,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:ht});if(Y){const et=ve({x:O,y:vt,width:gt,height:E,fill:Y});C.addChild(et)}const $=xe(y,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:ht})||"#20a8d8",Q=ve({x:O,y:vt,width:W,height:E,fill:$});C.addChild(Q)}else if(n.barType==="negative"){const ht=n.min<0?-n.min:0,gt=n.max>0?n.max:0,vt=ht/(ht+gt),W=1-vt,O=rt>0?rt/gt:0,Y=rt<0?-rt/ht:0,$=m,Q=U+b-E-F,et=Z,ot=xe(x,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:O});if(ot){const si=ve({x:et,y:Q,width:$,height:E,fill:ot});C.addChild(si)}const K=T?W*$:vt*$,at=Math.min($*vt*Y,$),tt=T?{left:et+K,top:Q,width:at,height:E}:{left:et+K-at,top:Q,width:at,height:E},_t=xe(A,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:Y})||"#20a8d8",yt=ve({x:tt.left,y:tt.top,width:tt.width,height:tt.height,fill:_t});C.addChild(yt);let ut=Math.min($*W*O,$);r!==a.colCount-1||O!==1||T||(ut-=1);const xt=T?{left:et+K-ut,top:Q,width:ut,height:E}:{left:et+K,top:Q,width:ut,height:E},de=xe(S,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:O})||"#20a8d8",Re=ve({x:xt.left,y:xt.top,width:xt.width,height:xt.height,fill:de});C.addChild(Re);const Ge=T?tt.left:xt.left,Qe=xe(R,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:O}),$i=Si({x:0,y:0,stroke:Qe,lineWidth:1,lineDash:[2,2],points:[{x:Ge,y:0},{x:Ge,y:v}]});if(C.addChild($i),M&&(O||Y)){const si=B,ti=[];let ue;if(O>0)if(ue=xe(P,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:O})||"#20a8d8",H==="right"){const mt=T?xt.left+B/2:xt.left+xt.width-B/2;ti.push({x:mt,y:xt.top}),ti.push({x:mt,y:xt.top+xt.height})}else H==="bottom"&&(ti.push({x:xt.left,y:xt.top+xt.height-B/2}),ti.push({x:xt.left+xt.width,y:xt.top+xt.height-B/2}));else if(Y>0)if(ue=xe(k,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:Y})||"#20a8d8",H==="right"){const mt=T?tt.left+tt.width-B/2:tt.left+B/2;ti.push({x:mt,y:tt.top}),ti.push({x:mt,y:tt.top+tt.height})}else H==="bottom"&&(ti.push({x:tt.left,y:tt.top+tt.height-B/2}),ti.push({x:tt.left+tt.width,y:tt.top+tt.height-B/2}));const pt=Si({x:0,y:0,stroke:ue,lineWidth:si,points:ti});C.addChild(pt)}}else if(n.barType==="negative_no_axis"){const ht=n.min<0?-n.min:0,gt=n.max>0?n.max:0,vt=Math.max(ht,gt),W=vt===0?0:Math.abs(rt)/vt,O=m;let Y=Math.min(O*W,O);r!==a.colCount-1||W!==1||T||(Y-=1);const $=U+b-E-F,Q=T?Z+q-Y:Z,et=xe(x,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:W});if(et){const tt=ve({x:Q,y:$,width:O,height:E,fill:et});C.addChild(tt)}const ot={left:Q,top:$,width:Y,height:E};let K;K=rt>=0?xe(S,{col:r,row:s,table:a,context:null,value:i,percentile:W,dataValue:o})||"#20a8d8":xe(A,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:W})||"#20a8d8";const at=ve({x:ot.left,y:ot.top,width:ot.width,height:ot.height,fill:K});if(C.addChild(at),M&&rt){const tt=B,_t=[];let yt;if(yt=rt>=0?xe(P,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:W})||"#20a8d8":xe(k,{col:r,row:s,table:a,context:null,value:i,dataValue:o,percentile:W})||"#20a8d8",H==="right"){const xt=T?ot.left+B/2:ot.left+ot.width-B/2;_t.push({x:xt,y:ot.top}),_t.push({x:xt,y:ot.top+ot.height})}else H==="bottom"&&(_t.push({x:ot.left,y:ot.top+ot.height-B/2}),_t.push({x:ot.left+ot.width,y:ot.top+ot.height-B/2}));const ut=Si({x:0,y:0,stroke:yt,lineWidth:tt,points:_t});C.addChild(ut)}}}return C}function fz(n,t,e,i,o,r){var s,l,a,h,d,u,c,g,f;if(e!=null&&e.zero&&(n=Math.min(n,0),t=Math.max(t,0)),e==null?void 0:e.expand){const m=n,b=t;I(e.expand.min)&&(n=m-(b-m)*e.expand.min),I(e.expand.max)&&(t=b+(b-m)*e.expand.max)}let p,v;if(nt(e==null?void 0:e.min)&&(n=e.min),nt(e==null?void 0:e.max)&&(t=e.max),(e==null?void 0:e.type)==="log"?(p=new js,p.base((s=e==null?void 0:e.base)!==null&&s!==void 0?s:10)):(e==null?void 0:e.type)==="symlog"?(p=new Gs,p.constant((l=e==null?void 0:e.constant)!==null&&l!==void 0?l:10)):p=new ko,p.domain([n,t],!!(e!=null&&e.nice)),e==null?void 0:e.nice){let m=(u=(h=(a=e.tick)===null||a===void 0?void 0:a.forceTickCount)!==null&&h!==void 0?h:(d=e.tick)===null||d===void 0?void 0:d.tickCount)!==null&&u!==void 0?u:10;jt(m)&&(m=m({axisLength:o,labelStyle:(g=(c=e==null?void 0:e.label)===null||c===void 0?void 0:c.style)!==null&&g!==void 0?g:{fontSize:Sl.LABEL_FONT_SIZE}})),e.niceType==="accurateFirst"&&(m=Math.max(10,m)),ct(e.min)&&ct(e.max)?p.nice(m):I(e.min)&&ct(e.max)?p.niceMax(m):ct(e.min)&&I(e.max)&&p.niceMin(m)}return delete p._niceType,r||(v=p.ticks(nt(e==null?void 0:e.tickCount)?e==null?void 0:e.tickCount:5,{noDecimals:(f=e==null?void 0:e.tick)===null||f===void 0?void 0:f.noDecimals})),{range:p.domain(),ticks:v}}const pz=()=>{St.registerFunction("createChartCellGroup",iz),St.registerFunction("getAxisDomainRangeAndLabels",fz)},vz=()=>{St.registerFunction("createCheckboxCellGroup",nz)},mz=()=>{St.registerFunction("createImageCellGroup",oL)},bz=()=>{St.registerFunction("createProgressBarCell",gz)},Cz=()=>{St.registerFunction("createRadioCellGroup",rz)},_z=()=>{St.registerFunction("createSparkLineCellGroup",hz)},yz=()=>{St.registerFunction("createTextCellGroup",cz)},wz=()=>{St.registerFunction("createVideoCellGroup",uz)};function Sz(n,t,e,i,o,r){const s=r.columnHeaderLevelCount,l=[],a=[];for(let c=0;c<e.length;c++)i.includes(e[c])||a.push(o[c]);for(let c=0;c<i.length;c++)if(!e.includes(i[c])){const g={col:n,row:s+c};l.push(g)}let h=r.getParentCellId(n,t),d=r.getRowHeaderCellAddressByCellId(h);const u=[];for(d&&u.push(d);h;)h=r.getParentCellId(d.col,d.row),h&&(d=r.getRowHeaderCellAddressByCellId(h),u.push(d));return{addCellPositions:l,removeCellPositions:a,updateCellPositions:u}}const s1={startInTotal:0,level:0};class Rl{constructor(t,e,i,o){var r,s,l,a,h,d,u,c,g,f,p,v,m,b,w,C,_;this.colIndex=0,this._showHeader=!0,this.columnHeaderObjs=[],this.rowHeaderObjs=[],this._cornerHeaderCellFullPathIds=[],this._columnHeaderCellFullPathIds=[],this._rowHeaderCellFullPathIds=[],this._rowHeaderCellFullPathIds_FULL=[],this._cornerHeaderCellIds=[],this._columnHeaderCellIds=[],this._rowHeaderCellIds=[],this._rowHeaderCellIds_FULL=[],this._columnWidths=[],this.columnPaths=[],this._headerObjects=[],this._headerObjectMap={},this._indicators=[],this.indicatorsAsCol=!0,this.hideIndicatorName=!1,this._showRowHeader=!0,this._showColumnHeader=!0,this._indicatorShowType="column",this.rowHierarchyTextStartAlignment=!1,this.rowDimensionKeys=[],this.colDimensionKeys=[],this.indicatorKeys=[],this.indicatorDimensionKey=ln,this._rowHeaderExtensionTree={},this._extensionRowDimensionKeys=[],this.fullRowDimensionKeys=[],this.leftRowSeriesNumberColumnCount=0,this.rightRowSeriesNumberColumnCount=0,this._useGetBodyCache=!1,this._getBodyCache=new Map,this._useHeaderPathCache=!1,this._colHeaderPathCache=new Map,this._rowHeaderPathCache=new Map,this.sharedVar=t.layoutNodeId,this._table=t,t.options.rowHierarchyType==="tree"&&(this.extensionRows=t.options.extensionRows),this.dataset=e,this._largeCellRangeCache=[],this._CellHeaderPathMap=new Map,this.rowTree=t.internalProps.rowTree,this.columnTree=t.internalProps.columnTree,this.rowsDefine=(r=t.internalProps.rows)!==null&&r!==void 0?r:[],this.columnsDefine=(s=t.internalProps.columns)!==null&&s!==void 0?s:[],this.indicatorsDefine=(l=t.internalProps.indicators)!==null&&l!==void 0?l:[],this.indicatorTitle=t.options.indicatorTitle,this.indicatorsAsCol=(a=t.options.indicatorsAsCol)===null||a===void 0||a,this.hideIndicatorName=(h=t.options.hideIndicatorName)!==null&&h!==void 0&&h,this.showRowHeader=(d=t.options.showRowHeader)===null||d===void 0||d,this.showColumnHeader=(u=t.options.showColumnHeader)===null||u===void 0||u,this.rowHeaderTitle=t.options.rowHeaderTitle,this.columnHeaderTitle=t.options.columnHeaderTitle,this.rowHierarchyType=(c=t.options.rowHierarchyType)!==null&&c!==void 0?c:"grid",this.rowExpandLevel=(g=t.options.rowExpandLevel)!==null&&g!==void 0?g:1,this.rowHierarchyIndent=(f=t.options.rowHierarchyIndent)!==null&&f!==void 0?f:20,this.rowHierarchyTextStartAlignment=t.options.rowHierarchyTextStartAlignment,this.cornerSetting=Object.assign({titleOnDimension:"column",forceShowHeader:!1},t.options.corner),e&&(this.rowTree=e.rowHeaderTree,this.columnTree=e.colHeaderTree),(p=this.indicatorsDefine)===null||p===void 0||p.forEach(A=>{typeof A=="string"?this.indicatorKeys.push(A):this.indicatorKeys.push(A.indicatorKey)}),this.columnDimensionTree=i,this.rowDimensionTree=o,this.colDimensionKeys=this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr(),this.rowDimensionKeys=this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),this.fullRowDimensionKeys=this.fullRowDimensionKeys.concat(this.rowDimensionKeys),this.resetRowHeaderLevelCount(),this._table.isPivotChart()&&(this.hasTwoIndicatorAxes=this.indicatorsDefine.some(A=>{var R,T;if(A.chartSpec&&A.chartSpec.series&&A.chartSpec.series.length>1){const M=(T=(R=A.chartSpec.axes)!==null&&R!==void 0?R:this._table.pivotChartAxes)!==null&&T!==void 0?T:[];if(!M.length||M.every(P=>P.orient!==(this.indicatorsAsCol?"top":"right")||P.visible!==!1))return!0}return!1})),this.resetColumnHeaderLevelCount(),this._generateColHeaderIds(),this.colIndex=0,this._generateRowHeaderIds(),this._rowHeaderCellFullPathIds_FULL=lg(this._rowHeaderCellFullPathIds_FULL),t.options.rowHierarchyType==="tree"&&((v=this.extensionRows)===null||v===void 0?void 0:v.length)>=1&&(this.generateExtensionRowTree(),this.extensionRows.forEach(A=>{const R=[];A.rows.forEach(T=>{typeof T=="string"?R.push(T):R.push(T.dimensionKey)}),this._extensionRowDimensionKeys.push(R),this.fullRowDimensionKeys=this.fullRowDimensionKeys.concat(R)})),this.sharedVar.seqId=Math.max(this.sharedVar.seqId,this._headerObjects.length);let y,x=this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();!this.dataset||this._table.isPivotChart()||((b=(m=this.dataset.records)===null||m===void 0?void 0:m.length)!==null&&b!==void 0?b:0)!==0||this.dataset.customColTree||(x=this.columnsDefine.map(A=>typeof A=="string"?A:A.dimensionKey),this.indicatorsAsCol&&x.push(this.indicatorDimensionKey)),x=this.columnHeaderTitle?[""].concat(x):x;let S=[];if(this.rowHierarchyType==="tree"&&((w=this.extensionRows)===null||w===void 0?void 0:w.length)>=1){const A=[];A.push(this.rowDimensionKeys[0]),this._extensionRowDimensionKeys.forEach(R=>{A.push(R[0])}),S=this.extensionRows.reduce((R,T)=>R.concat(T.rows),[]),y=this.rowHeaderTitle?[""].concat(A):A}else y=this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),!this.dataset||this._table.isPivotChart()||((_=(C=this.dataset.records)===null||C===void 0?void 0:C.length)!==null&&_!==void 0?_:0)!==0||this.dataset.customRowTree||(y=this.rowsDefine.map(A=>typeof A=="string"?A:A.dimensionKey),this.indicatorsAsCol||y.push(this.indicatorDimensionKey)),y=this.rowHeaderTitle?[""].concat(y):y;this.cornerHeaderObjs=this._addCornerHeaders(x,y,this.columnsDefine.concat(...this.rowsDefine,...S)),this.colIndex=0,this._headerObjectMap=this._headerObjects.reduce((A,R)=>(A[R.id]=R,A),{}),this.indicatorsAsCol&&!this.hideIndicatorName?this._indicatorShowType="column":this.indicatorsAsCol||this.hideIndicatorName?this._indicatorShowType="none":this._indicatorShowType="row",this.generateCellIdsConsiderHideHeader(),this.setPagination(t.options.pagination),this._table.isPivotChart()&&(this._chartItemSpanSize=0,this._chartItemBandSize=0,this._indicators.find(A=>{var R,T,M,P,k,B,H,E;!((R=A==null?void 0:A.style)===null||R===void 0)&&R.padding&&(this._chartPadding=A.style.padding),!((T=A.chartSpec)===null||T===void 0)&&T.barWidth&&typeof A.chartSpec.barWidth=="number"&&(this._chartItemSpanSize=(M=A.chartSpec)===null||M===void 0?void 0:M.barWidth);const F=(k=(P=A.chartSpec)===null||P===void 0?void 0:P.axes)===null||k===void 0?void 0:k.find(L=>L.type==="band");return F!=null&&F.bandSize&&(this._chartItemBandSize=F==null?void 0:F.bandSize,this._chartPaddingInner=(B=it(F.paddingInner)?F.paddingInner[0]:F.paddingInner)!==null&&B!==void 0?B:0,this._chartPaddingOuter=(H=it(F.paddingOuter)?F.paddingOuter[0]:F.paddingOuter)!==null&&H!==void 0?H:0),this._chartItemSpanSize>0||((E=A.chartSpec.series)===null||E===void 0||E.find(L=>(L.barWidth&&typeof L.barWidth=="number"&&(this._chartItemSpanSize=L.barWidth),this._chartItemSpanSize>0)),!1)})),this.handleRowSeriesNumber(t.internalProps.rowSeriesNumber),this.setColumnWidths()}handleRowSeriesNumber(t){var e,i;t&&(Array.isArray(t)?this.rowSeriesNumberColumn=t.map(o=>{var r,s;return{id:"",title:o.title,define:o,cellType:(r=o.cellType)!==null&&r!==void 0?r:"text",headerType:(s=o.cellType)!==null&&s!==void 0?s:"text",width:o.width,style:o.style,format:o.format,field:o.field,icon:o.icon}}):this.rowSeriesNumberColumn=[{id:"",title:t.title,define:t,cellType:(e=t.cellType)!==null&&e!==void 0?e:"text",headerType:(i=t.cellType)!==null&&i!==void 0?i:"text",style:t.style,width:t.width,format:t.format,field:"",icon:t.icon,isChildNode:!1}],this.leftRowSeriesNumberColumn=this.rowSeriesNumberColumn.filter(o=>!0),this.rightRowSeriesNumberColumn=this.rowSeriesNumberColumn.filter(o=>!1),this.leftRowSeriesNumberColumnCount=this.leftRowSeriesNumberColumn.length,this.rightRowSeriesNumberColumnCount=this.rightRowSeriesNumberColumn.length)}_generateColHeaderIds(){var t,e,i,o,r,s,l,a;if(((t=this.columnDimensionTree.tree.children)===null||t===void 0?void 0:t.length)>=1){let h=0;if(this.dataset&&!this._table.isPivotChart()&&((i=(e=this.dataset.records)===null||e===void 0?void 0:e.length)!==null&&i!==void 0?i:0)===0&&!this.dataset.customColTree&&!this.dataset.customRowTree&&this.indicatorsAsCol&&this.columnDimensionTree.totalLevel<this.columnHeaderLevelCount){h=this.columnHeaderLevelCount-this.columnDimensionTree.totalLevel;for(let d=0;d<h;d++)this._columnHeaderCellFullPathIds.unshift([])}this._addHeaders(this._columnHeaderCellFullPathIds,h,this.columnDimensionTree.tree.children,[],this.columnHeaderObjs)}if(this.columnHeaderTitle){this.sharedVar.seqId=Math.max(this.sharedVar.seqId,this._headerObjects.length);const h=++this.sharedVar.seqId,d=Array(this.colCount-this.rowHeaderLevelCount-this.rightFrozenColCount).fill(h);this._columnHeaderCellFullPathIds.unshift(d);const u={id:h,title:typeof this.columnHeaderTitle.title=="string"?this.columnHeaderTitle.title:this.columnsDefine.reduce((c,g)=>typeof g=="string"?c:c+(c?`/${g.title}`:`${g.title}`),""),field:void 0,headerType:(r=(o=this.columnHeaderTitle)===null||o===void 0?void 0:o.headerType)!==null&&r!==void 0?r:"text",style:(s=this.columnHeaderTitle)===null||s===void 0?void 0:s.headerStyle,define:{id:h,disableHeaderHover:!!(!((l=this.columnHeaderTitle)===null||l===void 0)&&l.disableHeaderHover),disableHeaderSelect:!!(!((a=this.columnHeaderTitle)===null||a===void 0)&&a.disableHeaderSelect)}};this.columnHeaderObjs.push(u),this._headerObjects[h]=u}}_generateRowHeaderIds(){var t,e,i,o,r,s,l,a,h,d;if(((t=this.rowDimensionTree.tree.children)===null||t===void 0?void 0:t.length)>=1)if(this.rowHierarchyType==="tree")this._addHeadersForTreeMode(this._rowHeaderCellFullPathIds_FULL,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0,this.rowsDefine,this.rowHeaderObjs);else{let u=0;if(this.dataset&&!this._table.isPivotChart()&&((i=(e=this.dataset.records)===null||e===void 0?void 0:e.length)!==null&&i!==void 0?i:0)===0&&!this.dataset.customColTree&&!this.dataset.customRowTree&&!this.indicatorsAsCol&&this.rowDimensionTree.totalLevel<this.rowHeaderLevelCount){u=this.rowHeaderLevelCount-this.rowDimensionTree.totalLevel;for(let c=0;c<u;c++)this._rowHeaderCellFullPathIds_FULL.unshift([])}this._addHeaders(this._rowHeaderCellFullPathIds_FULL,u,this.rowDimensionTree.tree.children,[],this.rowHeaderObjs)}if(this.rowHeaderTitle){this.sharedVar.seqId=Math.max(this.sharedVar.seqId,this._headerObjects.length);const u=++this.sharedVar.seqId,c=Array((r=(o=this._rowHeaderCellFullPathIds_FULL[0])===null||o===void 0?void 0:o.length)!==null&&r!==void 0?r:this.rowDimensionTree.tree.size).fill(u);this._rowHeaderCellFullPathIds_FULL.unshift(c);const g={id:u,title:typeof this.rowHeaderTitle.title=="string"?this.rowHeaderTitle.title:this.rowsDefine.reduce((f,p)=>typeof p=="string"?f:f+(f?`/${p.title}`:`${p.title}`),""),field:void 0,headerType:(l=(s=this.rowHeaderTitle)===null||s===void 0?void 0:s.headerType)!==null&&l!==void 0?l:"text",style:(a=this.rowHeaderTitle)===null||a===void 0?void 0:a.headerStyle,define:{id:u,disableHeaderHover:!!(!((h=this.rowHeaderTitle)===null||h===void 0)&&h.disableHeaderHover),disableHeaderSelect:!!(!((d=this.rowHeaderTitle)===null||d===void 0)&&d.disableHeaderSelect)}};this.rowHeaderObjs.push(g),this._headerObjects[u]=g}}_addHeaders(t,e,i,o,r){const s=this;t[e]||function(l){const a=t[l]=[];if(s.colIndex===0)return a;const h=t[l-1];for(let d=0;d<(h==null?void 0:h.length);d++)a[d]=h[d]}(e);for(let l=0;l<i.length;l++){const a=i[l];SI(a,t,r,o,e,this)}}_addHeadersForTreeMode(t,e,i,o,r,s,l,a){const h=this;t[e]||function(d){const u=t[d]=[];if(h.colIndex===0)return u;const c=t[d-1];for(let g=0;g<(c==null?void 0:c.length);g++)u[g]=c[g]}(e);for(let d=0;d<i.length;d++){const u=i[d];xI(u,t,a,o,e,r,s,l,this)}}_addCornerHeaders(t,e,i){var o,r;const s=[];if(this.cornerSetting.titleOnDimension==="all")if(this.indicatorsAsCol){let l=-1;t&&t.forEach((a,h)=>{var d,u;a===this.indicatorDimensionKey&&(l=h);const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};s[c]=f,this._headerObjects[c]=f,this._cornerHeaderCellFullPathIds[h]||(this._cornerHeaderCellFullPathIds[h]=[]);for(let p=0;p<this.rowHeaderLevelCount;p++)this._cornerHeaderCellFullPathIds[h][p]=c}),e&&e.forEach((a,h)=>{var d,u;const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};s[c]=f,this._headerObjects[c]=f,this._cornerHeaderCellFullPathIds[l]||(this._cornerHeaderCellFullPathIds[l]=[]),this._cornerHeaderCellFullPathIds[l][h]=c})}else{let l=-1;e&&e.forEach((a,h)=>{var d,u;a===this.indicatorDimensionKey&&(l=h);const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};s[c]=f,this._headerObjects[c]=f;for(let p=0;p<this.columnHeaderLevelCount;p++)this._cornerHeaderCellFullPathIds[p]||(this._cornerHeaderCellFullPathIds[p]=[]),this._cornerHeaderCellFullPathIds[p][h]=c}),t&&t.forEach((a,h)=>{var d,u;const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};s[c]=f,this._headerObjects[c]=f,this._cornerHeaderCellFullPathIds[h][l]=c})}else if(this.cornerSetting.titleOnDimension==="row"||this.cornerSetting.titleOnDimension==="column"){const l=((o=this.cornerSetting)===null||o===void 0?void 0:o.titleOnDimension)==="row"?e:t;l&&l.forEach((a,h)=>{var d,u;const c=++this.sharedVar.seqId,g=i.find(p=>typeof p!="string"&&p.dimensionKey===a),f={id:c,title:a===this.indicatorDimensionKey?this.indicatorTitle:g?g.title:a==="axis"?"":a,field:a,style:this.cornerSetting.headerStyle,headerType:(d=this.cornerSetting.headerType)!==null&&d!==void 0?d:"text",showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,define:{showSort:g==null?void 0:g.showSortInCorner,sort:g==null?void 0:g.sort,dimensionKey:a,id:c,value:a,headerCustomRender:this.cornerSetting.customRender,headerCustomLayout:this.cornerSetting.customLayout,headerEditor:this.cornerSetting.headerEditor,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect},dropDownMenu:g==null?void 0:g.cornerDropDownMenu,headerIcon:g==null?void 0:g.cornerHeaderIcon,pivotInfo:{value:(u=g==null?void 0:g.title)!==null&&u!==void 0?u:"",dimensionKey:a,isPivotCorner:!0},description:g==null?void 0:g.cornerDescription};if(s[c]=f,this._headerObjects[c]=f,this.cornerSetting.titleOnDimension==="column"){this._cornerHeaderCellFullPathIds[h]||(this._cornerHeaderCellFullPathIds[h]=[]);for(let p=0;p<this.rowHeaderLevelCount;p++)this._cornerHeaderCellFullPathIds[h][p]=c}else if(this.cornerSetting.titleOnDimension==="row")for(let p=0;p<this.columnHeaderLevelCount;p++)this._cornerHeaderCellFullPathIds[p]||(this._cornerHeaderCellFullPathIds[p]=[]),this._cornerHeaderCellFullPathIds[p][h]=c})}else{const l=++this.sharedVar.seqId,a={id:l,title:"",field:"维度名称",style:this.cornerSetting.headerStyle,headerType:(r=this.cornerSetting.headerType)!==null&&r!==void 0?r:"text",define:{dimensionKey:"维度名称",id:l,headerCustomRender:this.cornerSetting.customRender,headerCustomLayout:this.cornerSetting.customLayout,disableHeaderHover:!!this.cornerSetting.disableHeaderHover,disableHeaderSelect:!!this.cornerSetting.disableHeaderSelect}};s[l]=a,this._headerObjects[l]=a;for(let h=0;h<this.columnHeaderLevelCount;h++)for(let d=0;d<this.rowHeaderLevelCount;d++)this._cornerHeaderCellFullPathIds[h]||(this._cornerHeaderCellFullPathIds[h]=[]),this._cornerHeaderCellFullPathIds[h][d]=l}return s}generateExtensionRowTree(){this.extensionRows.forEach((t,e)=>{const i=this._rowHeaderCellFullPathIds_FULL;this._rowHeaderCellFullPathIds_FULL=[],i.forEach((o,r)=>{const s=o[o.length-1];let l,a;if(this.colIndex=0,typeof t.rowTree=="function"){const d=this.findFullCellIds(o);l=t.rowTree(d.map(u=>({dimensionKey:this._headerObjects[u].field,value:this._headerObjects[u].title})))}else l=Be(t.rowTree);this._rowHeaderExtensionTree[s]?(this._rowHeaderExtensionTree[s].reset(this._rowHeaderExtensionTree[s].tree.children,!0),a=this._rowHeaderExtensionTree[s]):(a=new ci(l??[],this.sharedVar,this.rowHierarchyType,void 0),this._rowHeaderExtensionTree[s]=a);const h=[];this._addHeadersForTreeMode(h,0,a.tree.children,[],a.totalLevel,!0,t.rows,this.rowHeaderObjs);for(let d=0;d<h[0].length;d++)this._rowHeaderCellFullPathIds_FULL.push(o.concat(h[0][d]))})})}setColumnWidths(){var t,e,i;const o=new Array(this.colCount).fill(void 0);if(this.leftRowSeriesNumberColumnCount&&(o[0]=this.leftRowSeriesNumberColumn[0]),this.showHeader&&this.showRowHeader)if(this.rowHeaderTitle&&(o[0+this.leftRowSeriesNumberColumnCount]={}),this.rowHierarchyType==="tree"){const r=this.rowDimensionKeys[0];if(r){const s=(t=this.rowsDefine)===null||t===void 0?void 0:t.find(l=>typeof l!="string"&&l.dimensionKey===r);s&&(o[0+(this.rowHeaderTitle?1:0)+this.leftRowSeriesNumberColumnCount]={width:s.width,minWidth:s.minWidth,maxWidth:s.maxWidth})}(e=this._extensionRowDimensionKeys)===null||e===void 0||e.forEach((s,l)=>{var a;const h=s[0];if(h){const d=(a=this.extensionRows[l].rows)===null||a===void 0?void 0:a.find(u=>typeof u!="string"&&u.dimensionKey===h);d&&(o[l+1+(this.rowHeaderTitle?1:0)+this.leftRowSeriesNumberColumnCount]={width:d.width,minWidth:d.minWidth,maxWidth:d.maxWidth})}})}else(this.rowDimensionTree.totalLevel>0?this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr():this.rowsDefine.map(r=>typeof r=="string"?r:r.dimensionKey)).forEach((r,s)=>{var l;const a=(l=this.rowsDefine)===null||l===void 0?void 0:l.find(h=>typeof h!="string"&&h.dimensionKey===r);a&&(o[s+(this.rowHeaderTitle?1:0)+this.leftRowSeriesNumberColumnCount]={width:a.width,minWidth:a.minWidth,maxWidth:a.maxWidth})});if(this.indicatorsAsCol)for(let r=this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount;r<this.colCount;r++){const s=this.getBody(r,this.columnHeaderLevelCount);o[r]={width:s==null?void 0:s.width,minWidth:s==null?void 0:s.minWidth,maxWidth:s==null?void 0:s.maxWidth}}else{let r,s,l,a=0;(i=this._indicators)===null||i===void 0||i.forEach((h,d)=>{var u,c;typeof h.width=="number"?a=Math.max(h.width,a):h.width==="auto"&&(l=!0),typeof h.minWidth=="number"&&(s=Math.max(h.minWidth,(u=s)!==null&&u!==void 0?u:0)),typeof h.maxWidth=="number"&&(r=Math.min(h.maxWidth,(c=r)!==null&&c!==void 0?c:Number.MAX_VALUE))}),a=a>0?a:l?"auto":void 0,o.fill({width:a,minWidth:s,maxWidth:r},this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount,this.colCount-this.rightFrozenColCount)}this._columnWidths=o}get columnWidths(){return this._columnWidths}getColumnWidthDefined(t){return this._columnWidths[t]}get showHeader(){return this._showHeader}set showHeader(t){this._showHeader=t}get showColumnHeader(){return this._showColumnHeader}set showColumnHeader(t){this._showColumnHeader=t}get showRowHeader(){return this._showRowHeader}set showRowHeader(t){this._showRowHeader=t}get columnHeaderTitle(){return this._columnHeaderTitle}set columnHeaderTitle(t){this._columnHeaderTitle=t}get rowHeaderTitle(){return this._rowHeaderTitle}set rowHeaderTitle(t){this._rowHeaderTitle=t}getHeaderFieldKey(t,e){}getCellLocation(t,e){return this.isCornerHeader(t,e)?"cornerHeader":this.isColumnHeader(t,e)?"columnHeader":this.isRowHeader(t,e)?"rowHeader":"body"}isHeader(t,e){return t>=this.leftRowSeriesNumberColumnCount&&t<this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount||e>=0&&e<this.columnHeaderLevelCount||t>=this.colCount-this.rightHeaderColCount||e>=this.rowCount-this.bottomHeaderRowCount}isCornerHeader(t,e){return t>=0&&t<this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount&&e>=0&&e<this.columnHeaderLevelCount}isColumnHeader(t,e){return t>=this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount&&e>=0&&e<this.columnHeaderLevelCount}isRowHeader(t,e){return t>=this.leftRowSeriesNumberColumnCount&&t<this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount&&e>=this.columnHeaderLevelCount}isFrozen(t,e){return this.isFrozenColumn(t)||this.isRightFrozenColumn(t)||this.isBottomFrozenRow(e)||this.isFrozenRow(e)||this.isSeriesNumberInBody(t,e)||this.isSeriesNumberInHeader(t,e)}isFrozenColumn(t,e){if(I(e)){if(t>=0&&t<this.frozenColCount&&e>=this.frozenRowCount&&e<this.rowCount-this.bottomFrozenRowCount)return!0}else if(this.frozenColCount>0&&t>=0&&t<this.frozenColCount)return!0;return!1}isRightFrozenColumn(t,e){if(I(e)){if(t>=this.colCount-this.rightFrozenColCount&&e>=this.frozenRowCount&&e<this.rowCount-this.bottomFrozenRowCount)return!0}else if(this.rightFrozenColCount>0&&t>=this.colCount-this.rightFrozenColCount)return!0;return!1}isFrozenRow(t,e){if(I(e)){if(e>=0&&e<this.frozenRowCount&&t>=this.frozenColCount&&t<this.colCount-this.rightFrozenColCount)return!0}else if(e=t,this.frozenRowCount>0&&e>=0&&e<this.frozenRowCount)return!0;return!1}isBottomFrozenRow(t,e){if(I(e)){if(e>=this.rowCount-this.bottomFrozenRowCount&&t>=this.frozenColCount&&t<this.colCount-this.rightFrozenColCount)return!0}else if(e=t,this.bottomFrozenRowCount>0&&e>=this.rowCount-this.bottomFrozenRowCount)return!0;return!1}isLeftTopCorner(t,e){return t>=0&&t<this.frozenColCount&&e>=0&&e<this.frozenRowCount}isLeftBottomCorner(t,e){return t>=0&&t<this.frozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}isRightTopCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=0&&e<this.frozenRowCount}isRightBottomCorner(t,e){return t>=this.colCount-this.rightFrozenColCount&&e>=this.rowCount-this.bottomFrozenRowCount}getColumnHeaderRange(){return{start:{col:this.rowHeaderLevelCount,row:0},end:{col:this.colCount-1,row:this.columnHeaderLevelCount-1}}}getRowHeaderRange(){return{start:{col:0,row:this.columnHeaderLevelCount},end:{col:this.rowHeaderLevelCount-1,row:this.rowCount-1}}}getCornerHeaderRange(){return{start:{col:0,row:0},end:{col:this.rowHeaderLevelCount-1,row:this.columnHeaderLevelCount-1}}}getBodyRange(){return{start:{col:this.rowHeaderLevelCount,row:this.columnHeaderLevelCount},end:{col:this.colCount-1,row:this.rowCount-1}}}resetCellIds(){}get frozenColCount(){return this._table.internalProps.frozenColCount?this.colCount>this._table.internalProps.frozenColCount?this._table.internalProps.frozenColCount:this.colCount:0}get frozenRowCount(){return this._table.internalProps.frozenRowCount?this.rowCount>=this._table.internalProps.frozenRowCount?this._table.internalProps.frozenRowCount:this.rowCount:0}get headerLevelCount(){return this.columnHeaderLevelCount}resetColumnHeaderLevelCount(){var t,e,i,o,r,s,l,a,h,d,u;if(this.showHeader&&this.showColumnHeader){if(this._table.isPivotChart()&&this.indicatorsAsCol&&!(!((e=(t=this.dataset)===null||t===void 0?void 0:t.colKeys)===null||e===void 0)&&e.length)&&((o=(i=this.columnDimensionTree)===null||i===void 0?void 0:i.tree)===null||o===void 0?void 0:o.level)===0&&!this.hasTwoIndicatorAxes)return void(this.columnHeaderLevelCount=0);let c=this.indicatorsAsCol&&this.hideIndicatorName&&this.colDimensionKeys[this.colDimensionKeys.length-1]===this.indicatorDimensionKey?this.columnDimensionTree.totalLevel-1:this.columnDimensionTree.totalLevel;return c===0&&this.dataset&&!(!((r=this.dataset.customColTree)===null||r===void 0)&&r.length)?this.cornerSetting.titleOnDimension==="row"&&this.cornerSetting.forceShowHeader?c=1:this._table.isPivotChart()||((l=(s=this.dataset.records)===null||s===void 0?void 0:s.length)!==null&&l!==void 0?l:0)!==0||this.cornerSetting.titleOnDimension!=="column"&&this.cornerSetting.titleOnDimension!=="all"||(c=(a=this.columnsDefine.length)!==null&&a!==void 0?a:0):!this.dataset||this._table.isPivotChart()||((d=(h=this.dataset.records)===null||h===void 0?void 0:h.length)!==null&&d!==void 0?d:0)!==0||this.dataset.customColTree||this.cornerSetting.titleOnDimension!=="column"&&this.cornerSetting.titleOnDimension!=="all"||(c=(u=this.columnsDefine.length)!==null&&u!==void 0?u:0,!this.hideIndicatorName&&this.indicatorsAsCol&&c++),this.columnHeaderTitle&&(c+=1),this._table.isPivotChart()&&this.indicatorsAsCol&&!this.hasTwoIndicatorAxes&&af(this.indicatorsDefine)&&(c-=1),void(this.columnHeaderLevelCount=c)}this.columnHeaderLevelCount=this.indicatorsAsCol?this.hideIndicatorName?0:1:0}resetRowHeaderLevelCount(){var t,e,i,o,r,s,l,a;if(this.showHeader&&this.showRowHeader){if(this.rowHierarchyType==="tree"){const u=(e=(t=this.extensionRows)===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0;return this.rowHeaderTitle?void(this.rowHeaderLevelCount=2+u):void(this.rowHeaderLevelCount=1+u)}const h=this.rowDimensionTree.totalLevel;let d=h;return d===0&&this.dataset&&!(!((i=this.dataset.customRowTree)===null||i===void 0)&&i.length)?this.cornerSetting.titleOnDimension==="column"&&this.cornerSetting.forceShowHeader?d=1:this._table.isPivotChart()||((r=(o=this.dataset.records)===null||o===void 0?void 0:o.length)!==null&&r!==void 0?r:0)!==0||this.cornerSetting.titleOnDimension!=="row"&&this.cornerSetting.titleOnDimension!=="all"||(d=(s=this.rowsDefine.length)!==null&&s!==void 0?s:0):!this.dataset||this._table.isPivotChart()||((a=(l=this.dataset.records)===null||l===void 0?void 0:l.length)!==null&&a!==void 0?a:0)!==0||this.dataset.customRowTree||this.cornerSetting.titleOnDimension!=="row"&&this.cornerSetting.titleOnDimension!=="all"||(d=this.rowsDefine.length,this.hideIndicatorName||this.indicatorsAsCol||d++),!this.indicatorsAsCol&&this.hideIndicatorName&&this.rowDimensionKeys[this.rowDimensionKeys.length-1]===this.indicatorDimensionKey&&(d=h-1),this.rowHeaderTitle&&(d+=1),void(this.rowHeaderLevelCount=d)}this.rowHeaderLevelCount=this.indicatorsAsCol||this.hideIndicatorName?0:1}get columnHeaderLevelCount(){return this._columnHeaderLevelCount}set columnHeaderLevelCount(t){this._columnHeaderLevelCount=t}get rowHeaderLevelCount(){return this._rowHeaderLevelCount}set rowHeaderLevelCount(t){this._rowHeaderLevelCount=t}get colCount(){var t;return(this.columnDimensionTree.totalLevel>0||this._table.isPivotChart()||((t=this.dataset.records)===null||t===void 0?void 0:t.length)>0||this.dataset.records&&!Array.isArray(this.dataset.records)?this.columnDimensionTree.tree.size:0)+this.rowHeaderLevelCount+this.rightHeaderColCount+this.leftRowSeriesNumberColumnCount}get rowCount(){var t,e,i,o;return((this._table.records||this.dataset.records)&&(!Array.isArray(this._table.records)||this._table.records.length>0)&&((t=this._indicators)===null||t===void 0?void 0:t.length)>0&&!(!((e=this._rowHeaderCellIds)===null||e===void 0)&&e.length)?1:(o=(i=this._rowHeaderCellIds)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0)+this.columnHeaderLevelCount+this.bottomHeaderRowCount}get bodyRowSpanCount(){return this.rowDimensionTree.tree.size}get bottomFrozenRowCount(){if(!this._table.isPivotChart())return this._table.internalProps.bottomFrozenRowCount?this.rowCount-this.headerLevelCount>=this._table.internalProps.bottomFrozenRowCount?this._table.internalProps.bottomFrozenRowCount:this.rowCount-this.headerLevelCount:0;if(this.indicatorKeys.length>=1&&af(this.indicatorsDefine)){const t=this._table.pivotChartAxes.find(e=>e.orient==="bottom");return(t==null?void 0:t.visible)===!1?0:(this.indicatorsAsCol,1)}return 0}get rightFrozenColCount(){if(!this._table.isPivotChart())return this._table.internalProps.rightFrozenColCount?this.colCount-this.rowHeaderLevelCount>=this._table.internalProps.rightFrozenColCount?this._table.internalProps.rightFrozenColCount:this.colCount-this.rowHeaderLevelCount:0;const t=this._table.pivotChartAxes.find(e=>e.orient==="right");return(t==null?void 0:t.visible)===!1||this.indicatorsAsCol?0:this.hasTwoIndicatorAxes?1:0}get bodyRowCount(){return this.rowCount-this.bottomFrozenRowCount-this.headerLevelCount}get bodyColCount(){return this.colCount-this.rightFrozenColCount-this.rowHeaderLevelCount}get headerObjects(){return this._headerObjects}get columnObjects(){return this._indicators}getCellId(t,e){var i,o,r,s,l;if(e>=0&&t>=0){if(this.isSeriesNumber(t,e))return"";if(this.isCornerHeader(t,e))return(i=this._cornerHeaderCellIds[e])===null||i===void 0?void 0:i[t-this.leftRowSeriesNumberColumnCount];if(this.isColumnHeader(t,e))return(o=this._columnHeaderCellIds[e])===null||o===void 0?void 0:o[t-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount];if(this.isRowHeader(t,e))return(r=this._rowHeaderCellIds[e-this.columnHeaderLevelCount])===null||r===void 0?void 0:r[t-this.leftRowSeriesNumberColumnCount];if(this.isRightFrozenColumn(t,e))return(s=this._rowHeaderCellIds[e-this.columnHeaderLevelCount])===null||s===void 0?void 0:s[this.rowHeaderLevelCount-1];if(this.isBottomFrozenRow(t,e))return(l=this._columnHeaderCellIds[this.columnHeaderLevelCount-1])===null||l===void 0?void 0:l[t-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount]}}getHeader(t,e){var i;if(this.isSeriesNumberInHeader(t,e))return this.getSeriesNumberHeader(t,e);const o=this.getCellId(t,e);return(i=this._headerObjectMap[o])!==null&&i!==void 0?i:{id:void 0,field:"",headerType:"text",define:void 0}}getHeaderField(t,e){var i,o;const r=this.getCellId(t,e);return((i=this._headerObjectMap[r])===null||i===void 0?void 0:i.field)||((o=this.getBody(t,e))===null||o===void 0?void 0:o.field)}getHeaderCellAdressById(t){for(let e=0;e<this._columnHeaderCellIds.length;e++){const i=this._columnHeaderCellIds[e];for(let o=0;o<i.length;o++)if(i[o]===t)return{col:o+this._table.frozenColCount,row:e}}for(let e=0;e<this._rowHeaderCellIds.length;e++){const i=this._rowHeaderCellIds[e];for(let o=0;o<i.length;o++)if(i[o]===t)return{col:o,row:e+this._table.frozenRowCount}}for(let e=0;e<this._cornerHeaderCellIds.length;e++){const i=this._cornerHeaderCellIds[e];for(let o=0;o<i.length;o++)if(i[o]===t)return{col:o,row:e}}}getHeaderCellAddressByField(t){const e=this.headerObjects.find(i=>i&&i.field===t);return e&&this.getHeaderCellAdressById(e.id)}getBody(t,e){var i,o,r,s,l,a,h,d,u,c;const g=this.getBodyWidthCache(t,e);if(g)return g;if(this.isSeriesNumber(t,e)){const m=this.getSeriesNumberBody(t,e);return this.setBodyWidthCache(t,e,m),m}const f=this.getCellHeaderPaths(t,e);if(this.indicatorsAsCol){const m=(o=(i=f.colHeaderPaths)===null||i===void 0?void 0:i.find(w=>w.indicatorKey))===null||o===void 0?void 0:o.indicatorKey,b=I(m)&&(l=(s=(r=this._indicators)===null||r===void 0?void 0:r.find(w=>w.indicatorKey===m))!==null&&s!==void 0?s:this._indicators[0])!==null&&l!==void 0?l:{id:"",field:void 0,indicatorKey:void 0,cellType:"text",define:void 0};return this.setBodyWidthCache(t,e,b),b}const p=(h=(a=f.rowHeaderPaths)===null||a===void 0?void 0:a.find(m=>m.indicatorKey))===null||h===void 0?void 0:h.indicatorKey,v=I(p)&&(c=(u=(d=this._indicators)===null||d===void 0?void 0:d.find(m=>m.indicatorKey===p))!==null&&u!==void 0?u:this._indicators[0])!==null&&c!==void 0?c:{id:"",field:void 0,indicatorKey:void 0,cellType:"text",define:void 0};return this.setBodyWidthCache(t,e,v),v}getCellRange(t,e){var i,o;const r={start:{col:t,row:e},end:{col:t,row:e}};if(!this.isHeader(t,e)||t===-1||e===-1||this.isRightFrozenColumn(t,e)||this.isBottomFrozenRow(t,e))return r;if(this._table.isPivotChart()){if(this.isLeftBottomCorner(t,e))return{start:{col:0,row:this.rowCount-this.bottomFrozenRowCount},end:{col:this.frozenColCount-1,row:this.rowCount-1}};if(this.isRightTopCorner(t,e))return{start:{col:this.colCount-this.rightFrozenColCount,row:0},end:{col:this.colCount-1,row:this.frozenRowCount-1}};if(this.isRightBottomCorner(t,e))return{start:{col:this.colCount-this.rightFrozenColCount,row:this.rowCount-this.bottomFrozenRowCount},end:{col:this.colCount-1,row:this.rowCount-1}}}for(let s=0;s<this._largeCellRangeCache.length;s++){const l=this._largeCellRangeCache[s];if(t>=l.start.col&&t<=l.end.col&&e>=l.start.row&&e<=l.end.row)return l}if(this.isHeader(t,e)&&t!==-1&&e!==-1){const s=this.getCellId(t,e);for(let l=t-1;l>=0&&s===this.getCellId(l,e);l--)r.start.col=l;for(let l=t+1;l<((i=this.colCount)!==null&&i!==void 0?i:0)&&s===this.getCellId(l,e);l++)r.end.col=l;for(let l=e-1;l>=0&&s===this.getCellId(t,l);l--)r.start.row=l;for(let l=e+1;l<((o=this.rowCount)!==null&&o!==void 0?o:0)&&!(s!==this.getCellId(t,l)||this.isSeriesNumberInHeader(t,e)&&l>=this.columnHeaderLevelCount);l++)r.end.row=l}return(r.end.col-r.start.col>100||r.end.row-r.start.row>100)&&this._largeCellRangeCache.push(r),r}isCellRangeEqual(t,e,i,o){const r=this.getCellRange(t,e),s=this.getCellRange(i,o);return r.start.col===s.start.col&&r.end.col===s.end.col&&r.start.row===s.start.row&&r.end.row===s.end.row}getBodyIndexByRow(t){return t<this.columnHeaderLevelCount||t>=this.rowCount-this.bottomHeaderRowCount?-1:t-this.columnHeaderLevelCount}get bottomHeaderRowCount(){return this._table.isPivotChart()?this.bottomFrozenRowCount:0}get rightHeaderColCount(){return this._table.isPivotChart()?this.rightFrozenColCount:0}getBodyIndexByCol(t){return t<this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount||t>=this.colCount-this.rightHeaderColCount?-1:t-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount}getRecordStartRowByRecordIndex(t){return this.columnHeaderLevelCount+t}getRecordShowIndexByCell(t,e){}getCellHeaderPathsWithTreeNode(t,e){for(let l=0;l<this._largeCellRangeCache.length;l++){const a=this._largeCellRangeCache[l];if(t>=a.start.col&&t<=a.end.col&&e>=a.start.row&&e<=a.end.row)break}let i=this.getColHeaderPathCache(t,e),o=this.getRowHeaderPathCache(t,e);const r=this.getBodyIndexByCol(t),s=this.getBodyIndexByRow(e)+this.currentPageStartIndex;if(!i&&e>=0&&r>=0&&(i=this.columnDimensionTree.getTreePath(r,this.showHeader&&this.showColumnHeader?e-(this.columnHeaderTitle?1:0):this.columnDimensionTree.totalLevel),this.setColHeaderPathCache(t,e,i)),!o&&t>=0&&s>=0){if(o=[],this.rowHierarchyType==="tree"){const l=this._rowHeaderCellFullPathIds[s];let a=this.rowDimensionTree,h=0;for(;a;){const d=[];let u=l[h];for(d.push(u);;){const g=this._headerObjectMap[u];if(!(g!=null&&g.parentCellId))break;d.unshift(g.parentCellId),u=g.parentCellId}const c=a.getTreePathByCellIds(d);o.push(...c),a=this._rowHeaderExtensionTree[l[h]],h++}}else o=this.rowDimensionTree.getTreePath(s,this.showHeader&&this.showRowHeader?t-(this.rowHeaderTitle?1:0)-this.leftRowSeriesNumberColumnCount:this.rowDimensionTree.totalLevel);this.setRowHeaderPathCache(t,e,o)}return{colHeaderPaths:i,rowHeaderPaths:o,cellLocation:this.getCellLocation(t,e)}}getCellHeaderPaths(t,e){var i,o;const r=this.getCellHeaderPathsWithTreeNode(t,e),s={colHeaderPaths:[],rowHeaderPaths:[],cellLocation:r.cellLocation};return(i=r.colHeaderPaths)===null||i===void 0||i.forEach(l=>{var a,h,d;const u={};u.dimensionKey=l.dimensionKey,u.indicatorKey=l.indicatorKey,u.value=(d=(a=l.value)!==null&&a!==void 0?a:(h=this.getIndicatorInfoByIndicatorKey(l.indicatorKey))===null||h===void 0?void 0:h.title)!==null&&d!==void 0?d:"",u.virtual=l.virtual,s.colHeaderPaths.push(u)}),(o=r.rowHeaderPaths)===null||o===void 0||o.forEach(l=>{var a,h,d;if(l.dimensionKey!=="axis"){const u={};u.dimensionKey=l.dimensionKey,u.indicatorKey=l.indicatorKey,u.value=(d=(a=l.value)!==null&&a!==void 0?a:(h=this.getIndicatorInfoByIndicatorKey(l.indicatorKey))===null||h===void 0?void 0:h.title)!==null&&d!==void 0?d:"",u.virtual=l.virtual,s.rowHeaderPaths.push(u)}}),s}getIndicatorInfoByIndicatorKey(t){var e;return(e=this.indicatorsDefine)===null||e===void 0?void 0:e.find(i=>typeof i!="string"&&!!t&&i.indicatorKey===t)}findFullCellIds(t){const e=[];for(let i=0;i<t.length;i++){let o=t[i];for(e.push(o);;){const r=this._headerObjectMap[o];if(!(r!=null&&r.parentCellId))break;e.unshift(r.parentCellId),o=r.parentCellId}}return e}getHeaderDimension(t,e){var i,o,r;if(this.isHeader(t,e)){const s=this.getHeader(t,e);return(o=(i=this.rowsDefine)===null||i===void 0?void 0:i.find(l=>typeof l!="string"&&l.dimensionKey===s.field))!==null&&o!==void 0?o:(r=this.columnsDefine)===null||r===void 0?void 0:r.find(l=>typeof l!="string"&&l.dimensionKey===s.field)}}isColumnIndicatorHeader(t,e){return this._indicatorShowType==="column"&&e===this.columnHeaderLevelCount-1&&t>=this.rowHeaderLevelCount}isRowIndicatorHeader(t,e){return this._indicatorShowType==="row"&&t===this.rowHeaderLevelCount-1&&e>=this.columnHeaderLevelCount}isIndicatorHeader(t,e){return this.isColumnIndicatorHeader(t,e)||this.isRowIndicatorHeader(t,e)}toggleHierarchyState(t,e){var i,o,r,s,l,a;this.colIndex=0;const h=this._rowHeaderCellFullPathIds_FULL.slice(0),d=h.map((g,f)=>({col:t,row:f+this.columnHeaderLevelCount})),u=this.getHeader(t,e);if(u.define.hierarchyState=u.define.hierarchyState===Pt.collapse?Pt.expand:Pt.collapse,this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._rowHeaderCellFullPathIds_FULL=[],this.rowDimensionKeys=this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),this.fullRowDimensionKeys=[],this.fullRowDimensionKeys=this.fullRowDimensionKeys.concat(this.rowDimensionKeys),this._addHeadersForTreeMode(this._rowHeaderCellFullPathIds_FULL,0,this.rowDimensionTree.tree.children,[],this.rowDimensionTree.totalLevel,!0,this.rowsDefine,this.rowHeaderObjs),this.rowHeaderTitle){const g=++this.sharedVar.seqId,f=Array(this.rowCount-this.columnHeaderLevelCount).fill(g);this._rowHeaderCellFullPathIds_FULL.unshift(f);const p={id:g,title:typeof this.rowHeaderTitle.title=="string"?this.rowHeaderTitle.title:this.rowsDefine.reduce((v,m)=>typeof m=="string"?v:v+(v?`/${m.title}`:`${m.title}`),""),field:void 0,headerType:(o=(i=this.rowHeaderTitle)===null||i===void 0?void 0:i.headerType)!==null&&o!==void 0?o:"text",style:(r=this.rowHeaderTitle)===null||r===void 0?void 0:r.headerStyle,define:{field:"",headerType:"text",cellType:"text",disableHeaderHover:!!(!((s=this.rowHeaderTitle)===null||s===void 0)&&s.disableHeaderHover),disableHeaderSelect:!!(!((l=this.rowHeaderTitle)===null||l===void 0)&&l.disableHeaderSelect)}};this.rowHeaderObjs.push(p),this._headerObjects[g]=p}this._rowHeaderCellFullPathIds_FULL=lg(this._rowHeaderCellFullPathIds_FULL),this.rowHierarchyType==="tree"&&((a=this.extensionRows)===null||a===void 0?void 0:a.length)>=1&&this.generateExtensionRowTree(),this.colIndex=0,this._headerObjectMap=this._headerObjects.reduce((g,f)=>(g[f.id]=f,g),{}),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0;const c=Sz(t,e,h.map(g=>g[t-this.leftRowSeriesNumberColumnCount]),this._rowHeaderCellFullPathIds_FULL.map(g=>g[t-this.leftRowSeriesNumberColumnCount]),d,this);return this.generateCellIdsConsiderHideHeader(),this.setPagination(this.pagination),c}isHeaderForColWidth(t,e){return this.isHeader(t,e)}getHeaderForColWidth(t,e){return this.getHeader(t,e)}getPivotCellAdress(t){var e;if(!Array.isArray(t))return;let i,o,r=this.rowTree,s=this.columnTree;for(let h=0;h<t.length;h++){const d=t[h];if((d.isPivotCorner||!I(d.value))&&h===t.length-1){if(((e=this==null?void 0:this.cornerSetting)===null||e===void 0?void 0:e.titleOnDimension)==="row"){let g=0;return this.rowHierarchyType==="grid"&&(g=this.rowDimensionKeys.indexOf(d.dimensionKey)),g===-1?void 0:{col:(this.rowHeaderTitle?g+1:g)+this.leftRowSeriesNumberColumnCount,row:0}}const c=this.colDimensionKeys.indexOf(d.dimensionKey);return c===-1?void 0:{col:0+this.leftRowSeriesNumberColumnCount,row:this.columnHeaderTitle?c+1:c}}let u=!1;for(let c=0;c<s.length;c++){const g=s[c];if((I(d.dimensionKey)&&g.dimensionKey===d.dimensionKey||I(d.indicatorKey)&&g.indicatorKey===d.indicatorKey)&&g.value===d.value){s=g.children,o=g,u=!0;break}}if(!u)for(let c=0;c<r.length;c++){const g=r[c];if((I(d.dimensionKey)&&g.dimensionKey===d.dimensionKey||I(d.indicatorKey)&&g.indicatorKey===d.indicatorKey)&&g.value===d.value){r=g.children,i=g;break}}}let l=0,a=0;if(i){a=this.columnHeaderLevelCount;const{startInTotal:h,level:d}=i;return a+=h,l=this.rowHierarchyType==="grid"?(this.rowHeaderTitle?d+1:d)+this.leftRowSeriesNumberColumnCount:0+this.leftRowSeriesNumberColumnCount,{col:l,row:a}}if(o){l=this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount;const{startInTotal:h,level:d}=o;return l+=h,a=this.columnHeaderTitle?d+1:d,{col:l,row:a}}}getPivotDimensionInfo(t,e){var i;const{colHeaderPaths:o,rowHeaderPaths:r}=this.getCellHeaderPaths(t,e),s=[];return o.length?o.forEach((l,a)=>{s.push({dimensionKey:l.dimensionKey,value:l.value,isPivotCorner:!1,indicatorKey:l.indicatorKey})}):r.length?r.forEach((l,a)=>{s.push({dimensionKey:l.dimensionKey,value:l.value,isPivotCorner:!1,indicatorKey:l.indicatorKey})}):this.isCornerHeader(t,e)&&(((i=this==null?void 0:this.cornerSetting)===null||i===void 0?void 0:i.titleOnDimension)==="row"?s.push({dimensionKey:this.rowDimensionKeys[(this.rowHeaderTitle?t-1:t)-this.leftRowSeriesNumberColumnCount],isPivotCorner:!0}):s.push({dimensionKey:this.colDimensionKeys[this.columnHeaderTitle?e-1:e],isPivotCorner:!0})),s}getIndicatorKey(t,e){var i;return(i=this.getBody(t,e))===null||i===void 0?void 0:i.indicatorKey}getParentCellId(t,e){if(e!==0)return this.isColumnHeader(t,e)?this.getCellId(t,e-1):this.isRowHeader(t,e)?this.getCellId(t-1,e):void 0}getRowHeaderCellAddressByCellId(t){let e,i;if(this._rowHeaderCellIds.find((o,r)=>!!o.find((s,l)=>s===t&&(e=l,!0))&&(i=r,!0)),I(e)&&I(i))return{col:e,row:i+this.columnHeaderLevelCount}}canMoveHeaderPosition(t,e){if(this.isSeriesNumberInHeader(e.col,e.row)||this.isSeriesNumberInHeader(t.col,t.row)||this.isCornerHeader(e.col,e.row)||t.col<0||t.row<0||e.col<0||e.row<0)return!1;this.isSeriesNumberInBody(e.col,e.row)&&this.isSeriesNumberInBody(t.col,t.row)&&(t.col=t.col+this.leftRowSeriesNumberColumnCount+this.rowHeaderLevelCount-1,e.col=e.col+this.leftRowSeriesNumberColumnCount+this.rowHeaderLevelCount-1);const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row))return this.getParentCellId(t.col,i.start.row)===this.getParentCellId(e.col,i.start.row);if(this.isRowHeader(t.col,t.row)){if(this.rowHierarchyType!=="tree")return this.getParentCellId(i.start.col,t.row)===this.getParentCellId(i.start.col,e.row);{const o=Be(this.getCellHeaderPathsWithTreeNode(t.col,t.row).rowHeaderPaths),r=Be(this.getCellHeaderPathsWithTreeNode(e.col,e.row).rowHeaderPaths);if(o.pop(),r.pop(),o.length<=r.length){if(o.length===r.length)return!o.find((s,l)=>s.dimensionKey!==r[l].dimensionKey||s.value!==r[l].value);if(o.length>0){for(let s=0;s<o.length;s++)if(o[s].startInTotal!==r[s].startInTotal)return!1}return!0}}}return!1}moveHeaderPosition(t,e){if(this.canMoveHeaderPosition(t,e)&&!this.isCellRangeEqual(t.col,t.row,e.col,e.row)){const i=this.getCellRange(t.col,t.row);if(this.isColumnHeader(t.col,t.row)){const o=i.end.col-i.start.col+1;let r;const s=this.getCellRange(e.col,i.start.row);if(r=e.col>=t.col?s.end.col-o+1:s.start.col,r===i.start.col)return null;for(let a=0;a<this._columnHeaderCellFullPathIds.length;a++){const h=this._columnHeaderCellFullPathIds[a].splice(i.start.col-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount,o);h.unshift(r-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount,0),Array.prototype.splice.apply(this._columnHeaderCellFullPathIds[a],h)}const l=this._columnWidths.splice(i.start.col-this.leftRowSeriesNumberColumnCount,o);return l.unshift(r-this.leftRowSeriesNumberColumnCount,0),Array.prototype.splice.apply(this._columnWidths,l),this.columnDimensionTree.movePosition(this.getCellHeaderPathsWithTreeNode(t.col,t.row).colHeaderPaths.length-1,i.start.col-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount,s.start.col-this.rowHeaderLevelCount-this.leftRowSeriesNumberColumnCount),this.columnDimensionTree.reset(this.columnDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0,{sourceIndex:i.start.col,targetIndex:r,sourceSize:o,targetSize:s.end.col-s.start.col+1,moveType:"column"}}if(this.isRowHeader(t.col,t.row)){let o;const r=this.getCellHeaderPathsWithTreeNode(t.col,t.row).rowHeaderPaths,s=this.getCellHeaderPathsWithTreeNode(e.col,e.row).rowHeaderPaths,l=r[r.length-1],a=s[r.length-1],h=l.size;if(o=e.row>=t.row?a.startInTotal+a.size-h:a.startInTotal,o===i.start.row-this.columnHeaderLevelCount)return null;const d=this._rowHeaderCellIds.splice(i.start.row-this.columnHeaderLevelCount,h);d.unshift(o-this.currentPageStartIndex,0),Array.prototype.splice.apply(this._rowHeaderCellIds,d);const u=this._rowHeaderCellFullPathIds.splice(i.start.row-this.columnHeaderLevelCount,h);u.unshift(o-this.currentPageStartIndex,0),Array.prototype.splice.apply(this._rowHeaderCellFullPathIds,u);const c=this._rowHeaderCellIds_FULL.splice(i.start.row-this.columnHeaderLevelCount+this.currentPageStartIndex,h);c.unshift(o,0),Array.prototype.splice.apply(this._rowHeaderCellIds_FULL,c);const g=this._rowHeaderCellFullPathIds_FULL.splice(i.start.row-this.columnHeaderLevelCount+this.currentPageStartIndex,h);return g.unshift(o,0),Array.prototype.splice.apply(this._rowHeaderCellFullPathIds_FULL,g),this.rowDimensionTree.movePosition(r.length-1,i.start.row-this.columnHeaderLevelCount,o+(e.row>t.row?l.size-1:0)),this.rowDimensionTree.reset(this.rowDimensionTree.tree.children,!0),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0,{sourceIndex:i.start.row,targetIndex:o+this.columnHeaderLevelCount,sourceSize:h,targetSize:a.size,moveType:"row"}}}return null}getCellAdressByHeaderPath(t){var e,i,o,r,s,l;let a,h,d=!1,u=!1;if(Array.isArray(t)){if(t.length>this.rowDimensionKeys.length+this.colDimensionKeys.length)return;a=t.filter(_=>this.colDimensionKeys.indexOf(_.dimensionKey)>=0||this.colDimensionKeys.indexOf(this.indicatorDimensionKey)>=0&&_.indicatorKey),h=t.filter(_=>this.rowDimensionKeys.indexOf(_.dimensionKey)>=0||this.rowDimensionKeys.indexOf(this.indicatorDimensionKey)>=0&&_.indicatorKey)}else a=t.colHeaderPaths,h=t.rowHeaderPaths,(t==null?void 0:t.cellLocation)==="body"&&this._table.isPivotTable()&&(u=!0);if(!Array.isArray(a)&&!Array.isArray(h))return;if(a==null||a.sort((_,y)=>{var x,S;return this.colDimensionKeys.indexOf((x=_.dimensionKey)!==null&&x!==void 0?x:this.indicatorDimensionKey)-this.colDimensionKeys.indexOf((S=y.dimensionKey)!==null&&S!==void 0?S:this.indicatorDimensionKey)}),h==null||h.sort((_,y)=>{var x,S;return this.fullRowDimensionKeys.indexOf((x=_.dimensionKey)!==null&&x!==void 0?x:this.indicatorDimensionKey)-this.fullRowDimensionKeys.indexOf((S=y.dimensionKey)!==null&&S!==void 0?S:this.indicatorDimensionKey)}),a==null||a.forEach(_=>{_.isPivotCorner&&(d=!0)}),h==null||h.forEach(_=>{_.isPivotCorner&&(d=!0)}),d){if(this.cornerSetting.titleOnDimension==="all"&&this.indicatorsAsCol&&a.length===0){for(let _=0;_<this.rowDimensionKeys.length;_++)if(((e=h[0])===null||e===void 0?void 0:e.dimensionKey)===this.rowDimensionKeys[_])return{col:_+this.leftRowSeriesNumberColumnCount,row:this.columnHeaderLevelCount-1}}else if(this.cornerSetting.titleOnDimension!=="all"||this.indicatorsAsCol||h.length!==0){if(this.cornerSetting.titleOnDimension==="row"||this.cornerSetting.titleOnDimension==="all"&&!this.indicatorsAsCol){for(let _=0;_<this.rowDimensionKeys.length;_++)if(((o=h[0])===null||o===void 0?void 0:o.dimensionKey)===this.rowDimensionKeys[_])return{col:_+this.leftRowSeriesNumberColumnCount,row:0}}else for(let _=0;_<this.colDimensionKeys.length;_++)if(((r=a[0])===null||r===void 0?void 0:r.dimensionKey)===this.colDimensionKeys[_])return{col:0,row:_}}else for(let _=0;_<this.colDimensionKeys.length;_++)if(((i=a[0])===null||i===void 0?void 0:i.dimensionKey)===this.colDimensionKeys[_])return{col:this.rowHeaderLevelCount-1,row:_}}let c,g,f,p,v=!1;(a==null?void 0:a.length)>=1&&(h==null?void 0:h.length)>=1&&(v=!0);let m,b,w=this.rowTree,C=this.columnTree;if(a)for(let _=0;_<a.length;_++){const y=a[_];for(let x=0;x<C.length;x++){const S=C[x];if(!I(y.indicatorKey)&&S.dimensionKey===y.dimensionKey&&S.value===y.value||I(y.indicatorKey)&&S.indicatorKey===y.indicatorKey){C=S.children,v&&!C?b=S:v||(b=S);break}}}if((h==null?void 0:h.length)>=1)if(this.rowHierarchyType==="tree"){const _=h[h.length-1],y=this.headerObjects.filter(S=>((S==null?void 0:S.field)===_.dimensionKey||(S==null?void 0:S.field)===_.indicatorKey)&&(S==null?void 0:S.title)===_.value).map(S=>S.id),x=this._rowHeaderCellIds.filter(S=>y.indexOf(S[S.length-1])>=0).find(S=>{const A=this.findFullCellIds(S);return A.length===h.length&&A.every(R=>{const T=this._headerObjectMap[R];return h.find(M=>M.dimensionKey===T.field&&M.value===T.title)})});g=this._rowHeaderCellIds.indexOf(x)+this.columnHeaderLevelCount}else for(let _=0;_<h.length;_++){const y=h[_];for(let x=0;x<w.length;x++){const S=w[x];if(!I(y.indicatorKey)&&S.dimensionKey===y.dimensionKey&&S.value===y.value||I(y.indicatorKey)&&S.indicatorKey===y.indicatorKey&&(!I(y.value)||S.value===y.value)){w=S.children,(!v||w&&!w.some(A=>A.dimensionKey==="axis"))&&v||(m=S);break}}}if(u||!v||(m||I(g))&&b){if(m||u){g=this.columnHeaderLevelCount;const{startInTotal:_,level:y}=(s=m)!==null&&s!==void 0?s:s1;g+=_??0,f=this.rowHierarchyType==="grid"?(this.rowHeaderTitle?y+1:y)+this.leftRowSeriesNumberColumnCount:0}if(b||u){c=this.rowHeaderLevelCount+this.leftRowSeriesNumberColumnCount;const{startInTotal:_,level:y}=(l=b)!==null&&l!==void 0?l:s1;c+=_??0,p=this.columnHeaderTitle?y+1:y}return I(c)||I(g)?{col:c??f,row:g??p}:void 0}}setChartInstance(t,e,i){var o,r,s,l;const a=this.getCellHeaderPaths(t,e);let h;if(this.indicatorsAsCol){const d=(o=a.colHeaderPaths.find(u=>u.indicatorKey))===null||o===void 0?void 0:o.indicatorKey;h=(r=this._indicators)===null||r===void 0?void 0:r.find(u=>u.indicatorKey===d)}else{const d=(s=a.rowHeaderPaths.find(u=>u.indicatorKey))===null||s===void 0?void 0:s.indicatorKey;h=(l=this._indicators)===null||l===void 0?void 0:l.find(u=>u.indicatorKey===d)}typeof(h==null?void 0:h.chartSpec)!="function"&&h&&(h.chartInstance=i)}getChartInstance(t,e){var i,o,r,s;const l=this.getCellHeaderPaths(t,e);let a;if(this.indicatorsAsCol){const h=(i=l.colHeaderPaths.find(d=>d.indicatorKey))===null||i===void 0?void 0:i.indicatorKey;a=(o=this._indicators)===null||o===void 0?void 0:o.find(d=>d.indicatorKey===h)}else{const h=(r=l.rowHeaderPaths.find(d=>d.indicatorKey))===null||r===void 0?void 0:r.indicatorKey;a=(s=this._indicators)===null||s===void 0?void 0:s.find(d=>d.indicatorKey===h)}return a==null?void 0:a.chartInstance}checkHasChart(){return r3(this)}getDimension(t,e){var i,o;return e==="column"?(i=this.columnsDefine)===null||i===void 0?void 0:i.find(r=>typeof r!="string"&&r.dimensionKey===t):e==="row"?(o=this.rowsDefine)===null||o===void 0?void 0:o.find(r=>typeof r!="string"&&r.dimensionKey===t):void 0}getAxisConfigInPivotChart(t,e){if((this.isFrozenColumn(t,e)||this.isRightFrozenColumn(t,e))&&qr(t,e,"row",this)||(this.isFrozenRow(t,e)||this.isBottomFrozenRow(t,e))&&qr(t,e,"col",this))return St.getFunction("getAxisConfigInPivotChart")(t,e,this)}isEmpty(t,e){return!!this._table.isPivotChart()&&(!!this.isLeftBottomCorner(t,e)||!!this.isRightBottomCorner(t,e)||!!this.isRightTopCorner(t,e))}isAxisCell(t,e){return this._table.isPivotChart()?!!(this.indicatorKeys.length>=1&&af(this.indicatorsDefine)&&(this.isBottomFrozenRow(t,e)&&qr(t,e,"col",this)||this.isRightFrozenColumn(t,e)&&qr(t,e,"row",this)||this.isRowHeader(t,e)&&t===this.rowHeaderLevelCount-1&&qr(t,e,"row",this)||this.hasTwoIndicatorAxes&&this.indicatorsAsCol&&e===this.columnHeaderLevelCount-1&&qr(t,e,"col",this))):!1}getChartAxes(t,e){if(e3(t,e,this)||this.isAxisCell(t,e))return n3(t,e,this)}getRawChartSpec(t,e){return JI(t,e,this)}getChartSpec(t,e){return i3(t,e,this)}isShareChartSpec(t,e){return QI(t,e,this)}getChartDataId(t,e){return o3(t,e,this)}isNoChartDataRenderNothing(t,e){return t3(t,e,this)}setPagination(t){var e,i,o,r,s,l,a;if(this.clearCellRangeMap(),this._table.internalProps.useOneRowHeightFillAll=!1,this.pagination=t,this.rowHierarchyType==="grid"&&I((e=this.pagination)===null||e===void 0?void 0:e.perPageCount)&&I((i=this.pagination)===null||i===void 0?void 0:i.currentPage)){this.indicatorsAsCol===!1&&(this.pagination.perPageCount=Math.ceil(this.pagination.perPageCount/this.indicatorKeys.length)*this.indicatorKeys.length);const{perPageCount:h,currentPage:d}=this.pagination;this.currentPageStartIndex=h*(d||0),this.currentPageEndIndex=this.currentPageStartIndex+h,this._rowHeaderCellIds=(o=this._rowHeaderCellIds_FULL)===null||o===void 0?void 0:o.slice(this.currentPageStartIndex,this.currentPageEndIndex),this._rowHeaderCellFullPathIds=(r=this._rowHeaderCellFullPathIds_FULL)===null||r===void 0?void 0:r.slice(this.currentPageStartIndex,this.currentPageEndIndex)}else this.currentPageStartIndex=0,this.currentPageEndIndex=this._rowHeaderCellIds_FULL.length,this._rowHeaderCellIds=(s=this._rowHeaderCellIds_FULL)===null||s===void 0?void 0:s.slice(this.currentPageStartIndex,this.currentPageEndIndex),this._rowHeaderCellFullPathIds=(l=this._rowHeaderCellFullPathIds_FULL)===null||l===void 0?void 0:l.slice(this.currentPageStartIndex,this.currentPageEndIndex);this.pagination&&(this.pagination.totalCount=(a=this._rowHeaderCellIds_FULL)===null||a===void 0?void 0:a.length)}release(){var t;const e=this._table._getActiveChartInstance();e==null||e.release(),(t=this._indicators)===null||t===void 0||t.forEach(i=>{var o;(o=i.chartInstance)===null||o===void 0||o.release()})}getHeadNode(t,e){var i,o,r;let s;const l=this.getCellHeaderPaths(t,e);return l.rowHeaderPaths&&((o=(i=l.rowHeaderPaths)===null||i===void 0?void 0:i.length)!==null&&o!==void 0?o:0)>0?s=(r=l.rowHeaderPaths)===null||r===void 0?void 0:r.slice(0,l.rowHeaderPaths.length):l.colHeaderPaths&&l.colHeaderPaths.length>0&&(s=l.colHeaderPaths.slice(0,l.colHeaderPaths.length)),this.getHeadNodeByRowOrColDimensions(s,t,e)}getHeadNodeByRowOrColDimensions(t,e,i){var o;if(!Array.isArray(t))return;let r,s,l=this.rowTree,a=this.columnTree;if(I(i)&&I(e)&&this.rowHierarchyType==="tree"&&this.extensionRows&&e>=1+this.leftRowSeriesNumberColumnCount){const h=this.getCellId(e-1,i);l=this._rowHeaderExtensionTree[h].tree.children}for(let h=0;h<t.length;h++){const d=t[h];if((d.isPivotCorner||!I(d.value))&&h===t.length-1)return;let u=!1;for(let c=0;c<a.length;c++){const g=a[c];if(I(d.dimensionKey)&&g.dimensionKey===d.dimensionKey&&g.value===d.value||I(d.indicatorKey)&&g.indicatorKey===d.indicatorKey&&(g.value===d.value||!I(d.value)||!I(g.value))){a=g.children,s=g,u=!0;break}}if(!u)for(let c=0;(o=c<(l==null?void 0:l.length))!==null&&o!==void 0&&o;c++){const g=l[c];if(I(d.dimensionKey)&&g.dimensionKey===d.dimensionKey&&g.value===d.value||I(d.indicatorKey)&&g.indicatorKey===d.indicatorKey&&(g.value===d.value||!I(d.value)||!I(g.value))){l=g.children,r=g;break}}}return r||s||void 0}clearCellRangeMap(){this._largeCellRangeCache.length=0,this._CellHeaderPathMap=new Map}getDimensionKeyInChartSpec(t,e){var i,o,r,s,l,a;let h;if(this.indicatorsAsCol===!1)for(let d=0;d<this.indicatorsDefine.length;d++){const u=this.indicatorsDefine[d].chartSpec;if(u&&(h=(i=u.xField)!==null&&i!==void 0?i:(r=(o=u==null?void 0:u.series)===null||o===void 0?void 0:o[0])===null||r===void 0?void 0:r.xField,h))return h}else for(let d=0;d<this.indicatorsDefine.length;d++){const u=this.indicatorsDefine[d].chartSpec;if(u&&(h=(s=u.yField)!==null&&s!==void 0?s:(a=(l=u==null?void 0:u.series)===null||l===void 0?void 0:l[0])===null||a===void 0?void 0:a.yField,h))return h}return null}_generateChartState(){return{vtable_selected:{filter:t=>{var e;return this._table._selectedDataItemsInChart.length>=1?!!this._table._selectedDataItemsInChart.find(i=>{for(const o in i)if(typeof i[o]!="object"&&i[o]!==t[o])return!1;return!0}):!((e=this._table._selectedDimensionInChart)===null||e===void 0)&&e.length?!!this._table._selectedDimensionInChart.every(i=>typeof i.value=="object"||t[i.key]===i.value):!1}},vtable_selected_reverse:{filter:t=>{var e;return this._table._selectedDataItemsInChart.length>=1?!this._table._selectedDataItemsInChart.find(i=>{for(const o in i)if(typeof i[o]!="object"&&i[o]!==t[o])return!1;return!0}):!((e=this._table._selectedDimensionInChart)===null||e===void 0)&&e.length?!this._table._selectedDimensionInChart.every(i=>typeof i.value=="object"||t[i.key]===i.value):!1}}}}updateDataStateToChartInstance(t){var e;if(((e=t==null?void 0:t.getSpec().select)===null||e===void 0?void 0:e.enable)!==!1){t||(t=this._table._getActiveChartInstance());const i=this._generateChartState();this._indicators.forEach(o=>{var r;const s=o.chartInstance;((r=o.chartSpec.select)===null||r===void 0?void 0:r.enable)!==!1&&s.updateState(i)}),t==null||t.updateState(i)}}updateDataStateToActiveChartInstance(t){var e;if(((e=t==null?void 0:t.getSpec().select)===null||e===void 0?void 0:e.enable)!==!1){t||(t=this._table._getActiveChartInstance());const i=this._generateChartState();t==null||t.updateState(i)}}getIndicatorKeyInChartSpec(t,e){const i=this.getRawChartSpec(t,e),o=[];if(i){if(i.series||i.xField||i.yField)return this.indicatorsAsCol===!1?i.series?i.series.forEach(r=>{const s=r.yField;o.push(s)}):o.push(i.yField):i.series?i.series.forEach(r=>{const s=r.xField;o.push(s)}):o.push(i.xField),o;if(i.valueField&&o.push(i.valueField),o.length>=1)return o}return null}getOptimunHeightForChart(t){var e,i,o,r,s;const l=this.getCellHeaderPaths(this.rowHeaderLevelCount,t).rowHeaderPaths;let a,h;for(const u in this.dataset.collectValuesBy)if(this.dataset.collectValuesBy[u].type==="yField"&&!this.dataset.collectValuesBy[u].range){a=(e=this.dataset.collectedValues[u])===null||e===void 0?void 0:e[l.map(c=>c.value).join(this.dataset.stringJoinChar)];break}if(this._chartItemBandSize)h=l1((i=a==null?void 0:a.length)!==null&&i!==void 0?i:0,this._chartItemBandSize,this._chartPaddingInner,this._chartPaddingOuter);else{const u=this._chartItemSpanSize||25;h=((o=a==null?void 0:a.length)!==null&&o!==void 0?o:0)*(u+u/3)}const d=kt((s=(r=this._chartPadding)!==null&&r!==void 0?r:this._table.theme.bodyStyle.padding)!==null&&s!==void 0?s:0);return h+d[0]+d[2]}getOptimunWidthForChart(t){var e,i,o,r,s;const l=this.getCellHeaderPaths(t,this.columnHeaderLevelCount).colHeaderPaths;let a,h;for(const u in this.dataset.collectValuesBy)if(this.dataset.collectValuesBy[u].type==="xField"&&!this.dataset.collectValuesBy[u].range){a=(e=this.dataset.collectedValues[u])===null||e===void 0?void 0:e[l.map(c=>c.value).join(this.dataset.stringJoinChar)];break}if(this._chartItemBandSize)h=l1((i=a==null?void 0:a.length)!==null&&i!==void 0?i:0,this._chartItemBandSize,this._chartPaddingInner,this._chartPaddingOuter);else{const u=this._chartItemSpanSize||25;h=((o=a==null?void 0:a.length)!==null&&o!==void 0?o:0)*(u+u/3)}const d=kt((s=(r=this._chartPadding)!==null&&r!==void 0?r:this._table.theme.bodyStyle.padding)!==null&&s!==void 0?s:0);return h+d[1]+d[3]}get leftAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find(e=>e.orient==="left");return(t==null?void 0:t.visible)===!1?0:(this.indicatorsAsCol,1)}get topAxesCount(){if(!this._table.isPivotChart())return 0;const t=this._table.pivotChartAxes.find(e=>e.orient==="top");return(t==null?void 0:t.visible)===!1?0:this.indicatorsAsCol&&this.hasTwoIndicatorAxes?1:0}get rightAxesCount(){return this.rightFrozenColCount}get bottomAxesCount(){return this.bottomFrozenRowCount}getColKeysPath(t,e){const i=this.getCellHeaderPaths(t,e),o=[];return i.colHeaderPaths.length&&i.colHeaderPaths.forEach(r=>{r.dimensionKey&&o.push(r.value)}),o==null?void 0:o.join(this.dataset.stringJoinChar)}getRowKeysPath(t,e){const i=this.getCellHeaderPaths(t,e),o=[];return i.rowHeaderPaths.length&&i.rowHeaderPaths.forEach(r=>{r.dimensionKey&&o.push(r.value)}),o==null?void 0:o.join(this.dataset.stringJoinChar)}getIndicatorInfo(t,e=""){var i;return(i=this.indicatorsDefine)===null||i===void 0?void 0:i.find(o=>typeof o!="string"&&(t?o.indicatorKey===t:!!e&&o.title===e))}getLayoutColumnTree(){const t=[],e=this.columnDimensionTree.tree.children;return ef(t,e),t}getLayoutRowTree(){const t=[],e=this.rowDimensionTree.tree.children;return ef(t,e),t}getLayoutColumnTreeCount(){const t=this.columnDimensionTree.tree.children;return Hd(t,this.rowHierarchyType==="tree")}getLayoutRowTreeCount(){var t;const e=this.rowDimensionTree.tree.children;let i=Hd(e,this.rowHierarchyType==="tree");return(t=this.extensionRows)===null||t===void 0||t.forEach(o=>{if(typeof o.rowTree!="function"){const r=Hd(o.rowTree,!0);i*=r}}),i}resetHeaderTree(){var t,e,i;this.colIndex=0,this._rowHeaderCellFullPathIds_FULL=[],this._columnHeaderCellFullPathIds=[],this._columnHeaderCellIds=[];const o=this.dataset;this.rowTree=o.rowHeaderTree,this.columnTree=o.colHeaderTree;const r=this.rowDimensionTree.tree.children;(t=this.rowTree)===null||t===void 0||t.forEach((s,l)=>{const a=r.find(h=>h.dimensionKey===s.dimensionKey&&h.value===s.value);a&&this._table._syncHierarchyState(a,s)}),this.columnDimensionTree=new ci((e=this.columnTree)!==null&&e!==void 0?e:[],this.sharedVar),this.rowDimensionTree=new ci((i=this.rowTree)!==null&&i!==void 0?i:[],this.sharedVar,this.rowHierarchyType,this.rowHierarchyType==="tree"?this.rowExpandLevel:void 0),this.resetColumnHeaderLevelCount(),this._generateColHeaderIds(),this.colIndex=0,this._generateRowHeaderIds(),this._rowHeaderCellFullPathIds_FULL=lg(this._rowHeaderCellFullPathIds_FULL),this._headerObjectMap=this._headerObjects.reduce((s,l)=>(s[l.id]=l,s),{}),this._CellHeaderPathMap=new Map,this._largeCellRangeCache.length=0,this.generateCellIdsConsiderHideHeader(),this.setPagination(this.pagination)}isSeriesNumberInHeader(t,e){return this.leftRowSeriesNumberColumnCount>0&&t>=0&&e>=0&&t<this.leftRowSeriesNumberColumnCount&&e<this.headerLevelCount||this.rightRowSeriesNumberColumnCount>0&&e>=0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount&&e<this.headerLevelCount}isSeriesNumberInBody(t,e){return this.leftRowSeriesNumberColumnCount>0&&t>=0&&t<this.leftRowSeriesNumberColumnCount&&e>=this.headerLevelCount||this.rightRowSeriesNumberColumnCount>0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount&&e>=this.headerLevelCount}isSeriesNumber(t,e){return!!(I(t)&&I(e)&&(this.leftRowSeriesNumberColumnCount>0&&t>=0&&e>=0&&t<this.leftRowSeriesNumberColumnCount||this.rightRowSeriesNumberColumnCount>0&&e>=0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount))}getSeriesNumberHeader(t,e){return this.leftRowSeriesNumberColumnCount>0&&t>=0&&t<this.leftRowSeriesNumberColumnCount&&e<this.headerLevelCount?Object.assign({},this.leftRowSeriesNumberColumn[t],{style:this._table.internalProps.rowSeriesNumber.headerStyle}):this.rightRowSeriesNumberColumnCount>0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount&&e<this.headerLevelCount&&e<this.headerLevelCount?this.rightRowSeriesNumberColumn[t-(this.colCount-this.rightRowSeriesNumberColumnCount)]:void 0}getSeriesNumberBody(t,e){return this.leftRowSeriesNumberColumnCount>0&&t>=0&&t<this.leftRowSeriesNumberColumnCount&&e>=this.headerLevelCount?this.leftRowSeriesNumberColumn[t]:this.rightRowSeriesNumberColumnCount>0&&t>=this.colCount-this.rightRowSeriesNumberColumnCount&&e>=this.headerLevelCount?this.rightRowSeriesNumberColumn[t-(this.colCount-this.rightRowSeriesNumberColumnCount)]:void 0}changeTreeNodeTitle(t,e,i){this.getHeadNode(t,e).value=i;const o=this.getCellId(t,e);this._headerObjectMap[o].title=i}changeCornerTitle(t,e,i){if(this.isCornerHeader(t,e)){const o=this.getCellId(t,e);this._headerObjectMap[o].title=i}}generateCellIdsConsiderHideHeader(){if(this._columnHeaderCellIds=this._columnHeaderCellFullPathIds.slice(),!this.showColumnHeader)if(this.indicatorsAsCol&&!this.hideIndicatorName){const t=this.colDimensionKeys.indexOf(ln),e=this._columnHeaderCellIds.splice(t,1);this._columnHeaderCellIds.splice(0,this._columnHeaderCellIds.length),this._columnHeaderCellIds.push(e[0])}else this._columnHeaderCellIds.splice(0,this._columnHeaderCellIds.length);if(this._rowHeaderCellIds_FULL=this._rowHeaderCellFullPathIds_FULL.slice(),!this.showRowHeader)if(this.indicatorsAsCol||this.hideIndicatorName)this._rowHeaderCellIds_FULL.forEach((t,e)=>{const i=t.slice();i.splice(0,i.length),this._rowHeaderCellIds_FULL[e]=i});else{const t=this.rowDimensionKeys.indexOf(ln);this._rowHeaderCellIds_FULL.forEach((e,i)=>{const o=e.slice(),r=o.splice(t,1);o.splice(0,o.length),o.push(r[0]),this._rowHeaderCellIds_FULL[i]=o})}if(this._rowHeaderCellIds=this._rowHeaderCellIds_FULL.slice(),this._cornerHeaderCellIds=this._cornerHeaderCellFullPathIds.slice(),this.rowHeaderLevelCount===0||this.columnHeaderLevelCount===0)this._cornerHeaderCellIds=[];else if(this.cornerSetting.titleOnDimension!=="row"||this.showRowHeader){if(this.cornerSetting.titleOnDimension==="column"&&!this.showColumnHeader)if(this.indicatorsAsCol&&!this.hideIndicatorName){const t=this.colDimensionKeys.indexOf(ln),e=this._cornerHeaderCellIds.splice(t,1);this._cornerHeaderCellIds.splice(0,this._cornerHeaderCellIds.length),this._cornerHeaderCellIds.push(e[0])}else this._cornerHeaderCellIds.splice(0,this._cornerHeaderCellIds.length)}else if(this.indicatorsAsCol||this.hideIndicatorName)this._cornerHeaderCellIds.forEach((t,e)=>{const i=t.slice();i.splice(0,i.length),this._cornerHeaderCellIds[e]=i});else{const t=this.rowDimensionKeys.indexOf(ln);this._cornerHeaderCellIds.forEach((e,i)=>{const o=e.slice(),r=o.splice(t,1);o.splice(0,o.length),o.push(r[0]),this._cornerHeaderCellIds[i]=o})}}enableUseGetBodyCache(){this._useGetBodyCache=!0,this._getBodyCache.clear()}disableUseGetBodyCache(){this._useGetBodyCache=!1,this._getBodyCache.clear()}enableUseHeaderPathCache(){this._useHeaderPathCache=!0,this._colHeaderPathCache.clear(),this._rowHeaderPathCache.clear()}disableUseHeaderPathCache(){this._useHeaderPathCache=!1,this._colHeaderPathCache.clear(),this._rowHeaderPathCache.clear()}getBodyWidthCache(t,e){if(this._useGetBodyCache&&!this.isHeader(t,e)&&!this.isSeriesNumber(t,e))return this.indicatorsAsCol&&this._getBodyCache.has(t)?this._getBodyCache.get(t):!this.indicatorsAsCol&&this._getBodyCache.has(e)?this._getBodyCache.get(e):void 0}setBodyWidthCache(t,e,i){!this._useGetBodyCache||this.isHeader(t,e)||this.isSeriesNumber(t,e)||(this.indicatorsAsCol?this._getBodyCache.set(t,i):this._getBodyCache.set(e,i))}getColHeaderPathCache(t,e){if(this._useHeaderPathCache&&!this.isHeader(t,e)&&!this.isSeriesNumber(t,e)&&this._colHeaderPathCache.has(t))return this._colHeaderPathCache.get(t)}setColHeaderPathCache(t,e,i){!this._useHeaderPathCache||this.isHeader(t,e)||this.isSeriesNumber(t,e)||this._colHeaderPathCache.set(t,i)}getRowHeaderPathCache(t,e){if(this._useHeaderPathCache&&!this.isHeader(t,e)&&!this.isSeriesNumber(t,e)&&this._rowHeaderPathCache.has(e))return this._rowHeaderPathCache.get(e)}setRowHeaderPathCache(t,e,i){!this._useHeaderPathCache||this.isHeader(t,e)||this.isSeriesNumber(t,e)||this._rowHeaderPathCache.set(e,i)}}function l1(n,t,e,i){e===1&&(e=0);const o=xz(n,e,i),r=t/(1-e);return Math.ceil(o*r)}function xz(n,t,e){let i;return i=n===1?n+2*e:n-t+2*e,n?i>0?i:1:0}class gf{constructor(t,e){this.tree={},this.beforeChangedTree={},this.colFlatKeys={},this.rowFlatKeys={},this.stringJoinChar=String.fromCharCode(0),this.rowsIsTotal=[],this.colsIsTotal=[],this.dataConfig=t,e&&(this.records=e,typeof window<"u"&&window.performance.now(),this.setRecords(e),typeof window<"u"&&window.performance.now())}changeDataConfig(t){this.dataConfig=t}setRecords(t){this.processRecords()}processRecords(){for(let t=0,e=this.records.length;t<e;t++){const i=this.records[t];this.processRecord(i)}}processRecord(t){var e;const i=[],o=[];for(let r=0,s=this.dataConfig.rows.length;r<s;r++){const l=this.dataConfig.rows[r];t[l]!==void 0&&l!==this.dataConfig.indicatorDimensionKey&&o.push(t[l])}for(let r=0,s=this.dataConfig.columns.length;r<s;r++){const l=this.dataConfig.columns[r];t[l]!==void 0&&l!==this.dataConfig.indicatorDimensionKey&&i.push(t[l])}(e=this.dataConfig.indicators)===null||e===void 0||e.forEach(r=>{const s=t[r];s!==void 0&&(this.dataConfig.indicatorsAsCol?i.push(r):o.push(r));const l=o.join(this.stringJoinChar),a=i.join(this.stringJoinChar);o.length!==0&&(this.rowFlatKeys[l]||(this.rowFlatKeys[l]=1)),i.length!==0&&(this.colFlatKeys[a]||(this.colFlatKeys[a]=1)),i.length===0&&o.length===0||(this.tree[l]||(this.tree[l]={}),s!==void 0&&(this.tree[l][a]={value:s,record:t},this.dataConfig.indicatorsAsCol?i.pop():o.pop()))})}getTreeNode(t=[],e=[],i,o=!0){var r,s,l,a;let h,d;if(typeof t=="string")h=t;else{let u=!1;t.map((c,g)=>{c===i&&(t.splice(g,1),u=!0)}),u&&t.push(i),h=t.join(this.stringJoinChar)}if(typeof e=="string")d=e;else{let u=!1;e.map((c,g)=>{c===i&&(e.splice(g,1),u=!0)}),u&&e.push(i),d=e.join(this.stringJoinChar)}return o?(l=(s=(r=this.tree)===null||r===void 0?void 0:r[h])===null||s===void 0?void 0:s[d])!==null&&l!==void 0?l:void 0:I((a=this.beforeChangedTree[h])===null||a===void 0?void 0:a[d])?{value:this.beforeChangedTree[h][d].value,record:this.beforeChangedTree[h][d].record}:void 0}changeTreeNodeValue(t=[],e=[],i,o){var r,s,l,a,h,d,u;let c,g;if(typeof t=="string")c=t;else{let v=!1;t.map((m,b)=>{m===i&&(t.splice(b,1),v=!0)}),v&&t.push(i),c=t.join(this.stringJoinChar)}if(typeof e=="string")g=e;else{let v=!1;e.map((m,b)=>{m===i&&(e.splice(b,1),v=!0)}),v&&e.push(i),g=e.join(this.stringJoinChar)}const f=(s=(r=this.tree[c])===null||r===void 0?void 0:r[g])===null||s===void 0?void 0:s.value,p=Object.assign({},(a=(l=this.tree[c])===null||l===void 0?void 0:l[g])===null||a===void 0?void 0:a.record);!((d=(h=this.tree[c])===null||h===void 0?void 0:h[g])===null||d===void 0)&&d.record?(this.tree[c][g].record[i]=o,this.tree[c][g].value=o):(this.tree[c]||(this.tree[c]={}),this.tree[c][g]={record:this._buildRecord(t,e,i,o),value:o}),!((u=this.beforeChangedTree[c])===null||u===void 0)&&u[g]||(this.beforeChangedTree[c]={},this.beforeChangedTree[c][g]={record:void 0,value:void 0},this.beforeChangedTree[c][g].record=p,this.beforeChangedTree[c][g].value=f)}_buildRecord(t=[],e=[],i,o){const r={},s=this.dataConfig.rows,l=this.dataConfig.columns;return s.forEach((a,h)=>{a!==this.dataConfig.indicatorDimensionKey&&(r[a]=t[h])}),l.forEach((a,h)=>{a!==this.dataConfig.indicatorDimensionKey&&(r[a]=e[h])}),r[i]=o,this.records.push(r),r}addRecords(t){for(let e=0,i=t.length;e<i;e++){const o=t[e];this.processRecord(o)}this.records.push(t)}changeRecordFieldValue(t,e,i){let o=!1;for(let r=0;r<this.dataConfig.indicators.length;r++)this.dataConfig.indicators[r]===t&&(o=!0);if(!o){for(let r=0,s=this.records.length;r<s;r++){const l=this.records[r];l[t]===e&&(l[t]=i)}this.rowFlatKeys={},this.colFlatKeys={},this.tree={},this.processRecords()}}}function a1(n,t){let e="";for(let i=0;i<n.length;i++)e+=n[i],i!==n.length-1&&(e+=t);return e}class h1{constructor(t,e,i,o,r,s,l,a,h,d,u,c,g){var f,p,v,m,b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O,Y;this.tree={},this.changedTree={},this.colFlatKeys={},this.rowFlatKeys={},this.colKeys=[],this.rowKeys=[],this.colKeys_normal=[],this.rowKeys_normal=[],this.rowOrder="key_a_to_z",this.colOrder="key_a_to_z",this.sorted=!1,this.indicatorStatistics=[],this.aggregators={},this.stringJoinChar=String.fromCharCode(0),this.rowsIsTotal=[],this.colsIsTotal=[],this.collectedValues={},this.cacheCollectedValues={},this.totalRecordsTree={},this.registerAggregators(),this.dataConfig=t,this.filterRules=(f=this.dataConfig)===null||f===void 0?void 0:f.filterRules,this.rowHierarchyType=a??"grid",this.sortRules=(p=this.dataConfig)===null||p===void 0?void 0:p.sortRules,this.aggregationRules=(v=this.dataConfig)===null||v===void 0?void 0:v.aggregationRules,this.derivedFieldRules=(m=this.dataConfig)===null||m===void 0?void 0:m.derivedFieldRules,this.mappingRules=(b=this.dataConfig)===null||b===void 0?void 0:b.mappingRules,this.calculatedFieldRules=(w=this.dataConfig)===null||w===void 0?void 0:w.calculatedFieldRules,this.calculatedFiledKeys=(_=(C=this.calculatedFieldRules)===null||C===void 0?void 0:C.map($=>$.key))!==null&&_!==void 0?_:[],this.calculatedFieldDependIndicatorKeys=(x=(y=this.calculatedFieldRules)===null||y===void 0?void 0:y.reduce(($,Q)=>{for(let et=0;et<Q.dependIndicatorKeys.length;et++)$.indexOf(Q.dependIndicatorKeys[et])===-1&&$.push(Q.dependIndicatorKeys[et]);return $},[]))!==null&&x!==void 0?x:[],this.totals=(S=this.dataConfig)===null||S===void 0?void 0:S.totals,this.rows=e,this.columns=i,this.indicatorKeys=o,this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys=[...o];for(let $=0;$<this.calculatedFieldDependIndicatorKeys.length;$++)this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys.indexOf(this.calculatedFieldDependIndicatorKeys[$])===-1&&this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys.push(this.calculatedFieldDependIndicatorKeys[$]);if(this.indicatorsAsCol=s,this.indicators=r,this.customColTree=h,this.customRowTree=d,this.hasExtensionRowTree=c,this.parseCustomTreeToMatchRecords=g,this.parseCustomTreeToMatchRecords&&(this.customColTreeDimensionPaths=this.customTreeToDimensionPathArr(this.customColTree,"col"),this.hasExtensionRowTree||(this.customRowTreeDimensionPaths=this.customTreeToDimensionPathArr(this.customRowTree,"row"))),this.colGrandTotalLabel=(T=(R=(A=this.totals)===null||A===void 0?void 0:A.column)===null||R===void 0?void 0:R.grandTotalLabel)!==null&&T!==void 0?T:"总计",this.colSubTotalLabel=(k=(P=(M=this.totals)===null||M===void 0?void 0:M.column)===null||P===void 0?void 0:P.subTotalLabel)!==null&&k!==void 0?k:"小计",this.rowGrandTotalLabel=(E=(H=(B=this.totals)===null||B===void 0?void 0:B.row)===null||H===void 0?void 0:H.grandTotalLabel)!==null&&E!==void 0?E:"总计",this.rowSubTotalLabel=(z=(L=(F=this.totals)===null||F===void 0?void 0:F.row)===null||L===void 0?void 0:L.subTotalLabel)!==null&&z!==void 0?z:"小计",this.collectValuesBy=(D=this.dataConfig)===null||D===void 0?void 0:D.collectValuesBy,this.needSplitPositiveAndNegative=u!=null&&u,this.rowsIsTotal=new Array((V=(N=this.rows)===null||N===void 0?void 0:N.length)!==null&&V!==void 0?V:0).fill(!1),this.colsIsTotal=new Array((U=(G=this.columns)===null||G===void 0?void 0:G.length)!==null&&U!==void 0?U:0).fill(!1),((Z=this.totals)===null||Z===void 0?void 0:Z.row)&&this.totals.row.showSubTotals!==!1&&this.totals.row.subTotalsDimensions)for(let $=0,Q=(ht=(rt=(j=(q=this.totals)===null||q===void 0?void 0:q.row)===null||j===void 0?void 0:j.subTotalsDimensions)===null||rt===void 0?void 0:rt.length)!==null&&ht!==void 0?ht:0;$<Q;$++){const et=this.totals.row.subTotalsDimensions[$],ot=this.rows.indexOf(et);this.rowsIsTotal[ot]=!0}if(!((gt=this.totals)===null||gt===void 0)&>.column&&this.totals.column.showSubTotals!==!1&&this.totals.column.subTotalsDimensions)for(let $=0,Q=(Y=(O=(W=(vt=this.totals)===null||vt===void 0?void 0:vt.column)===null||W===void 0?void 0:W.subTotalsDimensions)===null||O===void 0?void 0:O.length)!==null&&Y!==void 0?Y:0;$<Q;$++){const et=this.totals.column.subTotalsDimensions[$],ot=this.columns.indexOf(et);this.colsIsTotal[ot]=!0}this.setRecords(l)}setRecords(t){var e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b,w,C;this.records=t,this.collectedValues={},this.cacheCollectedValues={},this.totalRecordsTree={},this.tree={},this.colFlatKeys={},this.rowFlatKeys={},this.colKeys=[],this.rowKeys=[],this.rowsHasValue=[],this.columnsHasValue=[],t&&(this.records=t,typeof window<"u"&&window.performance.now(),this.processRecords(),this.processCollectedValuesWithSumBy(),this.generateCollectedValuesSortRule(),this.processCollectedValuesWithSortBy(),typeof window<"u"&&window.performance.now(),typeof window<"u"&&window.performance.now(),this.totalStatistics(),typeof window<"u"&&window.performance.now(),this.rowKeys_normal=this.rowKeys.slice(),this.colKeys_normal=this.colKeys.slice(),typeof window<"u"&&window.performance.now(),this.sortKeys(),typeof window<"u"&&window.performance.now(),typeof window<"u"&&window.performance.now(),this.customRowTree?this.rowHeaderTree=this.customRowTree:this.rowHierarchyType==="tree"?this.rowHeaderTree=this.ArrToTree1(this.rowKeys,this.rows.filter((_,y)=>this.rowsHasValue[y]),this.indicatorsAsCol?void 0:this.indicators,((i=(e=this.totals)===null||e===void 0?void 0:e.row)===null||i===void 0?void 0:i.showGrandTotals)||!this.indicatorsAsCol&&this.columns.length===0||this.indicatorsAsCol&&this.rows.length===0,this.rowGrandTotalLabel):this.rowHeaderTree=this.ArrToTree(this.rowKeys,this.rows.filter((_,y)=>this.rowsHasValue[y]),this.indicatorsAsCol?void 0:this.indicators,this.rowsIsTotal,((r=(o=this.totals)===null||o===void 0?void 0:o.row)===null||r===void 0?void 0:r.showGrandTotals)||this.indicatorsAsCol&&this.rows.length===0,this.rowGrandTotalLabel,this.rowSubTotalLabel,(a=(l=(s=this.totals)===null||s===void 0?void 0:s.row)===null||l===void 0?void 0:l.showGrandTotalsOnTop)!==null&&a!==void 0&&a,(u=(d=(h=this.totals)===null||h===void 0?void 0:h.row)===null||d===void 0?void 0:d.showSubTotalsOnTop)!==null&&u!==void 0&&u),this.customColTree?this.colHeaderTree=this.customColTree:this.colHeaderTree=this.ArrToTree(this.colKeys,this.columns.filter((_,y)=>this.columnsHasValue[y]),this.indicatorsAsCol?this.indicators:void 0,this.colsIsTotal,((g=(c=this.totals)===null||c===void 0?void 0:c.column)===null||g===void 0?void 0:g.showGrandTotals)||!this.indicatorsAsCol&&this.columns.length===0,this.colGrandTotalLabel,this.colSubTotalLabel,(v=(p=(f=this.totals)===null||f===void 0?void 0:f.column)===null||p===void 0?void 0:p.showGrandTotalsOnLeft)!==null&&v!==void 0&&v,(w=(b=(m=this.totals)===null||m===void 0?void 0:m.column)===null||b===void 0?void 0:b.showSubTotalsOnLeft)!==null&&w!==void 0&&w),typeof window<"u"&&window.performance.now(),!((C=this.dataConfig)===null||C===void 0)&&C.isPivotChart&&this.cacheDeminsionCollectedValues())}registerAggregator(t,e){this.aggregators[t]=e}registerAggregators(){this.registerAggregator(Mt.RECORD,wC),this.registerAggregator(Mt.SUM,xC),this.registerAggregator(Mt.COUNT,AC),this.registerAggregator(Mt.MAX,TC),this.registerAggregator(Mt.MIN,MC),this.registerAggregator(Mt.AVG,RC),this.registerAggregator(Mt.NONE,SC),this.registerAggregator(Mt.RECALCULATE,tE)}processCollectedValuesWithSumBy(){var t,e,i,o,r,s;for(const l in this.collectedValues)if(!((e=(t=this.collectValuesBy)===null||t===void 0?void 0:t[l])===null||e===void 0)&&e.sumBy)for(const a in this.collectedValues[l]){let h;((i=this.collectValuesBy[l])===null||i===void 0?void 0:i.extendRange)==="sum"?(h=Object.values(this.collectedValues[l][a]).reduce((g,f)=>g+f.value(),0),h+=Math.round(h/20)):(h=Object.values(this.collectedValues[l][a]).reduce((g,f)=>f.value()>g?f.value():g,Number.MIN_SAFE_INTEGER),((o=this.collectValuesBy[l])===null||o===void 0?void 0:o.extendRange)==="max"?h+=Math.round(h/20):typeof((r=this.collectValuesBy[l])===null||r===void 0?void 0:r.extendRange)=="number"&&(h=Math.max(h,(s=this.collectValuesBy[l])===null||s===void 0?void 0:s.extendRange)));const d=Object.values(this.collectedValues[l][a]).reduce((g,f)=>f.value()<g?f.value():g,Number.MAX_SAFE_INTEGER);let u,c;this.needSplitPositiveAndNegative&&(u=Object.values(this.collectedValues[l][a]).reduce((g,f)=>f.positiveValue()>g?f.positiveValue():g,Number.MIN_SAFE_INTEGER),c=Object.values(this.collectedValues[l][a]).reduce((g,f)=>f.negativeValue()<g?f.negativeValue():g,Number.MAX_SAFE_INTEGER)),this.collectedValues[l][a]={},this.collectedValues[l][a].max=h,this.collectedValues[l][a].min=d,this.needSplitPositiveAndNegative&&(this.collectedValues[l][a].positiveMax=u,this.collectedValues[l][a].negativeMin=c)}}processCollectedValuesWithSortBy(){var t,e;const i=this;for(const o in this.collectedValues)if(!((e=(t=this.collectValuesBy)===null||t===void 0?void 0:t[o])===null||e===void 0)&&e.sortBy)for(const r in this.collectedValues[o])this.collectedValues[o][r]=this.collectedValues[o][r].sort((s,l)=>{var a,h,d,u;return((h=(a=i.collectValuesBy[o].sortBy)===null||a===void 0?void 0:a.indexOf(s))!==null&&h!==void 0?h:-1)-((u=(d=i.collectValuesBy[o].sortBy)===null||d===void 0?void 0:d.indexOf(l))!==null&&u!==void 0?u:-1)})}generateCollectedValuesSortRule(){for(const t in this.collectedValues)if(this.collectValuesBy&&this.collectValuesBy[t]&&!this.collectValuesBy[t].sortBy){let e=[];for(const i in this.collectedValues[t])Array.isArray(this.collectedValues[t][i])&&(e.push(...this.collectedValues[t][i]),e=Array.from(new Set(e)));e.length>0&&(this.collectValuesBy[t].sortBy=e)}}processRecords(){var t,e;let i=!1;if(((e=(t=this.filterRules)===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0)>=1&&(i=!0),Array.isArray(this.records)){this.filteredRecords||(this.filteredRecords=[]);for(let o=0,r=this.records.length;o<r;o++){const s=this.records[o];i&&!this.filterRecord(s)||(this.filteredRecords.push(s),this.processRecord(s))}}else{this.filteredRecords||(this.filteredRecords={});for(const o in this.records)for(let r=0,s=this.records[o].length;r<s;r++){const l=this.records[o][r];i&&!this.filterRecord(l)||(this.filteredRecords[o]||(this.filteredRecords[o]=[]),this.filteredRecords[o].push(l),this.processRecord(l,o))}}this.rowFlatKeys={},this.colFlatKeys={}}filterRecord(t){var e,i;let o=!0;if(this.filterRules)for(let r=0;r<this.filterRules.length;r++){const s=this.filterRules[r];if(s.filterKey){const l=t[s.filterKey];if(((e=s.filteredValues)===null||e===void 0?void 0:e.indexOf(l))===-1){o=!1;break}}else if(!(!((i=s.filterFunc)===null||i===void 0)&&i.call(s,t))){o=!1;break}}return o}processRecord(t,e){var i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b,w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O,Y,$,Q,et,ot,K,at,tt,_t,yt,ut,xt,de,Re,Ge,Qe,$i;(i=this.derivedFieldRules)===null||i===void 0||i.forEach((pt,mt)=>{pt.fieldName&&pt.derivedFunc&&(t[pt.fieldName]=pt.derivedFunc(t))});for(const pt in this.collectValuesBy)if(I(t[pt])){this.collectedValues[pt]||(this.collectedValues[pt]={});const mt=this.collectValuesBy[pt].by.map(It=>t[It]).join(this.stringJoinChar);if(this.collectedValues[pt][mt]||(this.collectValuesBy[pt].sumBy?this.collectedValues[pt][mt]={}:this.collectValuesBy[pt].range?this.collectedValues[pt][mt]={min:Number.MAX_SAFE_INTEGER,max:Number.MIN_SAFE_INTEGER}:this.collectedValues[pt][mt]=[]),this.collectValuesBy[pt].sumBy){const It=this.collectValuesBy[pt].sumBy.map(Vt=>t[Vt]).join(this.stringJoinChar);this.collectedValues[pt][mt][It]||(this.collectedValues[pt][mt][It]=new this.aggregators[Mt.SUM]({key:pt,dimension:pt,isRecord:void 0,needSplitPositiveAndNegative:this.needSplitPositiveAndNegative})),this.collectedValues[pt][mt][It].push(t)}else if(this.collectValuesBy[pt].range){const It=this.collectedValues[pt][mt],Vt=Math.max(t[pt],It.max),se=Math.min(t[pt],It.min);isNaN(Vt)||(It.max=Vt,It.min=se)}else{const It=this.collectedValues[pt][mt];It.indexOf(t[pt])===-1&&It.push(t[pt])}}let si=!1;const ti=[],ue=[];if(!this.parseCustomTreeToMatchRecords||!((o=this.dataConfig)===null||o===void 0)&&o.isPivotChart||!(!((r=this.customRowTree)===null||r===void 0)&&r.length)||e||this.hasExtensionRowTree){const pt=[];ue.push({rowKey:pt,indicatorKey:e});for(let mt=0,It=this.rows.length;mt<It;mt++){const Vt=this.rows[mt];if(Vt in t)this.rowsHasValue[mt]=!0,pt.push(t[Vt]);else if(Vt!==ln){if(!((a=(l=(s=this.dataConfig)===null||s===void 0?void 0:s.totals)===null||l===void 0?void 0:l.row)===null||a===void 0)&&a.showGrandTotals&&mt===0&&!this.rows.find(se=>se in t)){pt.push(this.rowGrandTotalLabel),si=!0;break}if(!((u=(d=(h=this.dataConfig)===null||h===void 0?void 0:h.totals)===null||d===void 0?void 0:d.row)===null||u===void 0)&&u.subTotalsDimensions&&((f=(g=(c=this.dataConfig)===null||c===void 0?void 0:c.totals)===null||g===void 0?void 0:g.row)===null||f===void 0?void 0:f.subTotalsDimensions.indexOf(this.rows[mt-1]))>=0){this.rowHierarchyType==="grid"&&pt.push(this.rowSubTotalLabel),si=!0;break}}}}else{const pt=this.getFieldMatchRowDimensionPaths(t);if(pt.length>0)for(let mt=0,It=pt.length;mt<It;mt++){const Vt=pt[mt],se=[];let zt;for(let At=0,le=Vt.length;At<le;At++)I(Vt[At].indicatorKey)?zt=Vt[At].indicatorKey:se.push(Vt[At].value);ue.push({rowKey:se,indicatorKey:zt})}}if(!this.parseCustomTreeToMatchRecords||!((p=this.dataConfig)===null||p===void 0)&&p.isPivotChart||!(!((v=this.customColTree)===null||v===void 0)&&v.length)||e||this.hasExtensionRowTree){const pt=[];ti.push({colKey:pt,indicatorKey:e});for(let mt=0,It=this.columns.length;mt<It;mt++){const Vt=this.columns[mt];if(Vt in t)this.columnsHasValue[mt]=!0,pt.push(t[Vt]);else if(Vt!==ln){if(!((w=(b=(m=this.dataConfig)===null||m===void 0?void 0:m.totals)===null||b===void 0?void 0:b.column)===null||w===void 0)&&w.showGrandTotals&&mt===0&&!this.columns.find(se=>se in t)){pt.push(this.colGrandTotalLabel),si=!0;break}if(!((y=(_=(C=this.dataConfig)===null||C===void 0?void 0:C.totals)===null||_===void 0?void 0:_.column)===null||y===void 0)&&y.subTotalsDimensions&&((A=(S=(x=this.dataConfig)===null||x===void 0?void 0:x.totals)===null||S===void 0?void 0:S.column)===null||A===void 0?void 0:A.subTotalsDimensions.indexOf(this.columns[mt-1]))>=0){pt.push(this.colSubTotalLabel),si=!0;break}}}}else{const pt=this.getFieldMatchColDimensionPaths(t);if(pt.length>0)for(let mt=0,It=pt.length;mt<It;mt++){const Vt=pt[mt],se=[];let zt;for(let At=0,le=Vt.length;At<le;At++)I(Vt[At].indicatorKey)?zt=Vt[At].indicatorKey:se.push(Vt[At].value);ti.push({colKey:se,indicatorKey:zt})}}for(let pt=0;pt<ue.length;pt++){const mt=ue[pt].rowKey;let It;this.indicatorsAsCol||(It=ue[pt].indicatorKey);for(let Vt=0;Vt<ti.length;Vt++){const se=ti[Vt].colKey;this.indicatorsAsCol&&(It=ti[Vt].indicatorKey);const zt=mt.join(this.stringJoinChar),At=se.join(this.stringJoinChar);if(si){this.totalRecordsTree[zt]||(this.totalRecordsTree[zt]={}),this.totalRecordsTree[zt][At]||(this.totalRecordsTree[zt][At]=[]);const wt=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let Lt=0;Lt<wt.length;Lt++)if(this.calculatedFiledKeys.indexOf(wt[Lt])>=0){const ge=(R=this.calculatedFieldRules)===null||R===void 0?void 0:R.find(Yi=>Yi.key===wt[Lt]);!((M=(T=this.totalRecordsTree[zt])===null||T===void 0?void 0:T[At])===null||M===void 0)&&M[Lt]||(this.totalRecordsTree[zt][At][Lt]=new this.aggregators[Mt.RECALCULATE]({key:wt[Lt],dimension:wt[Lt],isRecord:!0,formatFun:(k=(P=this.indicators)===null||P===void 0?void 0:P.find(Yi=>typeof Yi!="string"&&Yi.indicatorKey===wt[Lt]))===null||k===void 0?void 0:k.format,calculateFun:ge==null?void 0:ge.calculateFun,dependAggregators:this.totalRecordsTree[zt][At],dependIndicatorKeys:ge==null?void 0:ge.dependIndicatorKeys})),wt[Lt]in t&&((H=(B=this.totalRecordsTree[zt])===null||B===void 0?void 0:B[At])===null||H===void 0||H[Lt].push(t))}else{const ge=this.getAggregatorRule(wt[Lt]);!((F=(E=this.totalRecordsTree[zt])===null||E===void 0?void 0:E[At])===null||F===void 0)&&F[Lt]||(this.totalRecordsTree[zt][At][Lt]=new this.aggregators[(L=ge==null?void 0:ge.aggregationType)!==null&&L!==void 0?L:Mt.SUM]({key:wt[Lt],dimension:(z=ge==null?void 0:ge.field)!==null&&z!==void 0?z:wt[Lt],formatFun:(D=ge==null?void 0:ge.formatFun)!==null&&D!==void 0?D:(V=(N=this.indicators)===null||N===void 0?void 0:N.find(Yi=>typeof Yi!="string"&&Yi.indicatorKey===wt[Lt]))===null||V===void 0?void 0:V.format})),wt[Lt]in t&&((U=(G=this.totalRecordsTree[zt])===null||G===void 0?void 0:G[At])===null||U===void 0||U[Lt].push(t))}return}mt.length!==0&&(this.rowFlatKeys[zt]||(this.rowKeys.push(mt),this.rowFlatKeys[zt]=1)),se.length!==0&&(this.colFlatKeys[At]||(this.colKeys.push(se),this.colFlatKeys[At]=1)),this.tree[zt]||(this.tree[zt]={}),!((Z=this.tree[zt])===null||Z===void 0)&&Z[At]||(this.tree[zt][At]=[]);const le=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let wt=0;wt<le.length;wt++)if(this.calculatedFiledKeys.indexOf(le[wt])>=0){const Lt=(q=this.calculatedFieldRules)===null||q===void 0?void 0:q.find(ge=>ge.key===le[wt]);!((rt=(j=this.tree[zt])===null||j===void 0?void 0:j[At])===null||rt===void 0)&&rt[wt]||(this.tree[zt][At][wt]=new this.aggregators[Mt.RECALCULATE]({key:le[wt],dimension:le[wt],isRecord:!0,formatFun:(gt=(ht=this.indicators)===null||ht===void 0?void 0:ht.find(ge=>typeof ge!="string"&&ge.indicatorKey===le[wt]))===null||gt===void 0?void 0:gt.format,calculateFun:Lt==null?void 0:Lt.calculateFun,dependAggregators:this.tree[zt][At],dependIndicatorKeys:Lt==null?void 0:Lt.dependIndicatorKeys})),(W=(vt=this.tree[zt])===null||vt===void 0?void 0:vt[At])===null||W===void 0||W[wt].push(t)}else{const Lt=this.getAggregatorRule(le[wt]);let ge=!1;It?e===It?le[wt]===It&&(ge=!0):le[wt]===It&&le[wt]in t&&(ge=!0):Lt!=null&&Lt.field?typeof(Lt==null?void 0:Lt.field)=="string"?(Lt==null?void 0:Lt.field)in t&&(ge=!0):Lt!=null&&Lt.field.find(Yi=>Yi in t)&&(ge=!0):le[wt]in t&&(ge=!0),!(!((Y=(O=this.tree[zt])===null||O===void 0?void 0:O[At])===null||Y===void 0)&&Y[wt])&&ge&&(this.tree[zt][At][wt]=new this.aggregators[($=Lt==null?void 0:Lt.aggregationType)!==null&&$!==void 0?$:Mt.SUM]({key:le[wt],dimension:(Q=Lt==null?void 0:Lt.field)!==null&&Q!==void 0?Q:le[wt],formatFun:(et=Lt==null?void 0:Lt.formatFun)!==null&&et!==void 0?et:(K=(ot=this.indicators)===null||ot===void 0?void 0:ot.find(Yi=>typeof Yi!="string"&&Yi.indicatorKey===le[wt]))===null||K===void 0?void 0:K.format})),ge&&((tt=(at=this.tree[zt])===null||at===void 0?void 0:at[At])===null||tt===void 0||tt[wt].push(t))}if(this.mappingRules)for(let wt=0;wt<this.indicatorKeys.length;wt++){if(!this.indicatorStatistics[wt]){const Lt=this.getAggregatorRule(this.indicatorKeys[wt]);this.indicatorStatistics[wt]={max:new this.aggregators[Mt.MAX]({key:this.indicatorKeys[wt],dimension:this.indicatorKeys[wt]}),min:new this.aggregators[Mt.MIN]({key:this.indicatorKeys[wt],dimension:this.indicatorKeys[wt]}),total:new this.aggregators[(_t=Lt==null?void 0:Lt.aggregationType)!==null&&_t!==void 0?_t:Mt.SUM]({key:this.indicatorKeys[wt],dimension:(yt=Lt==null?void 0:Lt.field)!==null&&yt!==void 0?yt:this.indicatorKeys[wt],formatFun:(ut=Lt==null?void 0:Lt.formatFun)!==null&&ut!==void 0?ut:(de=(xt=this.indicators)===null||xt===void 0?void 0:xt.find(ge=>typeof ge!="string"&&ge.indicatorKey===this.indicatorKeys[wt]))===null||de===void 0?void 0:de.format})}}this.indicatorStatistics[wt].max.push((Ge=(Re=this.tree[zt])===null||Re===void 0?void 0:Re[At])===null||Ge===void 0?void 0:Ge[wt].value()),this.indicatorStatistics[wt].min.push(($i=(Qe=this.tree[zt])===null||Qe===void 0?void 0:Qe[At])===null||$i===void 0?void 0:$i[wt].value()),this.indicatorStatistics[wt].total.push(t)}}}}updateSortRules(t){var e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b,w;this.sorted=!1,this.sortRules=t,this.sortKeys(),this.customRowTree||(this.rowHierarchyType==="tree"?this.rowHeaderTree=this.ArrToTree1(this.rowKeys,this.rows.filter((C,_)=>this.rowsHasValue[_]),this.indicatorsAsCol?void 0:this.indicators,((i=(e=this.totals)===null||e===void 0?void 0:e.row)===null||i===void 0?void 0:i.showGrandTotals)||!this.indicatorsAsCol&&this.columns.length===0||this.indicatorsAsCol&&this.rows.length===0,this.rowGrandTotalLabel):this.rowHeaderTree=this.ArrToTree(this.rowKeys,this.rows.filter((C,_)=>this.rowsHasValue[_]),this.indicatorsAsCol?void 0:this.indicators,this.rowsIsTotal,((r=(o=this.totals)===null||o===void 0?void 0:o.row)===null||r===void 0?void 0:r.showGrandTotals)||this.indicatorsAsCol&&this.rows.length===0,this.rowGrandTotalLabel,this.rowSubTotalLabel,(a=(l=(s=this.totals)===null||s===void 0?void 0:s.row)===null||l===void 0?void 0:l.showGrandTotalsOnTop)!==null&&a!==void 0&&a,(u=(d=(h=this.totals)===null||h===void 0?void 0:h.row)===null||d===void 0?void 0:d.showSubTotalsOnTop)!==null&&u!==void 0&&u)),this.customColTree||(this.colHeaderTree=this.ArrToTree(this.colKeys,this.columns.filter((C,_)=>this.columnsHasValue[_]),this.indicatorsAsCol?this.indicators:void 0,this.colsIsTotal,((g=(c=this.totals)===null||c===void 0?void 0:c.column)===null||g===void 0?void 0:g.showGrandTotals)||!this.indicatorsAsCol&&this.columns.length===0,this.colGrandTotalLabel,this.colSubTotalLabel,(v=(p=(f=this.totals)===null||f===void 0?void 0:f.column)===null||p===void 0?void 0:p.showGrandTotalsOnLeft)!==null&&v!==void 0&&v,(w=(b=(m=this.totals)===null||m===void 0?void 0:m.column)===null||b===void 0?void 0:b.showSubTotalsOnLeft)!==null&&w!==void 0&&w))}updateFilterRules(t,e=!1){var i,o;if(this.filterRules=t,this.filteredRecords=void 0,e)this.tree={};else for(const r in this.tree)for(const s in this.tree[r])for(let l=0;l<this.tree[r][s].length;l++)(i=this.tree[r][s][l])===null||i===void 0||i.reset();this.collectedValues={},this.processRecords(),this.processCollectedValuesWithSumBy(),this.processCollectedValuesWithSortBy(),this.totalStatistics(),!((o=this.dataConfig)===null||o===void 0)&&o.isPivotChart&&this.cacheDeminsionCollectedValues()}getAggregatorRule(t){var e;return(e=this.aggregationRules)===null||e===void 0?void 0:e.find((i,o)=>t===i.indicatorKey)}getAggregator(t=[],e=[],i,o=!0,r){var s,l,a,h;const d=this.indicatorKeys.indexOf(i);let u,c;typeof t=="string"?u=t:(r&&r.position!=="row"||t.map((f,p)=>{f!==i||I(r==null?void 0:r.index)&&p!==r.index||t.splice(p,1)}),u=a1(t,this.stringJoinChar)),typeof e=="string"?c=e:(r&&r.position!=="col"||e.map((f,p)=>{f!==i||I(r==null?void 0:r.index)&&p!==r.index||e.splice(p,1)}),c=a1(e,this.stringJoinChar));const g=(l=(s=this.tree[u])===null||s===void 0?void 0:s[c])===null||l===void 0?void 0:l[d];if(o&&I((h=(a=this.changedTree[u])===null||a===void 0?void 0:a[c])===null||h===void 0?void 0:h[d])){const f=this.changedTree[u][c][d];return g?{value:()=>f,formatValue:g.formatValue,formatFun:g.formatFun,records:g.records,className:"",recalculate(){},push(){},deleteRecord(){},updateRecord(){},clearCacheValue(){},reset(){}}:{value:()=>f,className:"",push(){},deleteRecord(){},updateRecord(){},recalculate(){},formatValue:()=>f,clearCacheValue(){},reset(){}}}return g||{className:"",push(){},deleteRecord(){},updateRecord(){},recalculate(){},value:()=>null,clearCacheValue(){},reset(){}}}sortKeys(){if(this.colKeys=this.colKeys_normal.slice(),this.rowKeys=this.rowKeys_normal.slice(),!this.sorted){this.sorted=!0,this.rowKeys.sort(this.arrSort(this.rows,!0));const t=this.arrSort(this.columns,!1);this.colKeys.sort(t)}}arrSort(t,e){let i;const o=this,r=function(s){const l=[];for(let a=0,h=t.length;a<h;a++)if(i=t[a],o.sortRules)for(let d=0,u=o.sortRules.length;d<u;d++)o.sortRules[d].sortField===i&&l.push({field:i,fieldIndex:a,sortRule:o.sortRules[d],func:o.getSort(o.sortRules[d],e)});return l}.call(this);return function(s,l){var a,h,d,u;let c,g;for(let f=0;f<r.length;f++){if(g=r[f],(a=g.sortRule)===null||a===void 0?void 0:a.sortByIndicator){let p=s,v=l;g.fieldIndex<t.length-1&&(p=s.slice(0,g.fieldIndex+1),o.rowHierarchyType==="grid"&&e?p.push(o.rowSubTotalLabel):e||p.push(o.colSubTotalLabel),v=l.slice(0,g.fieldIndex+1),o.rowHierarchyType==="grid"&&e?v.push(o.rowSubTotalLabel):e||v.push(o.colSubTotalLabel)),c=g.func(p,v,(h=g.sortRule)===null||h===void 0?void 0:h.sortType)}else c=(d=g.func)===null||d===void 0?void 0:d.call(g,s[g.fieldIndex],l[g.fieldIndex],(u=g.sortRule)===null||u===void 0?void 0:u.sortType);if(c!==0)return c}return 0}}getSort(t,e){const i=this;return t.sortByIndicator?(o,r,s)=>{const l=function(a,h){return i.rowHierarchyType==="grid"&&a.length<i.rows.length&&a[a.length-1]!==i.rowSubTotalLabel&&a[a.length-1]!==i.rowGrandTotalLabel&&a.push(i.rowSubTotalLabel),h.length<i.columns.length&&h[h.length-1]!==i.colSubTotalLabel&&h[h.length-1]!==i.colGrandTotalLabel&&h.push(i.colSubTotalLabel),i.getAggregator(a,h,t.sortByIndicator).value()};return e?Fh(l(o,t.query),l(r,t.query),s):Fh(l(t.query,o),l(t.query,r),s)}:t.sortBy?iE(t.sortBy):t.sortFunc?t.sortFunc:t.sortType?eE:Fh}totalStatistics(){var t,e,i,o,r,s,l,a,h,d,u,c,g,f;const p=this,v=(m,b)=>{var w,C,_,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O,Y,$,Q,et,ot,K,at,tt,_t,yt,ut,xt,de,Re,Ge,Qe,$i,si;if(!((C=(w=this.totalRecordsTree)===null||w===void 0?void 0:w[m])===null||C===void 0)&&C[b])return this.tree[m]||(this.tree[m]={}),void(this.tree[m][b]=(y=(_=this.totalRecordsTree)===null||_===void 0?void 0:_[m])===null||y===void 0?void 0:y[b]);const ti=b.split(this.stringJoinChar);if(!((S=(x=p.totals)===null||x===void 0?void 0:x.column)===null||S===void 0)&&S.subTotalsDimensions&&((T=(R=(A=p.totals)===null||A===void 0?void 0:A.column)===null||R===void 0?void 0:R.subTotalsDimensions)===null||T===void 0?void 0:T.length)>0&&p.totals.column.showSubTotals!==!1)for(let ue=0,pt=(k=(P=(M=p.totals)===null||M===void 0?void 0:M.column)===null||P===void 0?void 0:P.subTotalsDimensions)===null||k===void 0?void 0:k.length;ue<pt;ue++){const mt=p.totals.column.subTotalsDimensions[ue],It=p.columns.indexOf(mt);if(It>=0){const Vt=ti.slice(0,It+1);Vt.push(p.colSubTotalLabel);const se=Vt.join(this.stringJoinChar);if(!((H=(B=this.totalRecordsTree)===null||B===void 0?void 0:B[m])===null||H===void 0)&&H[se])return void(this.tree[m][se]=(F=(E=this.totalRecordsTree)===null||E===void 0?void 0:E[m])===null||F===void 0?void 0:F[se]);this.tree[m][se]||(this.tree[m][se]=[]);const zt=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let At=0;At<zt.length;At++)if(this.calculatedFiledKeys.indexOf(zt[At])>=0){const le=(L=this.calculatedFieldRules)===null||L===void 0?void 0:L.find(wt=>wt.key===zt[At]);!((D=(z=this.tree[m])===null||z===void 0?void 0:z[se])===null||D===void 0)&&D[At]||(this.tree[m][se][At]=new this.aggregators[Mt.RECALCULATE]({key:zt[At],dimension:zt[At],isRecord:!0,formatFun:(V=(N=this.indicators)===null||N===void 0?void 0:N.find(wt=>typeof wt!="string"&&wt.indicatorKey===zt[At]))===null||V===void 0?void 0:V.format,calculateFun:le==null?void 0:le.calculateFun,dependAggregators:this.tree[m][se],dependIndicatorKeys:le==null?void 0:le.dependIndicatorKeys})),se!==b&&this.tree[m][se][At].push((U=(G=p.tree[m])===null||G===void 0?void 0:G[b])===null||U===void 0?void 0:U[At])}else{if(!this.tree[m][se][At]){const le=this.getAggregatorRule(zt[At]);this.tree[m][se][At]=new this.aggregators[(Z=le==null?void 0:le.aggregationType)!==null&&Z!==void 0?Z:Mt.SUM]({key:zt[At],dimension:(q=le==null?void 0:le.field)!==null&&q!==void 0?q:zt[At],formatFun:(j=le==null?void 0:le.formatFun)!==null&&j!==void 0?j:(ht=(rt=this.indicators)===null||rt===void 0?void 0:rt.find(wt=>typeof wt!="string"&&wt.indicatorKey===zt[At]))===null||ht===void 0?void 0:ht.format})}se!==b&&this.tree[m][se][At].push((vt=(gt=p.tree[m])===null||gt===void 0?void 0:gt[b])===null||vt===void 0?void 0:vt[At])}}}if(!((O=(W=p.totals)===null||W===void 0?void 0:W.column)===null||O===void 0)&&O.showGrandTotals||this.rows.length===0){const ue=p.colGrandTotalLabel;if(!(($=(Y=this.totalRecordsTree)===null||Y===void 0?void 0:Y[m])===null||$===void 0)&&$[ue])return void(this.tree[m][ue]=(et=(Q=this.totalRecordsTree)===null||Q===void 0?void 0:Q[m])===null||et===void 0?void 0:et[ue]);this.tree[m][ue]||(this.tree[m][ue]=[]);const pt=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let mt=0;mt<pt.length;mt++)if(this.calculatedFiledKeys.indexOf(pt[mt])>=0){const It=(ot=this.calculatedFieldRules)===null||ot===void 0?void 0:ot.find(Vt=>Vt.key===pt[mt]);!((at=(K=this.tree[m])===null||K===void 0?void 0:K[ue])===null||at===void 0)&&at[mt]||(this.tree[m][ue][mt]=new this.aggregators[Mt.RECALCULATE]({key:pt[mt],dimension:pt[mt],isRecord:!0,formatFun:(_t=(tt=this.indicators)===null||tt===void 0?void 0:tt.find(Vt=>typeof Vt!="string"&&Vt.indicatorKey===pt[mt]))===null||_t===void 0?void 0:_t.format,calculateFun:It==null?void 0:It.calculateFun,dependAggregators:this.tree[m][ue],dependIndicatorKeys:It==null?void 0:It.dependIndicatorKeys})),ue!==b&&this.tree[m][ue][mt].push((ut=(yt=p.tree[m])===null||yt===void 0?void 0:yt[b])===null||ut===void 0?void 0:ut[mt])}else{if(!this.tree[m][ue][mt]){const It=this.getAggregatorRule(pt[mt]);this.tree[m][ue][mt]=new this.aggregators[(xt=It==null?void 0:It.aggregationType)!==null&&xt!==void 0?xt:Mt.SUM]({key:pt[mt],dimension:(de=It==null?void 0:It.field)!==null&&de!==void 0?de:pt[mt],formatFun:(Re=It==null?void 0:It.formatFun)!==null&&Re!==void 0?Re:(Qe=(Ge=this.indicators)===null||Ge===void 0?void 0:Ge.find(Vt=>typeof Vt!="string"&&Vt.indicatorKey===pt[mt]))===null||Qe===void 0?void 0:Qe.format})}ue!==b&&this.tree[m][ue][mt].push((si=($i=p.tree[m])===null||$i===void 0?void 0:$i[b])===null||si===void 0?void 0:si[mt])}}};if(!((e=(t=p==null?void 0:p.totals)===null||t===void 0?void 0:t.column)===null||e===void 0)&&e.subTotalsDimensions&&((r=(o=(i=p==null?void 0:p.totals)===null||i===void 0?void 0:i.column)===null||o===void 0?void 0:o.subTotalsDimensions)===null||r===void 0?void 0:r.length)>=1||!((l=(s=p==null?void 0:p.totals)===null||s===void 0?void 0:s.row)===null||l===void 0)&&l.subTotalsDimensions&&((d=(h=(a=p==null?void 0:p.totals)===null||a===void 0?void 0:a.row)===null||h===void 0?void 0:h.subTotalsDimensions)===null||d===void 0?void 0:d.length)>=1||!((c=(u=p==null?void 0:p.totals)===null||u===void 0?void 0:u.column)===null||c===void 0)&&c.showGrandTotals||!((f=(g=p==null?void 0:p.totals)===null||g===void 0?void 0:g.row)===null||f===void 0)&&f.showGrandTotals){const m=[];Object.keys(p.tree).forEach(b=>{const w=b.split(this.stringJoinChar);Object.keys(p.tree[b]).forEach(C=>{var _,y,x,S,A,R,T,M,P,k,B,H,E,F,L,z,D,N,V,G,U,Z,q,j,rt,ht,gt,vt,W,O;if(!((y=(_=p.totals)===null||_===void 0?void 0:_.row)===null||y===void 0)&&y.subTotalsDimensions&&((A=(S=(x=p.totals)===null||x===void 0?void 0:x.row)===null||S===void 0?void 0:S.subTotalsDimensions)===null||A===void 0?void 0:A.length)>0&&p.totals.row.showSubTotals!==!1)for(let Y=0,$=(M=(T=(R=p.totals)===null||R===void 0?void 0:R.row)===null||T===void 0?void 0:T.subTotalsDimensions)===null||M===void 0?void 0:M.length;Y<$;Y++){const Q=p.totals.row.subTotalsDimensions[Y],et=p.rows.indexOf(Q);if(et>=0&&et<p.rows.length-1){const ot=w.slice(0,et+1);this.rowHierarchyType==="grid"&&ot.push(p.rowSubTotalLabel);const K=ot.join(this.stringJoinChar);this.tree[K]||(this.tree[K]={},m.push(K)),this.tree[K][C]||(this.tree[K][C]=[]);const at=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let tt=0;tt<at.length;tt++){if(!this.tree[K][C][tt])if(this.calculatedFiledKeys.indexOf(at[tt])>=0){const _t=(P=this.calculatedFieldRules)===null||P===void 0?void 0:P.find(yt=>yt.key===at[tt]);this.tree[K][C][tt]=new this.aggregators[Mt.RECALCULATE]({key:at[tt],dimension:at[tt],isRecord:!0,formatFun:(B=(k=this.indicators)===null||k===void 0?void 0:k.find(yt=>typeof yt!="string"&&yt.indicatorKey===at[tt]))===null||B===void 0?void 0:B.format,calculateFun:_t==null?void 0:_t.calculateFun,dependAggregators:this.tree[K][C],dependIndicatorKeys:_t==null?void 0:_t.dependIndicatorKeys})}else{const _t=this.getAggregatorRule(at[tt]);this.tree[K][C][tt]=new this.aggregators[(H=_t==null?void 0:_t.aggregationType)!==null&&H!==void 0?H:Mt.SUM]({key:at[tt],dimension:(E=_t==null?void 0:_t.field)!==null&&E!==void 0?E:at[tt],formatFun:(F=_t==null?void 0:_t.formatFun)!==null&&F!==void 0?F:(z=(L=this.indicators)===null||L===void 0?void 0:L.find(yt=>typeof yt!="string"&&yt.indicatorKey===at[tt]))===null||z===void 0?void 0:z.format})}K!==b&&this.tree[K][C][tt].push((N=(D=p.tree[b])===null||D===void 0?void 0:D[C])===null||N===void 0?void 0:N[tt])}}}if(!((G=(V=p.totals)===null||V===void 0?void 0:V.row)===null||G===void 0)&&G.showGrandTotals||this.columns.length===0){const Y=p.rowGrandTotalLabel;this.tree[Y]||(this.tree[Y]={},m.push(Y)),this.tree[Y][C]||(this.tree[Y][C]=[]);const $=this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;for(let Q=0;Q<$.length;Q++){if(!this.tree[Y][C][Q])if(this.calculatedFiledKeys.indexOf($[Q])>=0){const et=(U=this.calculatedFieldRules)===null||U===void 0?void 0:U.find(ot=>ot.key===$[Q]);this.tree[Y][C][Q]=new this.aggregators[Mt.RECALCULATE]({key:$[Q],dimension:$[Q],isRecord:!0,formatFun:(q=(Z=this.indicators)===null||Z===void 0?void 0:Z.find(ot=>typeof ot!="string"&&ot.indicatorKey===$[Q]))===null||q===void 0?void 0:q.format,calculateFun:et==null?void 0:et.calculateFun,dependAggregators:this.tree[Y][C],dependIndicatorKeys:et==null?void 0:et.dependIndicatorKeys})}else{const et=this.getAggregatorRule($[Q]);this.tree[Y][C][Q]=new this.aggregators[(j=et==null?void 0:et.aggregationType)!==null&&j!==void 0?j:Mt.SUM]({key:$[Q],dimension:(rt=et==null?void 0:et.field)!==null&&rt!==void 0?rt:$[Q],formatFun:(ht=et==null?void 0:et.formatFun)!==null&&ht!==void 0?ht:(vt=(gt=this.indicators)===null||gt===void 0?void 0:gt.find(ot=>typeof ot!="string"&&ot.indicatorKey===$[Q]))===null||vt===void 0?void 0:vt.format})}Y!==b&&this.tree[Y][C][Q].push((O=(W=p.tree[b])===null||W===void 0?void 0:W[C])===null||O===void 0?void 0:O[Q])}}v(b,C)})}),m.forEach(b=>{Object.keys(p.tree[b]).forEach(w=>{v(b,w)})})}for(const m in p.totalRecordsTree)for(const b in p.totalRecordsTree[m])v(m,b)}ArrToTree1(t,e,i,o,r){const s=[],l=this.stringJoinChar,a=new Map;function h(d){const u=[];let c;d.forEach((g,f)=>{var p;u.push(g);const v=u.join(l);let m=a.get(v);m||(m={value:g,dimensionKey:e[f],children:f===d.length-1&&((p=i==null?void 0:i.length)!==null&&p!==void 0?p:0)>=1?i==null?void 0:i.map(b=>typeof b=="string"?{indicatorKey:b,value:b}:{indicatorKey:b.indicatorKey,value:b.title}):[]},a.set(v,m),c?c.children.push(m):s.push(m)),c=m})}return t.forEach(d=>h(d)),o&&h([r]),s}ArrToTree(t,e,i,o,r,s,l,a,h){var d;let u=[];const c=this.stringJoinChar,g=new Map;if(t!=null&&t.length?t.forEach(f=>function(p){const v=[];let m;p.forEach((b,w)=>{var C,_,y,x;v.push(b);const S=v.join(c);let A=g.get(S);if(!A){if(A={value:b,dimensionKey:e[w],children:w===p.length-1&&((C=i==null?void 0:i.length)!==null&&C!==void 0?C:0)>=1?i==null?void 0:i.map(R=>typeof R=="string"?{indicatorKey:R,value:R}:{indicatorKey:R.indicatorKey,value:R.title}):[]},o[w]){let R=(_=A.children)!==null&&_!==void 0?_:[];const T={value:l,dimensionKey:e[w+1],levelSpan:o.length-w-1,children:((y=i==null?void 0:i.length)!==null&&y!==void 0?y:0)>=1?i==null?void 0:i.map(M=>typeof M=="string"?{indicatorKey:M,value:M}:{indicatorKey:M.indicatorKey,value:M.title}):[]};R.push(T),R=(x=T.children)!==null&&x!==void 0?x:[]}g.set(S,A),m?o[w-1]&&!h?m.children.splice(m.children.length-1,0,A):m.children.push(A):u.push(A)}m=A})}(f)):i&&(u=i==null?void 0:i.map(f=>{var p;return typeof f=="string"?{indicatorKey:f,value:f}:{indicatorKey:f.indicatorKey,value:(p=f.title)!==null&&p!==void 0?p:f.indicatorKey}})),r&&(t==null?void 0:t.length)){const f={value:s,dimensionKey:e[0],levelSpan:o.length,children:(d=i==null?void 0:i.map(p=>typeof p=="string"?{indicatorKey:p,value:p}:{indicatorKey:p.indicatorKey,value:p.title}))!==null&&d!==void 0?d:[]};a?u.unshift(f):u.push(f)}return u}cacheDeminsionCollectedValues(){for(const t in this.collectValuesBy)this.collectValuesBy[t].type!=="xField"&&this.collectValuesBy[t].type!=="yField"||(this.dataConfig.dimensionSortArray?this.cacheCollectedValues[t]=Az(this.collectedValues[t],this.dataConfig.dimensionSortArray):this.cacheCollectedValues[t]=this.collectedValues[t])}changeTreeNodeValue(t=[],e=[],i,o){var r,s,l;const a=this.indicatorKeys.indexOf(i);let h,d;h=typeof t=="string"?t:t.join(this.stringJoinChar),d=typeof e=="string"?e:e.join(this.stringJoinChar),!((r=this.changedTree[h])===null||r===void 0)&&r[d]?this.changedTree[h][d][a]=o:this.changedTree[h]?(this.changedTree[h][d]=[],this.changedTree[h][d][a]=o):(this.changedTree[h]={},this.changedTree[h][d]=[],this.changedTree[h][d][a]=o);const u=(l=(s=this.tree[h])===null||s===void 0?void 0:s[d])===null||l===void 0?void 0:l[a];(u==null?void 0:u.records.length)===1&&(u.records[0][this.indicatorKeys[a]]=o)}changeRecordFieldValue(t,e,i){let o=!1;for(let r=0;r<this.indicatorKeys.length;r++)this.indicatorKeys[r]===t&&(o=!0);if(!o){if(Array.isArray(this.records))for(let r=0,s=this.records.length;r<s;r++){const l=this.records[r];l[t]===e&&(l[t]=i)}else for(const r in this.records)for(let s=0,l=this.records[r].length;s<l;s++){const a=this.records[r][s];a[t]===e&&(a[t]=i)}this.rowFlatKeys={},this.colFlatKeys={},this.tree={},this.processRecords()}}_rowTreeHasChanged(){this.hasExtensionRowTree||(this.customRowTreeDimensionPaths=this.customTreeToDimensionPathArr(this.customRowTree,"row"))}changeDataConfig(t){this.rows=t.rows,this.columns=t.columns}addRecords(t){for(let e=0,i=t.length;e<i;e++){const o=t[e];this.processRecord(o)}Array.isArray(this.records)&&this.records.push(t)}customTreeToDimensionPathArr(t,e){const i=[],o=this;function r(s,l){var a,h,d;s.virtual||(!((a=l[l.length-1])===null||a===void 0)&&a.childKeys&&s.dimensionKey&&l[l.length-1].childKeys.indexOf(s.dimensionKey)===-1&&s.dimensionKey!==l[l.length-1].dimensionKey&&l[l.length-1].childKeys.push(s.dimensionKey),l.push({dimensionKey:I(s.indicatorKey)?void 0:s.dimensionKey,value:s.value,indicatorKey:s.indicatorKey,virtual:s.virtual})),((h=s.children)===null||h===void 0?void 0:h.length)>0?(o.rowHierarchyType==="tree"&&e==="row"&&(l[l.length-1].childKeys=[],i.push([...l])),(d=s.children)===null||d===void 0||d.forEach(u=>r(u,[...l]))):i.push(l)}return t==null||t.forEach(s=>r(s,[])),i}getFieldMatchColDimensionPaths(t){var e,i;const o=[];for(let r=0;(i=r<((e=this.customColTreeDimensionPaths)===null||e===void 0?void 0:e.length))!==null&&i!==void 0&&i;r++){const s=this.customColTreeDimensionPaths[r];let l=!0;for(let a=0;a<s.length;a++){const h=s[a];if(h.dimensionKey&&t[h.dimensionKey]!==h.value||h.indicatorKey&&t[h.indicatorKey]===void 0){l=!1;break}}l&&o.push(s)}return o}getFieldMatchRowDimensionPaths(t){var e,i;const o=[];for(let r=0;(i=r<((e=this.customRowTreeDimensionPaths)===null||e===void 0?void 0:e.length))!==null&&i!==void 0&&i;r++){const s=this.customRowTreeDimensionPaths[r];let l=!0;for(let a=0;a<s.length;a++){const h=s[a];if(h.dimensionKey&&t[h.dimensionKey]!==h.value||h.indicatorKey&&t[h.indicatorKey]===void 0){l=!1;break}if(h.childKeys&&a===s.length-1&&h.childKeys.length>0&&h.childKeys.find(d=>I(t[d]))){l=!1;break}}l&&(this.indicatorsAsCol||this.rowHierarchyType!=="tree"||s.find(a=>a.indicatorKey)||(l=!1)),l&&o.push(s)}return o}}function Az(n,t){return n.sort((e,i)=>{const o=t.indexOf(e),r=t.indexOf(i);return o<r?-1:o>r?1:0})}let Rz=class extends NI{constructor(t,e){var i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b;if(Wt.mode==="node"?(e=t,t=null):t instanceof HTMLElement||(e=t,t=t.container?t.container:null),super(t,e),this.layoutNodeId={seqId:0},e){e.layout&&Object.assign(e,e.layout),this.internalProps.columns=Be(e.columns),this.internalProps.rows=Be(e.rows),this.internalProps.indicators=Ld(e.indicators),(i=e.indicators)===null||i===void 0||i.forEach((C,_)=>{typeof C=="object"&&(C!=null&&C.editor)&&(this.internalProps.indicators[_].editor=C.editor)}),this.internalProps.columnTree=!e.indicatorsAsCol||!((o=e.columns)===null||o===void 0)&&o.length||e.columnTree?Be(e.columnTree):[],this.internalProps.rowTree=e.indicatorsAsCol||!((r=e.rows)===null||r===void 0)&&r.length||e.rowTree?Be(e.rowTree):[],this.internalProps.records=e.records,this.pagination=e.pagination,this.internalProps.columnResizeType=(s=e.columnResizeType)!==null&&s!==void 0?s:"column",this.internalProps.rowResizeType=(l=e.rowResizeType)!==null&&l!==void 0?l:"row",this.internalProps.dataConfig=Be(e.dataConfig),this.internalProps.columnWidthConfig=e.columnWidthConfig;const w=this.internalProps.records;if(this.internalProps.recordsIsTwoDimensionalArray=!1,((a=w==null?void 0:w[0])===null||a===void 0?void 0:a.constructor)===Array&&(this.internalProps.recordsIsTwoDimensionalArray=!0),((h=e.customConfig)===null||h===void 0?void 0:h.enableDataAnalysis)===!1){const C=new ci((d=this.internalProps.columnTree)!==null&&d!==void 0?d:[],this.layoutNodeId),_=new ci((u=this.internalProps.rowTree)!==null&&u!==void 0?u:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(c=this.options.rowExpandLevel)!==null&&c!==void 0?c:1:void 0);this.internalProps.layoutMap=new Rl(this,null,C,_),this.internalProps.recordsIsTwoDimensionalArray===!1&&(this.flatDataToObjects=new gf({rows:this.internalProps.layoutMap.fullRowDimensionKeys,columns:this.internalProps.layoutMap.colDimensionKeys,indicators:this.internalProps.layoutMap.indicatorKeys,indicatorsAsCol:this.internalProps.layoutMap.indicatorsAsCol,indicatorDimensionKey:this.internalProps.layoutMap.indicatorDimensionKey},w))}else{const C=Ly(this,e),{rowKeys:_,columnKeys:y,indicatorKeys:x}=C;let{columnDimensionTree:S,rowDimensionTree:A}=C;this.dataset=new h1(this.internalProps.dataConfig,_,y,x,this.internalProps.indicators,(g=e.indicatorsAsCol)===null||g===void 0||g,e.records,e.rowHierarchyType,this.internalProps.columnTree,this.internalProps.rowTree,!1,!!e.extensionRows,!!e.parseCustomTreeToMatchRecords),e.columnTree||(e.indicatorsAsCol!==!1&&(this.dataset.colHeaderTree=$r(this.dataset.colHeaderTree,e.indicators)),S=new ci((f=this.dataset.colHeaderTree)!==null&&f!==void 0?f:[],this.layoutNodeId)),e.rowTree||(e.indicatorsAsCol===!1&&(this.dataset.rowHeaderTree=$r(this.dataset.rowHeaderTree,e.indicators)),A=new ci((p=this.dataset.rowHeaderTree)!==null&&p!==void 0?p:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(v=this.options.rowExpandLevel)!==null&&v!==void 0?v:1:void 0)),this.internalProps.layoutMap=new Rl(this,this.dataset,S,A)}if(this._changePivotSortStateBySortRules(),((b=(m=e.pivotSortState)===null||m===void 0?void 0:m.length)!==null&&b!==void 0?b:0)>0&&(this.pivotSortState=[],this.pivotSortState=e.pivotSortState),Wt.mode!=="node"&&(this.editorManager=new s3(this)),this.refreshHeader(),this.internalProps.useOneRowHeightFillAll=!1,this.stateManager.initCheckedState(w),this.scenegraph.createSceneGraph(),e.title){const C=St.getComponent("title");this.internalProps.title=new C(e.title,this),this.scenegraph.resize()}if(this.options.emptyTip)if(this.internalProps.emptyTip)this.internalProps.emptyTip.resetVisible();else{const C=St.getComponent("emptyTip");this.internalProps.emptyTip=new C(this.options.emptyTip,this),this.internalProps.emptyTip.resetVisible()}setTimeout(()=>{this.fireListeners(J.INITIALIZED,null)},0)}}static get EVENT_TYPE(){return po}isListTable(){return!1}isPivotTable(){return!0}isPivotChart(){return!1}get recordsCount(){var t;return(t=this.records)===null||t===void 0?void 0:t.length}_canResizeColumn(t,e){const i=super._canResizeColumn(t,e);if(i){if(this.internalProps.layoutMap.isSeriesNumber(t,e)&&this.internalProps.rowSeriesNumber.disableColumnResize===!0)return!1;if(!this.internalProps.layoutMap.indicatorsAsCol){const o=this.internalProps.layoutMap.getBody(t,this.columnHeaderLevelCount);if(o!=null&&o.disableColumnResize)return!1}}return i}updateOption(t){var e,i,o,r,s,l,a,h,d,u,c,g,f,p,v,m,b,w;const C=this.internalProps;if(super.updateOption(t),this.layoutNodeId={seqId:0},this.internalProps.columns=Be(t.columns),this.internalProps.rows=Be(t.rows),this.internalProps.indicators=!((e=t.indicators)===null||e===void 0)&&e.length?Ld(t.indicators):[],(i=t.indicators)===null||i===void 0||i.forEach((y,x)=>{typeof y=="object"&&(y!=null&&y.editor)&&(this.internalProps.indicators[x].editor=y.editor)}),this.internalProps.columnTree=!t.indicatorsAsCol||!((o=t.columns)===null||o===void 0)&&o.length||t.columnTree?Be(t.columnTree):[],this.internalProps.rowTree=t.indicatorsAsCol||!((r=t.rows)===null||r===void 0)&&r.length||t.rowTree?Be(t.rowTree):[],t.records&&(this.internalProps.records=t.records),this.stateManager.initCheckedState(this.internalProps.records),this.stateManager.updateDrillState(void 0,void 0,!1,!1,-1,-1),this.pagination=t.pagination,C.columnResizeType=(s=t.columnResizeType)!==null&&s!==void 0?s:"column",C.rowResizeType=(l=t.rowResizeType)!==null&&l!==void 0?l:"row",C.dataConfig=Be(t.dataConfig),this.internalProps.columnWidthConfig=t.columnWidthConfig,(t==null?void 0:t.rowHierarchyType)==="tree"&&this.internalProps.layoutMap.rowHierarchyType==="tree"&&this.internalProps.layoutMap.rowExpandLevel===(t==null?void 0:t.rowExpandLevel)){const y=this.internalProps.layoutMap.rowDimensionTree.tree.children;(a=this.internalProps.rowTree)===null||a===void 0||a.forEach((x,S)=>{const A=y.find(R=>R.dimensionKey===x.dimensionKey&&R.value===x.value);A&&this._syncHierarchyState(A,x)})}const _=this.internalProps.records;if(this.internalProps.recordsIsTwoDimensionalArray=!1,((h=_==null?void 0:_[0])===null||h===void 0?void 0:h.constructor)===Array&&(this.internalProps.recordsIsTwoDimensionalArray=!0),((d=t.customConfig)===null||d===void 0?void 0:d.enableDataAnalysis)===!1){let y,x;t.columnTree&&(y=new ci((u=this.internalProps.columnTree)!==null&&u!==void 0?u:[],this.layoutNodeId)),t.rowTree&&(x=new ci((c=this.internalProps.rowTree)!==null&&c!==void 0?c:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(g=this.options.rowExpandLevel)!==null&&g!==void 0?g:1:void 0)),C.layoutMap=new Rl(this,null,y,x),this.internalProps.recordsIsTwoDimensionalArray===!1&&(this.flatDataToObjects=new gf({rows:C.layoutMap.fullRowDimensionKeys,columns:C.layoutMap.colDimensionKeys,indicators:C.layoutMap.indicatorKeys,indicatorsAsCol:C.layoutMap.indicatorsAsCol,indicatorDimensionKey:C.layoutMap.indicatorDimensionKey},_))}else{const y=Ly(this,t),{rowKeys:x,columnKeys:S,indicatorKeys:A}=y;let{columnDimensionTree:R,rowDimensionTree:T}=y;this.dataset=new h1(C.dataConfig,x,S,A,this.internalProps.indicators,(f=t.indicatorsAsCol)===null||f===void 0||f,_,t.rowHierarchyType,this.internalProps.columnTree,this.internalProps.rowTree,!1,!!t.extensionRows,!!t.parseCustomTreeToMatchRecords),t.columnTree||(t.indicatorsAsCol!==!1&&(this.dataset.colHeaderTree=$r(this.dataset.colHeaderTree,t.indicators)),R=new ci((p=this.dataset.colHeaderTree)!==null&&p!==void 0?p:[],this.layoutNodeId)),t.rowTree||(t.indicatorsAsCol===!1&&(this.dataset.rowHeaderTree=$r(this.dataset.rowHeaderTree,t.indicators)),T=new ci((v=this.dataset.rowHeaderTree)!==null&&v!==void 0?v:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(m=this.options.rowExpandLevel)!==null&&m!==void 0?m:1:void 0)),C.layoutMap=new Rl(this,this.dataset,R,T)}if(this._changePivotSortStateBySortRules(),((w=(b=t.pivotSortState)===null||b===void 0?void 0:b.length)!==null&&w!==void 0?w:0)>0&&(this.pivotSortState=[],this.pivotSortState=t.pivotSortState),this.refreshHeader(),this.internalProps.useOneRowHeightFillAll=!1,C.releaseList&&(C.releaseList.forEach(y=>{var x;return(x=y==null?void 0:y.release)===null||x===void 0?void 0:x.call(y)}),C.releaseList=null),this.scenegraph.clearCells(),this.scenegraph.createSceneGraph(),t.title){const y=St.getComponent("title");this.internalProps.title=new y(t.title,this),this.scenegraph.resize()}if(this.options.emptyTip)if(this.internalProps.emptyTip)this.internalProps.emptyTip.resetVisible();else{const y=St.getComponent("emptyTip");this.internalProps.emptyTip=new y(this.options.emptyTip,this),this.internalProps.emptyTip.resetVisible()}return new Promise(y=>{setTimeout(y,0)})}updatePagination(t){t?(this.pagination||(this.pagination={currentPage:0,perPageCount:0}),typeof t.currentPage=="number"&&t.currentPage>=0&&(this.pagination.currentPage=t.currentPage),t.perPageCount&&(this.pagination.perPageCount=t.perPageCount||this.pagination.perPageCount),this.scenegraph.clearCells(),this.internalProps.layoutMap.setPagination(this.pagination),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render()):this.pagination&&(this.pagination=void 0,this.scenegraph.clearCells(),this.internalProps.layoutMap.setPagination(void 0),this.refreshRowColCount(),this.scenegraph.createSceneGraph(),this.render())}refreshHeader(){this.setMinMaxLimitWidth(!0),this.refreshRowColCount()}refreshRowColCount(){var t,e,i,o,r,s,l,a,h;const d=this,{layoutMap:u}=d.internalProps;u&&(d.colCount=(t=u.colCount)!==null&&t!==void 0?t:0,d.rowCount=(e=u.rowCount)!==null&&e!==void 0?e:0,this.internalProps.frozenColCount=Math.max(((i=u.rowHeaderLevelCount)!==null&&i!==void 0?i:0)+u.leftRowSeriesNumberColumnCount,(o=this.options.frozenColCount)!==null&&o!==void 0?o:0),d.frozenRowCount=Math.max(u.headerLevelCount,(r=this.options.frozenRowCount)!==null&&r!==void 0?r:0),d.bottomFrozenRowCount!==((s=this.options.bottomFrozenRowCount)!==null&&s!==void 0?s:0)&&(d.bottomFrozenRowCount=(l=this.options.bottomFrozenRowCount)!==null&&l!==void 0?l:0),d.rightFrozenColCount!==((a=this.options.rightFrozenColCount)!==null&&a!==void 0?a:0)&&(d.rightFrozenColCount=(h=this.options.rightFrozenColCount)!==null&&h!==void 0?h:0),this.stateManager.setFrozenCol(this.internalProps.frozenColCount))}_getSortFuncFromHeaderOption(t,e,i){}get rowHierarchyType(){return this.internalProps.layoutMap.rowHierarchyType}_syncHierarchyState(t,e){var i,o;t.value===e.value&&t.dimensionKey===e.dimensionKey&&(e.hierarchyState=(i=e.hierarchyState)!==null&&i!==void 0?i:e!=null&&e.children?t.hierarchyState:void 0,(o=e==null?void 0:e.children)===null||o===void 0||o.forEach((r,s)=>{var l;if(!((l=t==null?void 0:t.children)===null||l===void 0)&&l[s]&&r){const a=t.children.find(h=>h.dimensionKey===r.dimensionKey&&h.value===r.value);a&&this._syncHierarchyState(a,r)}}))}getRecordShowIndexByCell(t,e){}getTableIndexByRecordIndex(t){}getTableIndexByField(t){}getCellAddrByFieldRecord(t,e){}getBodyIndexByRow(t){const{layoutMap:e}=this.internalProps;return e.getBodyIndexByRow(t)}getBodyIndexByCol(t){const{layoutMap:e}=this.internalProps;return e.getBodyIndexByCol(t)}getFieldData(t,e,i){var o,r,s;if(!this.internalProps.layoutMap.isHeader(e,i)){if(this.internalProps.recordsIsTwoDimensionalArray){const l=this.getBodyIndexByRow(i),a=this.getBodyIndexByCol(e);return(o=this.records[l])===null||o===void 0?void 0:o[a]}if(this.dataset){const l=this.internalProps.layoutMap.getCellHeaderPaths(e,i);if(l){let a;const h=(r=l.colHeaderPaths)===null||r===void 0?void 0:r.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(a={position:"col",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),d=(s=l.rowHeaderPaths)===null||s===void 0?void 0:s.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(a={position:"row",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),u=this.dataset.getAggregator(d,h,this.internalProps.layoutMap.getIndicatorKey(e,i),!0,a);if(u.records&&u.records.length>=1)return u.records[0][t]}}else if(this.flatDataToObjects){const l=this.internalProps.layoutMap.getCellHeaderPaths(e,i),a=l.colHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),h=l.rowHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),d=this.flatDataToObjects.getTreeNode(h,a,this.internalProps.layoutMap.getBody(e,i).indicatorKey,!1);if(d!=null&&d.record)return d==null?void 0:d.record[t]}}}getCellValue(t,e,i){var o,r,s,l,a,h,d;if(!i){const u=this.getCustomMergeValue(t,e);if(u)return u}if(this.internalProps.layoutMap.isSeriesNumber(t,e)){if(this.internalProps.layoutMap.isSeriesNumberInHeader(t,e)){const{title:c}=this.internalProps.layoutMap.getSeriesNumberHeader(t,e);return c}const{format:u}=this.internalProps.layoutMap.getSeriesNumberBody(t,e);return typeof u=="function"?u(t,e,this):e-this.columnHeaderLevelCount+1}if(this.internalProps.layoutMap.isHeader(t,e)){const{title:u,fieldFormat:c}=this.internalProps.layoutMap.getHeader(t,e);return typeof c=="function"?c(u,t,e,this):u}if(this.internalProps.recordsIsTwoDimensionalArray){const{fieldFormat:u}=this.internalProps.layoutMap.getBody(t,e),c=this.getBodyIndexByRow(e),g=this.getBodyIndexByCol(t),f=(o=this.records[c])===null||o===void 0?void 0:o[g];return typeof u=="function"?u(f,t,e,this):f}if(this.dataset){const u=this.internalProps.layoutMap.getCellHeaderPaths(t,e);let c;const g=(s=(r=u.colHeaderPaths)===null||r===void 0?void 0:r.filter(m=>!m.virtual))===null||s===void 0?void 0:s.map((m,b)=>{var w;return m.indicatorKey&&(c={position:"col",index:b}),(w=m.indicatorKey)!==null&&w!==void 0?w:m.value}),f=(a=(l=u.rowHeaderPaths)===null||l===void 0?void 0:l.filter(m=>!m.virtual))===null||a===void 0?void 0:a.map((m,b)=>{var w;return m.indicatorKey&&(c={position:"row",index:b}),(w=m.indicatorKey)!==null&&w!==void 0?w:m.value}),p=this.dataset.getAggregator(f,g,this.internalProps.layoutMap.getIndicatorKey(t,e),!0,c),{fieldFormat:v}=this.internalProps.layoutMap.getBody(t,e);return p.formatValue?p.formatValue(t,e,this):typeof v=="function"?v(p==null?void 0:p.value(),t,e,this):(h=p==null?void 0:p.value())!==null&&h!==void 0?h:""}if(this.flatDataToObjects){const u=this.internalProps.layoutMap.getCellHeaderPaths(t,e),c=u.colHeaderPaths.map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value}),g=u.rowHeaderPaths.map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value}),f=this.flatDataToObjects.getTreeNode(g,c,this.internalProps.layoutMap.getBody(t,e).indicatorKey),{fieldFormat:p}=this.internalProps.layoutMap.getBody(t,e);return typeof p=="function"?p(f==null?void 0:f.value,t,e,this):(d=f==null?void 0:f.value)!==null&&d!==void 0?d:""}}getCellOriginValue(t,e){var i,o,r;const s=this;if(s.internalProps.layoutMap.isHeader(t,e)){const{title:l}=s.internalProps.layoutMap.getHeader(t,e);return typeof l=="function"?l():l}if(this.internalProps.recordsIsTwoDimensionalArray){const l=this.getBodyIndexByRow(e),a=this.getBodyIndexByCol(t);return(i=this.records[l])===null||i===void 0?void 0:i[a]}if(this.dataset){let l;const a=this.internalProps.layoutMap.getCellHeaderPaths(t,e),h=(o=a.colHeaderPaths)===null||o===void 0?void 0:o.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(l={position:"col",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),d=(r=a.rowHeaderPaths)===null||r===void 0?void 0:r.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(l={position:"row",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),u=this.dataset.getAggregator(d,h,this.internalProps.layoutMap.getIndicatorKey(t,e),!0,l);return u.value?u.value():void 0}if(this.flatDataToObjects){const l=this.internalProps.layoutMap.getCellHeaderPaths(t,e),a=l.colHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),h=l.rowHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),d=this.flatDataToObjects.getTreeNode(h,a,this.internalProps.layoutMap.getBody(t,e).indicatorKey);return d==null?void 0:d.value}}getCellRawValue(t,e){var i,o,r;const s=this;if(s.internalProps.layoutMap.isHeader(t,e)){const{title:l}=s.internalProps.layoutMap.getHeader(t,e);return typeof l=="function"?l():l}if(this.internalProps.recordsIsTwoDimensionalArray){const l=this.getBodyIndexByRow(e),a=this.getBodyIndexByCol(t);return(i=this.records[l])===null||i===void 0?void 0:i[a]}if(this.dataset){let l;const a=this.internalProps.layoutMap.getCellHeaderPaths(t,e),h=(o=a.colHeaderPaths)===null||o===void 0?void 0:o.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(l={position:"col",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),d=(r=a.rowHeaderPaths)===null||r===void 0?void 0:r.filter(c=>!c.virtual).map((c,g)=>{var f;return c.indicatorKey&&(l={position:"row",index:g}),(f=c.indicatorKey)!==null&&f!==void 0?f:c.value}),u=this.dataset.getAggregator(d,h,this.internalProps.layoutMap.getIndicatorKey(t,e),!1,l);return u.value?u.value():void 0}if(this.flatDataToObjects){const l=this.internalProps.layoutMap.getCellHeaderPaths(t,e),a=l.colHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),h=l.rowHeaderPaths.map(u=>{var c;return(c=u.indicatorKey)!==null&&c!==void 0?c:u.value}),d=this.flatDataToObjects.getTreeNode(h,a,this.internalProps.layoutMap.getBody(t,e).indicatorKey,!1);return d==null?void 0:d.value}}getCellOriginRecord(t,e){var i,o,r;if(!this.internalProps.layoutMap.isHeader(t,e)){if(this.internalProps.recordsIsTwoDimensionalArray){const s=this.getBodyIndexByRow(e),l=this.getBodyIndexByCol(t);return(i=this.records[s])===null||i===void 0?void 0:i[l]}if(this.dataset){let s;const l=this.internalProps.layoutMap.getCellHeaderPaths(t,e),a=(o=l.colHeaderPaths)===null||o===void 0?void 0:o.filter(d=>!d.virtual).map((d,u)=>{var c;return d.indicatorKey&&(s={position:"col",index:u}),(c=d.indicatorKey)!==null&&c!==void 0?c:d.value}),h=(r=l.rowHeaderPaths)===null||r===void 0?void 0:r.filter(d=>!d.virtual).map((d,u)=>{var c;return d.indicatorKey&&(s={position:"row",index:u}),(c=d.indicatorKey)!==null&&c!==void 0?c:d.value});return this.dataset.getAggregator(h,a,this.internalProps.layoutMap.getIndicatorKey(t,e),!0,s).records}if(this.flatDataToObjects){const s=this.internalProps.layoutMap.getCellHeaderPaths(t,e),l=s.colHeaderPaths.map(d=>{var u;return(u=d.indicatorKey)!==null&&u!==void 0?u:d.value}),a=s.rowHeaderPaths.map(d=>{var u;return(u=d.indicatorKey)!==null&&u!==void 0?u:d.value}),h=this.flatDataToObjects.getTreeNode(a,l,this.internalProps.layoutMap.getBody(t,e).indicatorKey);return h==null?void 0:h.record}}}getCellRawRecord(t,e){var i,o,r;if(!this.internalProps.layoutMap.isHeader(t,e)){if(this.internalProps.recordsIsTwoDimensionalArray){const s=this.getBodyIndexByRow(e),l=this.getBodyIndexByCol(t);return(i=this.records[s])===null||i===void 0?void 0:i[l]}if(this.dataset){let s;const l=this.internalProps.layoutMap.getCellHeaderPaths(t,e),a=(o=l.colHeaderPaths)===null||o===void 0?void 0:o.filter(d=>!d.virtual).map((d,u)=>{var c;return d.indicatorKey&&(s={position:"col",index:u}),(c=d.indicatorKey)!==null&&c!==void 0?c:d.value}),h=(r=l.rowHeaderPaths)===null||r===void 0?void 0:r.filter(d=>!d.virtual).map((d,u)=>{var c;return d.indicatorKey&&(s={position:"row",index:u}),(c=d.indicatorKey)!==null&&c!==void 0?c:d.value});return this.dataset.getAggregator(h,a,this.internalProps.layoutMap.getIndicatorKey(t,e),!1,s).records}if(this.flatDataToObjects){const s=this.internalProps.layoutMap.getCellHeaderPaths(t,e),l=s.colHeaderPaths.map(d=>{var u;return(u=d.indicatorKey)!==null&&u!==void 0?u:d.value}),a=s.rowHeaderPaths.map(d=>{var u;return(u=d.indicatorKey)!==null&&u!==void 0?u:d.value}),h=this.flatDataToObjects.getTreeNode(a,l,this.internalProps.layoutMap.getBody(t,e).indicatorKey,!1);return h==null?void 0:h.record}}}updateSortRules(t,e,i){this.internalProps.dataConfig?this.internalProps.dataConfig.sortRules=t:this.internalProps.dataConfig={sortRules:t},this.dataset.updateSortRules(t),this._changePivotSortStateBySortRules();const{layoutMap:o}=this.internalProps;o.resetHeaderTree(),this.scenegraph.clearCells(),nt(e)&&nt(i)?(this.isRowHeader(e,i)?(this.setMinMaxLimitWidth(!0),this.internalProps._widthResizedColMap.clear()):this.isCornerHeader(e,i)?o.cornerSetting.titleOnDimension==="column"?(this.setMinMaxLimitWidth(!0),this.internalProps._widthResizedColMap.clear()):o.cornerSetting.titleOnDimension==="row"&&this.internalProps._heightResizedRowMap.clear():this.isColumnHeader(e,i)&&this.internalProps._heightResizedRowMap.clear(),this.refreshRowColCount()):this.refreshHeader(),this.internalProps.useOneRowHeightFillAll=!1,this.scenegraph.createSceneGraph(!0),this.render()}_changePivotSortStateBySortRules(){var t,e,i,o;this.pivotSortState=[];const r=(e=(t=this.internalProps.dataConfig)===null||t===void 0?void 0:t.sortRules)!==null&&e!==void 0?e:[];for(let s=0;s<r.length;s++){const l=r[s],a=[];if(l.sortByIndicator&&l.sortField===(this.dataset.indicatorsAsCol?this.dataset.rows[this.dataset.rows.length-1]:this.dataset.columns[this.dataset.columns.length-1])){for(let d=0;d<l.query.length;d++)a.push({dimensionKey:this.dataset.indicatorsAsCol?this.dataset.columns[d]:this.dataset.rows[d],value:l.query[d]});a.push({indicatorKey:l.sortByIndicator,value:(o=(i=this.internalProps.layoutMap.getIndicatorInfo(l.sortByIndicator))===null||i===void 0?void 0:i.title)!==null&&o!==void 0?o:l.sortByIndicator})}else a.push({dimensionKey:l.sortField,isPivotCorner:!0,value:l.sortField});const h=l.sortType?l.sortType.toUpperCase():"ASC";this.pivotSortState.push({dimensions:a,order:Ve[h]})}}_parseColumnWidthConfig(t){for(let e=0;e<(t==null?void 0:t.length);e++){const i=t[e],o=i.dimensions,r=i.width,s=this.getCellAddressByHeaderPaths(o);s&&!this.internalProps._widthResizedColMap.has(s.col)&&(this._setColWidth(s.col,r),this.internalProps._widthResizedColMap.add(s.col))}}updatePivotSortState(t){this.pivotSortState=t}sort(t,e,i){var o;let r;if(this.isCornerHeader(t,e)){const a=this.getHeaderDefine(t,e);r=[];const h={isPivotCorner:!0,dimensionKey:a.value,value:a.value};r.push(h)}else r=this.isColumnHeader(t,e)?this.getCellHeaderPaths(t,e).colHeaderPaths:this.getCellHeaderPaths(t,e).rowHeaderPaths;const s=r[r.length-1].indicatorKey,l=this.getHeaderDefine(t,e);if(l.sort){if(this.dataset.sortRules){const a={};for(let h=this.dataset.sortRules.length-1;h>=0;h--){const d=this.dataset.sortRules[h];l.dimensionKey&&d.sortField===l.dimensionKey?(a[d.sortField]=d,this.dataset.sortRules.splice(h,1)):s&&d.sortField===(this.dataset.indicatorsAsCol?this.dataset.rows[this.dataset.rows.length-1]:this.dataset.columns[this.dataset.columns.length-1])&&this.dataset.sortRules.splice(h,1)}s?this.dataset.sortRules.push({sortField:this.dataset.indicatorsAsCol?this.dataset.rows[this.dataset.rows.length-1]:this.dataset.columns[this.dataset.columns.length-1],sortType:Ve[i],sortByIndicator:s,query:r.reduce((h,d)=>(d.dimensionKey&&h.push(d.value),h),[])}):this.dataset.sortRules.push(Object.assign((o=a[l.dimensionKey])!==null&&o!==void 0?o:{},{sortField:l.dimensionKey,sortType:Ve[i]}))}else this.dataset.sortRules=s?[{sortField:this.dataset.indicatorsAsCol?this.dataset.rows[this.dataset.rows.length-1]:this.dataset.columns[this.dataset.columns.length-1],sortType:Ve[i],sortByIndicator:s,query:r.reduce((a,h)=>(h.dimensionKey&&a.push(h.value),a),[])}]:[{sortField:l.dimensionKey,sortType:Ve[i]}];this.updateSortRules(this.dataset.sortRules,t,e)}}getPivotSortState(t,e){if(!this.pivotSortState)return;const i=this.getCellRange(t,e);for(let o=0;o<this.pivotSortState.length;o++){const r=this.pivotSortState[o],s=r.dimensions,l=this.getCellAddressByHeaderPaths(s),a=r.order;if(l&&Ti(i,l.col,l.row))return a}}_moveHeaderPosition(t,e){const i=this.getCellRange(t.col,t.row),o=this.getCellRange(e.col,e.row),r=this.internalProps.layoutMap.moveHeaderPosition(t,e);if(r){if(r.moveType==="column"){if(this.internalProps.recordsIsTwoDimensionalArray)for(let s=0;s<this.internalProps.records.length;s++){const l=this.internalProps.records[s].splice(r.sourceIndex-this.rowHeaderLevelCount,r.sourceSize);l.unshift(r.targetIndex-this.rowHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records[s],l)}this.colWidthsMap.exchangeOrder(i.start.col,i.end.col-i.start.col+1,o.start.col,o.end.col-o.start.col+1,r.targetIndex),this.setMinMaxLimitWidth()}else if(r.moveType==="row"){if(this.internalProps.recordsIsTwoDimensionalArray){const s=this.internalProps.records.splice(r.sourceIndex-this.columnHeaderLevelCount,r.sourceSize);s.unshift(r.targetIndex-this.columnHeaderLevelCount,0),Array.prototype.splice.apply(this.internalProps.records,s)}r.targetIndex>r.sourceIndex?this.rowHeightsMap.exchangeOrder(r.sourceIndex,r.sourceSize,r.targetIndex+r.sourceSize-r.targetSize,r.targetSize,r.targetIndex):this.rowHeightsMap.exchangeOrder(r.sourceIndex,r.sourceSize,r.targetIndex,r.targetSize,r.targetIndex)}return r}return null}toggleHierarchyState(t,e,i=!0){const o=this.getHierarchyState(t,e);if(o===Pt.expand)this._refreshHierarchyState(t,e,i),this.fireListeners(po.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Pt.collapse});else if(o===Pt.collapse){const r=this.internalProps.layoutMap.getHeadNode(t,e);Array.isArray(r.children)&&this._refreshHierarchyState(t,e,i),this.fireListeners(po.TREE_HIERARCHY_STATE_CHANGE,{col:t,row:e,hierarchyState:Pt.expand,originData:r})}}_refreshHierarchyState(t,e,i=!0,o){let r=!1,s=!1;this.stateManager.updateHoverIcon(t,e,void 0,void 0);const l=this.internalProps.layoutMap.checkHasChart();l&&(this.autoFillWidth&&(r=this.getAllColsWidth()<=this.tableNoFrameWidth),this.autoFillHeight&&(s=this.getAllRowsHeight()<=this.tableNoFrameHeight));const a=this.internalProps.layoutMap.toggleHierarchyState(t,e);o&&o(),this.refreshRowColCount(),this.clearCellStyleCache(),this.scenegraph.updateHierarchyIcon(t,e),this.scenegraph.updateRow(a.removeCellPositions,a.addCellPositions,a.updateCellPositions,i),l&&(this.autoFillWidth&&!r&&(r=this.getAllColsWidth()<=this.tableNoFrameWidth),this.autoFillHeight&&!s&&(s=this.getAllRowsHeight()<=this.tableNoFrameHeight),(this.widthMode==="adaptive"||r||this.heightMode==="adaptive"||s)&&this.scenegraph.updateChartSizeForResizeColWidth(-1))}getHeaderCellAddressByPath(t){return this.internalProps.layoutMap.getPivotCellAdress(t)}getCellAddressByHeaderPaths(t){return this.internalProps.layoutMap.getCellAdressByHeaderPath(t)}getHeaderPathByXY(t){let e;return e=t?this.getCellAt(t.x+this.getFrozenColsWidth()+this.scrollLeft+1,t.y+this.getFrozenRowsHeight()+this.scrollTop+1):this.getCellAt(this.getFrozenColsWidth()+this.scrollLeft+1,this.getFrozenRowsHeight()+this.scrollTop+1),this.internalProps.layoutMap.getCellHeaderPaths(e.col,e.row)}getHierarchyState(t,e){var i;return(i=this._getHeaderLayoutMap(t,e))===null||i===void 0?void 0:i.hierarchyState}getLayoutColumnTree(){return this.internalProps.layoutMap.getLayoutColumnTree()}getLayoutColumnTreeCount(){return this.internalProps.layoutMap.getLayoutColumnTreeCount()}getLayoutRowTree(){return this.internalProps.layoutMap.getLayoutRowTree()}getLayoutRowTreeCount(){return this.internalProps.layoutMap.getLayoutRowTreeCount()}getCellHeaderTreeNodes(t,e){return this.internalProps.layoutMap.getCellHeaderPathsWithTreeNode(t,e)}_hasHierarchyTreeHeader(){return this.internalProps.layoutMap.rowHierarchyType==="tree"}getMenuInfo(t,e,i){const o=this.internalProps.layoutMap.getPivotDimensionInfo(t,e);return{dimensionKey:o[o.length-1].dimensionKey,value:this.getCellValue(t,e),cellLocation:this.getCellLocation(t,e),isPivotCorner:this.isCornerHeader(t,e),event:void 0}}setRecords(t){var e,i,o,r,s;const l={col:this.stateManager.hover.cellPos.col,row:this.stateManager.hover.cellPos.row};this.options.records=this.internalProps.records=t,this.internalProps.recordsIsTwoDimensionalArray=!1,((e=t==null?void 0:t[0])===null||e===void 0?void 0:e.constructor)===Array&&(this.internalProps.recordsIsTwoDimensionalArray=!0);const a=this.options,h=this.internalProps;if(((i=this.options.customConfig)===null||i===void 0?void 0:i.enableDataAnalysis)===!1)this.internalProps.recordsIsTwoDimensionalArray===!1&&(this.flatDataToObjects=new gf({rows:h.layoutMap.fullRowDimensionKeys,columns:h.layoutMap.colDimensionKeys,indicators:h.layoutMap.indicatorKeys,indicatorsAsCol:h.layoutMap.indicatorsAsCol,indicatorDimensionKey:h.layoutMap.indicatorDimensionKey},t));else{let d,u;this.dataset.setRecords(t),d=a.columnTree?h.layoutMap.columnDimensionTree:new ci((o=this.dataset.colHeaderTree)!==null&&o!==void 0?o:[],this.layoutNodeId),u=a.rowTree?h.layoutMap.rowDimensionTree:new ci((r=this.dataset.rowHeaderTree)!==null&&r!==void 0?r:[],this.layoutNodeId,this.options.rowHierarchyType,this.options.rowHierarchyType==="tree"?(s=this.options.rowExpandLevel)!==null&&s!==void 0?s:1:void 0),h.layoutMap=new Rl(this,this.dataset,d,u),this.pivotSortState=[],a.pivotSortState&&(this.pivotSortState=a.pivotSortState)}if(this.refreshHeader(),this.internalProps.useOneRowHeightFillAll=!1,this.scenegraph.clearCells(),this.clearCellStyleCache(),this.scenegraph.createSceneGraph(),this.stateManager.updateHoverPos(l.col,l.row),this.internalProps.title&&!this.internalProps.title.isReleased&&(this._updateSize(),this.internalProps.title.resize(),this.scenegraph.resize()),this.eventManager.updateEventBinder(),this.options.emptyTip)if(this.internalProps.emptyTip)this.internalProps.emptyTip.resetVisible();else{const d=St.getComponent("emptyTip");this.internalProps.emptyTip=new d(this.options.emptyTip,this),this.internalProps.emptyTip.resetVisible()}}startEditCell(t,e,i){var o;if(I(t)&&I(e))this.eventManager.isDraging=!1,this.selectCell(t,e),this.editorManager.startEditCell(t,e,i);else if(!((o=this.stateManager.select)===null||o===void 0)&&o.cellPos){const{col:r,row:s}=this.stateManager.select.cellPos;I(r)&&I(s)&&this.editorManager.startEditCell(r,s,i)}}completeEditCell(){this.editorManager.completeEdit()}getEditor(t,e){var i,o,r;let s;if(this.isCornerHeader(t,e)){const l=this.getHeaderDefine(t,e);s=(i=l==null?void 0:l.headerEditor)!==null&&i!==void 0?i:this.options.headerEditor}else if(this.isHeader(t,e)){const l=this.getHeaderDefine(t,e);s=(o=l==null?void 0:l.headerEditor)!==null&&o!==void 0?o:this.options.headerEditor}else{const l=this.getBodyColumnDefine(t,e);s=(r=l==null?void 0:l.editor)!==null&&r!==void 0?r:this.options.editor}return typeof s=="function"&&(s=s({col:t,row:e,dataValue:this.getCellOriginValue(t,e),value:this.getCellValue(t,e)||"",table:this})),typeof s=="string"?jI(s):s}isHasEditorDefine(t,e){var i;const o=this.getBodyColumnDefine(t,e);let r=(i=o==null?void 0:o.editor)!==null&&i!==void 0?i:this.options.editor;return typeof r=="function"&&(r=r({col:t,row:e,dataValue:this.getCellOriginValue(t,e),value:this.getCellValue(t,e)||"",table:this})),I(r)}changeCellValue(t,e,i,o=!1){if(o&&this.isHasEditorDefine(t,e)||o===!1){let r=i;const s=this.getCellOriginValue(t,e),l=this.getCellRawValue(t,e);typeof l=="number"&&ug(i)&&(r=parseFloat(i)),this._changeCellValueToDataSet(t,e,s,r);const a=this.getCellRange(t,e);for(let h=a.start.col;h<=a.end.col;h++)for(let d=a.start.row;d<=a.end.row;d++)this.scenegraph.updateCellContent(h,d);if(this.widthMode==="adaptive"||this.autoFillWidth&&this.getAllColsWidth()<=this.tableNoFrameWidth)this.internalProps._widthResizedColMap.size===0&&this.scenegraph.recalculateColWidths();else if(!this.internalProps._widthResizedColMap.has(t)){const h=this.getColWidth(t),d=Gr(t,0,this.rowCount-1,this,!1);d!==h&&this.scenegraph.updateColWidth(t,d-h)}if(this.heightMode==="adaptive"||this.autoFillHeight&&this.getAllRowsHeight()<=this.tableNoFrameHeight)this.internalProps._heightResizedRowMap.size===0&&this.scenegraph.recalculateRowHeights();else if(this.heightMode==="autoHeight"&&!this.internalProps._heightResizedRowMap.has(e)){const h=this.getRowHeight(e),d=dn(e,0,this.colCount-1,this);this.scenegraph.updateRowHeight(e,d-h)}this.fireListeners(J.CHANGE_CELL_VALUE,{col:t,row:e,rawValue:l,currentValue:s,changedValue:r}),this.scenegraph.updateNextFrame()}}changeCellValues(t,e,i,o=!1){let r=t,s=e;const l=[],a=[];for(let u=0;u<i.length&&!(e+u>this.rowCount-1);u++){const c=i[u],g=[],f=[];l.push(g),a.push(f);for(let p=0;p<c.length&&!(t+p>this.colCount-1);p++){const v=this.getCellRawValue(t+p,e+u);g.push(v);const m=this.getCellOriginValue(t+p,e+u);f.push(m)}}for(let u=0;u<i.length&&!(e+u>this.rowCount-1);u++){s=e+u;const c=i[u];let g=t;for(let f=0;f<c.length&&!(t+f>this.colCount-1);f++)if(g=t+f,o&&this.isHasEditorDefine(t+f,e+u)||o===!1){const p=c[f];let v=p;const m=a[u][f],b=l[u][f];typeof b=="number"&&ug(p)&&(v=parseFloat(p)),this._changeCellValueToDataSet(t+f,e+u,m,v),this.fireListeners(J.CHANGE_CELL_VALUE,{col:t+f,row:e+u,rawValue:b,currentValue:m,changedValue:this.getCellOriginValue(t+f,e+u)})}r=Math.max(r,g)}const h=this.getCellRange(t,e),d=this.getCellRange(r,s);for(let u=h.start.col;u<=d.end.col;u++)for(let c=h.start.row;c<=d.end.row;c++)this.scenegraph.updateCellContent(u,c);if(this.widthMode==="adaptive"||this.autoFillWidth&&this.getAllColsWidth()<=this.tableNoFrameWidth)this.internalProps._widthResizedColMap.size===0&&this.scenegraph.recalculateColWidths();else for(let u=t;u<=d.end.col;u++)if(!this.internalProps._widthResizedColMap.has(u)){const c=this.getColWidth(u),g=Gr(u,0,this.rowCount-1,this,!1);g!==c&&this.scenegraph.updateColWidth(u,g-c)}if(this.heightMode==="adaptive"||this.autoFillHeight&&this.getAllRowsHeight()<=this.tableNoFrameHeight)this.scenegraph.recalculateRowHeights();else if(this.heightMode==="autoHeight"){const u=[],c=[];for(let g=e;g<=d.end.row;g++)if(this.rowHeightsMap.get(g)){const f=this.getRowHeight(g),p=dn(g,0,this.colCount-1,this);u.push(g),c.push(p-f)}this.scenegraph.updateRowsHeight(u,c)}this.scenegraph.updateNextFrame()}_changeCellValueToDataSet(t,e,i,o){var r,s,l,a,h,d,u,c;if(this.internalProps.recordsIsTwoDimensionalArray){const g=this.getBodyIndexByRow(e),f=this.getBodyIndexByCol(t);this.records[g][f]=o}else if(this.dataset){const g=this.internalProps.layoutMap.getCellHeaderPaths(t,e);if(this.isCornerHeader(t,e))this.internalProps.layoutMap.changeCornerTitle(t,e,o);else if(this.isHeader(t,e))this.internalProps.layoutMap.changeTreeNodeTitle(t,e,o),!this.isCornerHeader(t,e)&&this.dataset.changeRecordFieldValue(!((r=g.colHeaderPaths)===null||r===void 0)&&r.length?(s=g.colHeaderPaths[g.colHeaderPaths.length-1].indicatorKey)!==null&&s!==void 0?s:g.colHeaderPaths[g.colHeaderPaths.length-1].dimensionKey:(l=g.rowHeaderPaths[g.rowHeaderPaths.length-1].indicatorKey)!==null&&l!==void 0?l:g.rowHeaderPaths[g.rowHeaderPaths.length-1].dimensionKey,i,o);else{const f=(a=g.colHeaderPaths)===null||a===void 0?void 0:a.filter(v=>!v.virtual).map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value}),p=(h=g.rowHeaderPaths)===null||h===void 0?void 0:h.filter(v=>!v.virtual).map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value});this.dataset.changeTreeNodeValue(this.internalProps.layoutMap.indicatorsAsCol?p:p.slice(0,-1),this.internalProps.layoutMap.indicatorsAsCol?f.slice(0,-1):f,this.internalProps.layoutMap.getIndicatorKey(t,e),o)}}else if(this.flatDataToObjects){const g=this.internalProps.layoutMap.getCellHeaderPaths(t,e);if(this.isHeader(t,e))this.internalProps.layoutMap.changeTreeNodeTitle(t,e,o),!this.isCornerHeader(t,e)&&this.flatDataToObjects.changeRecordFieldValue(!((d=g.colHeaderPaths)===null||d===void 0)&&d.length?(u=g.colHeaderPaths[g.colHeaderPaths.length-1].indicatorKey)!==null&&u!==void 0?u:g.colHeaderPaths[g.colHeaderPaths.length-1].dimensionKey:(c=g.rowHeaderPaths[g.rowHeaderPaths.length-1].indicatorKey)!==null&&c!==void 0?c:g.rowHeaderPaths[g.rowHeaderPaths.length-1].dimensionKey,i,o);else{const f=g.colHeaderPaths.map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value}),p=g.rowHeaderPaths.map(v=>{var m;return(m=v.indicatorKey)!==null&&m!==void 0?m:v.value});this.flatDataToObjects.changeTreeNodeValue(p,f,this.internalProps.layoutMap.getBody(t,e).indicatorKey,o)}}}_hasCustomRenderOrLayout(){if(this.options.customRender)return!0;const{columnsDefine:t,rowsDefine:e,indicatorsDefine:i}=this.internalProps.layoutMap;for(let o=0;o<t.length;o++){const r=t[o];if(typeof r!="string"&&(r.headerCustomLayout||r.headerCustomRender))return!0}for(let o=0;o<e.length;o++){const r=e[o];if(typeof r!="string"&&(r.headerCustomLayout||r.headerCustomRender))return!0}for(let o=0;o<i.length;o++){const r=i[o];if(typeof r!="string"&&(r.customLayout||r.headerCustomLayout||r.customRender||r.headerCustomRender))return!0}return!1}changeRecordOrder(t,e){}setTreeNodeChildren(t,e,i,o){this.flatDataToObjects?(this.internalProps.layoutMap.getHeadNode(i,o).children=t,this._refreshHierarchyState(i,o,!0,()=>{this.flatDataToObjects.changeDataConfig({rows:this.internalProps.layoutMap.fullRowDimensionKeys,columns:this.internalProps.layoutMap.colDimensionKeys,indicators:this.internalProps.layoutMap.indicatorKeys,indicatorsAsCol:this.internalProps.layoutMap.indicatorsAsCol,indicatorDimensionKey:this.internalProps.layoutMap.indicatorDimensionKey}),this.flatDataToObjects.addRecords(e)})):(this.internalProps.layoutMap.getHeadNode(i,o).children=t,this._refreshHierarchyState(i,o,!0,()=>{this.dataset._rowTreeHasChanged(),this.dataset.changeDataConfig({rows:this.internalProps.layoutMap.fullRowDimensionKeys,columns:this.internalProps.layoutMap.colDimensionKeys}),this.dataset.addRecords(e)}))}updateFilterRules(t){this.internalProps.dataConfig.filterRules=t,this.dataset.updateFilterRules(t),this.renderWithRecreateCells()}getFilteredRecords(){var t;return(t=this.dataset)===null||t===void 0?void 0:t.filterRules}};Y3(),X3(),q3(),Z3(),J3(),Q3(),pz(),vz(),mz(),bz(),Cz(),_z(),yz(),wz();class Tz extends Rz{}const Mz=ft.defineComponent({name:"PivotTable",components:{},props:{id:String,name:String,keyName:String,type:String,width:String,height:String,position:String,top:String,left:String,zIndex:Number,events:{type:Array,default:()=>[]},dataType:String,graphicConfig:Object,data:{type:Array,default:()=>[]},scale:Number,dimensionList:{type:Array,default:()=>[]},indicatorList:{type:Array,default:()=>[]},pageMode:String},setup(n,{expose:t}){const e=ft.ref(),i=ft.ref(""),o=ft.ref({}),r=ft.ref(),s=ft.ref({}),l=ft.ref({}),a=ft.ref(),h=ft.ref(),d=ft.ref({}),u=ft.ref(),c=ft.ref(),g=ft.ref(),f=ft.ref(),p=ft.ref(),v=ft.ref(),m={sqz:"上期值",tqz:"同期值",zje:"增减额",hb:"环比(%)",tb:"同比(%)",zb:"占比(%)"},b=[{text:"度量属性",menuKey:"property"},{text:"条件属性",menuKey:"conditionalProperty"},{text:"图形",menuKey:"graph"},{text:"筛选",menuKey:"filter"},{text:"排序",children:[{text:"升序",menuKey:"asc"},{text:"降序",menuKey:"desc"},{text:"默认",menuKey:"default-sort"}],menuKey:"sort"},{text:"删除",menuKey:"delete"}],w={SUM:"合计",AVG:"平均值",COUNT:"计数",MAX:"Max",MIN:"最小值",VAR:"方差",STDEV:"标准差"},C=ft.reactive({records:[],columnHeaderTitle:!0,excelOptions:{fillHandle:!0},rows:[],columns:[],indicators:[],corner:{titleOnDimension:"row",headerStyle:{textStick:!0}},dataConfig:{sortRules:[],filterRules:[]},widthMode:"standard",menu:{renderMode:"html",dropDownMenuHighlight:[]}}),_=ft.ref([]);function y(W,O=!0,Y=-1){if(Y>-1)C.indicators.splice(Y,0,...W);else for(const $ of W)C.indicators.push($);O&&ft.unref(e).updateOption(C)}function x(W="",O=[]){const Y=[],$=Object.keys(m),Q=$.map(et=>`${W}-${et}`);return O.forEach(et=>{let ot=et;typeof et=="object"&&(ot=et.indicatorKey);const K=Q.indexOf(ot);K>-1&&$.splice(K,1)}),$.forEach(et=>{Y.push({text:m[et],menuKey:et})}),[{text:"计算",menuKey:"calculate",children:Y},...b]}function S(){const W=C.rows.map(Y=>Y.dimensionKey),O=C.columns.map(Y=>Y.dimensionKey);return W.concat(O)}function A(){const W=[{text:"升序",menuKey:"asc"},{text:"降序",menuKey:"desc"},{text:"行列互换",menuKey:"trans"},{text:"筛选",menuKey:"filter"},{text:"聚合",menuKey:"aggregate"},{text:"取top",menuKey:"top"},{text:"钻取",menuKey:"drill"},{text:"删除",menuKey:"delete"}],O=[],Y=S(),$=ft.unref(_).filter(Q=>!Y.includes(Q));if($!=null&&$.length)for(const Q of $)O.push({text:Q,menuKey:Q});return W[6].children=O,W}function R(W){var Y,$;if(!W){(Y=C.aggregate)!=null&&Y.type&&(C.records.splice(-C.aggregate.len),C.aggregate={});return}const O=ft.unref(e).getAllBodyCells();if(O.length>0&&O[0][0]){let Q=O.length;($=C.aggregate)!=null&&$.type&&C.aggregate.len&&(Q=O.length-1,C.records.splice(-C.aggregate.len));const et=O[0].length;console.log(O[0][0]);const{rowHeaderPaths:ot}=O[0][0].cellHeaderPaths,K={};ot.forEach(tt=>{K[tt.dimensionKey]=w[W]});const at=[];for(let tt=0;tt<et;tt++){const{colHeaderPaths:_t}=O[0][tt].cellHeaderPaths,yt=O[0][tt].field,ut={};_t.forEach(Re=>{Re.dimensionKey&&(ut[Re.dimensionKey]=Re.value)});let xt=0;const de=[];if(W!=="COUNT"){let Re=0;for(let Ge=0;Ge<Q;Ge++){const Qe=O[Ge][tt].dataValue;Re+=Qe,de.push(Qe)}if(W==="SUM")xt=Re;else if(W==="AVG")xt=Re/Q;else if(W==="MAX")xt=Math.max(...de);else if(W==="MIN")xt=Math.min(...de);else if(W==="VAR"||W==="STDEV"){const Ge=Re/Q;de.forEach(Qe=>{xt+=Math.pow(Qe-Ge,2)}),xt=xt/(Q-1),W==="STDEV"&&(xt=Math.sqrt(xt))}}else xt=Q;at.push({...K,...ut,[yt]:xt})}C.aggregate={type:W,len:at.length,rowPathObj:K},C.records=[...C.records,...at]}ft.unref(e).updateOption(C)}function T(W,O=!0){var Y,$,Q,et;for(const ot of W){const{key:K,name:at,type:tt}=ot,_t=n.dimensionList.find(yt=>yt.key===K);if(C[tt].push({dimensionKey:K,title:at,width:_t!=null&&_t.width?`${_t.width}%`:"auto"}),(Y=C[tt])!=null&&Y.length)for(const yt of C[tt])yt.cornerDropDownMenu=A();C.dataConfig.sortRules.push({sortField:K,sortType:ft.unref(i)})}O&&(ft.unref(e).updateOption(C),($=C.aggregate)!=null&&$.type&&((Q=C.aggregate)==null?void 0:Q.type)!=="SUM"&&R((et=C.aggregate)==null?void 0:et.type)),ft.nextTick(()=>{P()})}function M(W){const O={},Y=C.records;for(const $ of Y)for(const Q of W)yf(O,Q)?O[Q].find(et=>et.value===$[Q])||O[Q].push({value:$[Q]}):O[Q]=[{value:$[Q]}];return O}function P(){console.log("unref(tableInstance)",ft.unref(e));const{dataset:{columns:W,rows:O}}=ft.unref(e),Y=O.concat(W);o.value=M(Y)}const k=W=>{const{data:{rows:O}}=(W==null?void 0:W.data)||{};console.log("rows",O),C.records=O;const{queryColumnList:Y=[],indicators:$=[]}=n.graphicConfig||{},Q=x(),et=[],ot=[];for(const K of Y){if(!K.show)continue;const at=n.dimensionList.find(tt=>tt.key===K.label);_.value.push(K.label),ot.push({key:K.label,name:K.label,type:(at==null?void 0:at.position)||"rows"})}for(const K of $){if(!K.show)continue;const at=n.indicatorList.find(tt=>tt.key===K.label);et.push({indicatorKey:K.label,title:K.label,width:at!=null&&at.width?`${at.width}%`:"auto",showSort:!1,headerStyle:{fontWeight:"normal"},style:{padding:[16,28,16,28],bgColor(tt){var yt,ut;const _t=tt.cellHeaderPaths.rowHeaderPaths;if(((yt=_t==null?void 0:_t[1])==null?void 0:yt.value)==="Sub Totals")return"#ba54ba";if(((ut=_t==null?void 0:_t[0])==null?void 0:ut.value)==="Row Totals")return"#ff9900"}},dropDownMenu:Q})}if(C.indicators=[],C.rows=[],C.columns=[],y(et,!1),T(ot,!1),ft.unref(e))ft.unref(e).updateOption(C);else{const K=document.getElementById(`pivotTableContainer_${n.id}`);e.value=new Tz(K,C),ht()}};function B(W){const{aggregate:O}=C;if(O!=null&&O.type&&(O!=null&&O.len)){const Y=O.rowPathObj||{};for(const $ in Y)if(W[$]===Y[$])return!0}}function H(){if(ft.unref(e)){const{dataset:{rows:W}}=ft.unref(e),O={};for(const Y of W)O[Y]="";ft.unref(e).updateOption({...C,dataConfig:{...C.dataConfig,filterRules:[]},records:[O]})}}function E(){var $;const{type:W,len:O}=C.aggregate||{};W&&(C.records.splice(-O),C.aggregate={type:W,len:0});const Y=[];if(Object.keys(s.value))for(const Q in s.value)Y.push({filterFunc:et=>{const ot=B(et);return ot||ft.unref(s)[Q].includes(et[Q])}});C.dataConfig.filterRules=Y,ft.unref(e).updateOption(C),($=C.aggregate)!=null&&$.type&&R(C.aggregate.type),ft.nextTick(()=>{const{dataset:{rowHeaderTree:Q}}=ft.unref(e);Q!=null&&Q.length||H()})}function F(W,O){var Q,et,ot;const Y=C[O].findIndex(K=>K.dimensionKey===W),$=C.dataConfig.sortRules.findIndex(K=>K.sortField===W);if(Y!==-1){C[O].splice(Y,1);for(const K of C[O])K.cornerDropDownMenu=A()}$!==-1&&(C.dataConfig.sortRules[$].sortType=i),ft.unref(e).updateOption(C),(Q=C.aggregate)!=null&&Q.type&&((et=C.aggregate)==null?void 0:et.type)!=="SUM"&&R((ot=C.aggregate)==null?void 0:ot.type),ft.nextTick(()=>{P(),delete s.value[W],E()})}function L(W){const{indicators:O}=C,Y=O.findIndex($=>$.indicatorKey===W);if(Y!==-1){const $=O[Y];if(O.splice(Y,1),$.calculateType){const Q=$.indicatorKey.split("-"+$.calculateType)[0],et=O.findIndex(ot=>ot.indicatorKey===Q);O[et].dropDownMenu=x(Q,O)}}ft.unref(e).updateOption(C)}function z(W,O,Y,$){var _t;let{dataConfig:{sortRules:Q},menu:{dropDownMenuHighlight:et}}=C;const ot=ft.unref(e).getAllCells();$=$+1;let K=[];const at=(_t=C.aggregate)!=null&&_t.type?ot.length-1:ot.length;for(let yt=$;yt<at;yt++){const{cellLocation:ut,dataValue:xt}=ot[yt][Y];ut==="rowHeader"&&K.push(xt)}W==="asc"?K=K.sort((yt,ut)=>yt.localeCompare(ut)):W==="desc"&&(K=K.sort((yt,ut)=>ut.localeCompare(yt)));const tt={sortField:O,sortBy:K};Q=Q.filter(yt=>yt.sortField!==O),Q.push(tt),C.dataConfig.sortRules=Q,et=et.filter(yt=>!(yt.type==="dimension"&&yt.field===O)||yt.type==="indicator"),et.push({col:Y,row:$-1,field:O,type:"dimension",menuKey:W}),C.menu.dropDownMenuHighlight=et,ft.unref(e).updateOption(C)}function D(W,O,Y,$,Q){var xt;const{dataConfig:et,menu:ot}=C;let K=et.sortRules,at=ot.dropDownMenuHighlight;const tt=Y.filter((de,Re)=>Re<Y.length-1).map(de=>de.value);let _t="";(xt=C.rows)!=null&&xt.length&&(_t=C.rows[C.rows.length-1].dimensionKey);const yt=K.findIndex(de=>de.sortField===_t);yt!==-1&&K.splice(yt,1);const ut=at.findIndex(de=>de.field===_t&&de.type==="dimension");ut!==-1&&at.splice(ut,1),K=K.filter(de=>!yf(de,"sortByIndicator")),at=at.filter(de=>de.type==="dimension"),(W==="asc"||W==="desc")&&K.push({sortField:_t,sortByIndicator:O,sortType:W.toUpperCase(),query:tt}),at.push({col:$,row:Q,field:O,type:"indicator",menuKey:W}),C.dataConfig.sortRules=K,C.menu.dropDownMenuHighlight=at,ft.unref(e).updateOption(C)}function N(W,O,Y){const $=ft.unref(e).getCellValue(O,Y),Q={};ft.unref(s)[W]&&(Q.filterData=ft.unref(s)[W]),a.value={tableInstance:e,fieldName:$,key:W,valueList:ft.unref(o)[W]||[],type:"dimension",...Q},ft.nextTick(()=>{h.value.show()})}function V(W,O){a.value={tableInstance:e,fieldName:O,key:W,type:"indicators",filterData:ft.unref(l)[W]},ft.nextTick(()=>{h.value.show()})}function G({indicatorKey:W,menuKey:O}){const Y=C.indicators.map(et=>et.indicatorKey);let $=C.indicators.length-1;const Q=`${W}-${O}`;C.indicators.forEach((et,ot)=>{et.indicatorKey===W&&($=ot+1,et.dropDownMenu=x(W,[...Y,Q]))}),y([{indicatorKey:Q,title:m[O],calculateType:O,width:"auto",showSort:!1,headerStyle:{fontWeight:"normal"},style:{padding:[16,28,16,28],bgColor(et){var K,at;const ot=et.cellHeaderPaths.rowHeaderPaths;if(((K=ot==null?void 0:ot[1])==null?void 0:K.value)==="Sub Totals")return"#ba54ba";if(((at=ot==null?void 0:ot[0])==null?void 0:at.value)==="Row Totals")return"#ff9900"}},dropDownMenu:[{text:"删除",menuKey:"delete"}]}],!0,$)}function U(){var ot;const W=C.rows[0]?C.rows[0].cornerDropDownMenu:[],O=C.columns[0]?C.columns[0].cornerDropDownMenu:[],Y=C.rows.map(K=>({...K,cornerDropDownMenu:O})),$=C.columns.map(K=>({...K,cornerDropDownMenu:W}));C.columns=Y,C.rows=$;const{type:Q,len:et}=C.aggregate||{};Q&&(C.records.splice(-et),C.aggregate={type:Q,len:0}),C.menu.dropDownMenuHighlight=[],s.value={},l.value={},d.value={},C.dataConfig.filterRules=[],ft.unref(e).updateOption(C),z("",$[0].dimensionKey,0,0),(ot=C.aggregate)!=null&&ot.type&&R(C.aggregate.type)}function Z({indicatorKey:W,fieldName:O}){const Y=j(W);if(Y>-1){const $=C.indicators[Y].formatConfig||{};ft.unref(u).showModal({...$,indicatorKey:W,fieldName:O})}}function q(W){const O=j(W);if(O>-1){const Y=C.indicators[O].conditionalConfig||[];ft.unref(c).showModal(W,Y)}}function j(W){return C.indicators.findIndex(O=>O.indicatorKey===W)}function rt(W){const O=ft.unref(_)[0],Y=M(ft.unref(_)),$={xLabel:O,yLabel:W,dimensionData:Y,records:C.records};console.log($),ft.unref(p).showModal($)}function ht(){e.value.on("dropdown_menu_click",W=>{var at;const{menuKey:O,field:Y,col:$,row:Q}=W,{dimensionKey:et,indicatorKey:ot,value:K}=Y[Y.length-1];switch(r.value=W,ft.unref(_).includes(O)&&T([{key:O,name:O,type:"rows"}]),O){case"drill":alert("无维度可钻取");break;case"delete":et?F(et,"rows"):ot&&L(ot);break;case"asc":case"desc":case"default-sort":et?z(O,et,$,Q):ot&&D(O,ot,Y,$,Q);break;case"filter":et?N(et,$,Q):ot&&V(ot,K);break;case"sqz":case"tqz":case"zje":case"hb":case"tb":case"zb":G({indicatorKey:ot,menuKey:O});break;case"trans":U();break;case"property":Z({indicatorKey:ot,fieldName:K});break;case"conditionalProperty":q(ot);break;case"aggregate":ft.unref(g).showModal((at=C.aggregate)==null?void 0:at.type,$,Q);break;case"top":ft.unref(f).showModal(C.topNum);break;case"graph":rt(ot);break}setTimeout(()=>{console.log("option",C)},500)})}const gt=W=>{k(W)},vt=()=>{};return t({refreshData:gt,click:vt}),ft.onMounted(()=>{}),{pivotTableRef:v,click:vt}}}),lD="",Bz=(n,t)=>{const e=n.__vccOpts||n;for(const[i,o]of t)e[i]=o;return e},Pz={key:0,class:"design-template"},Hz=["id"];function Ez(n,t,e,i,o,r){return n.pageMode==="design"?(ft.openBlock(),ft.createElementBlock("div",Pz," 透视表格 ")):(ft.openBlock(),ft.createElementBlock("div",{key:1,class:"table-instance",id:n.pageMode!=="design"?`pivotTableContainer_${n.id}`:"",ref:"pivotTableRef"},null,8,Hz))}const d1=f1(Bz(Mz,[["render",Ez],["__scopeId","data-v-d23b8c93"]])),u1=Object.freeze(Object.defineProperty({__proto__:null,PivotTable:d1},Symbol.toStringTag,{value:"Module"})),Lz={install:(n,t)=>{const{request:e}=t;n.provide("$request",e),Object.keys(u1).forEach(i=>{const o=u1[i];o.install&&n.use(o)})}};$n.PivotTable=d1,$n.default=Lz,Object.defineProperties($n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
307
307
|
//# sourceMappingURL=index.umd.js.map
|